-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCustomWidgetCreator.py
55 lines (44 loc) · 1.78 KB
/
CustomWidgetCreator.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from CustomWidgets import *
from Singleton import SingletonInstance
class CustomWidgetCreator(SingletonInstance):
def __init__(self) -> None:
pass
def menuButton(self, text, menu):
return MenuButton(text, menu)
def menuQuantityWindow(self):
window = MenuQuantityWindow()
return window
def tableWidgetItem(self, text):
widget = QTableWidgetItem(text)
widget.setTextAlignment(Qt.AlignCenter)
font = QFont()
font.setPointSize(7)
widget.setFont(font)
return widget
def cartItemManageButton(self, managetype):
if managetype == "decrease":
return CartItemManageButton("-")
elif managetype == "increase":
return CartItemManageButton("+")
elif managetype == "remove":
return CartItemManageButton("x")
elif managetype == "edit":
return CartItemManageButton("수정")
def numTicket(self, num, tprice, cart):
window = NumTicket()
table = window.orderitemTable
window.numticket.setText(str(num))
window.totalprice.setText(f'합계: {tprice} ₩')
table.setRowCount(len(cart))
for i, data in enumerate(cart.values()):
menu = data['menu']
table.setItem(i, 0, self.tableWidgetItem(menu.name))
table.setItem(i, 1, self.tableWidgetItem(str(menu.price)))
table.setItem(i, 2, self.tableWidgetItem(str(data['quantity'])))
return window
def menuEditor(self, name, price, type, menutypes):
window = MenuEditor(name, price, type, menutypes)
return window
def menuCreator(self, menutypes):
window = MenuCreator(menutypes)
return window