-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
29 lines (24 loc) · 1.02 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import json
from UI.gui import App
from sticker.stickers import Stickers
from sticker.sticker_data import StickerDataNumber, StickerDataText, StickerDataDate, StickerDataList
from sticker.sticker_type import StickerType
data = json.load(open('model/data.json', encoding='utf-8-sig'))
print(data)
stickers = Stickers()
for sticker in data:
print(sticker)
datas = []
for data in sticker['data']:
print(data)
if data['type'] == 'number':
datas.append(StickerDataNumber(data['name'], data['template_name'], None))
elif data['type'] == 'text':
datas.append(StickerDataText(data['name'], data['template_name'], None))
elif data['type'] == 'date':
datas.append(StickerDataDate(data['name'], data['template_name'], None))
elif data['type'] == 'list':
datas.append(StickerDataList(data['name'], data['template_name'], data['values']))
stickers.add_sticker(StickerType(sticker['name'], sticker['template'], datas))
app = App(stickers)
app.mainloop()