84 lines
2.7 KiB
Python
84 lines
2.7 KiB
Python
from PyQt5 import QtCore, QtWidgets
|
|
|
|
from summer.QtDesignerFiles.SaleWindow import SaleWindowQt
|
|
|
|
|
|
__author__ = 'tanshu'
|
|
|
|
|
|
class SaleWindow(SaleWindowQt, QtWidgets.QMainWindow):
|
|
def __init__(self, router, parent=None):
|
|
super(SaleWindow, self).__init__()
|
|
self.setupUi(self)
|
|
self.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)
|
|
self.actionButtons = []
|
|
self.mainButtons = []
|
|
self.fillActionBar()
|
|
self.fillMainButtons()
|
|
|
|
def addButton(self, widget, layout, name, text, connect=None):
|
|
button = QtWidgets.QPushButton(widget)
|
|
button.setObjectName(name)
|
|
button.setText(text)
|
|
button.setMinimumSize(75, 75)
|
|
button.setMaximumSize(75, 75)
|
|
layout.addWidget(button)
|
|
if connect is not None:
|
|
button.clicked.connect(connect(button))
|
|
return button
|
|
|
|
def addActionButton(self, name, text, connect=None):
|
|
button = self.addButton(self.abWidget, self.flActions, name, text, connect)
|
|
self.actionButtons.append(button)
|
|
|
|
def fillActionBar(self):
|
|
buttons = [
|
|
('quantity', 'Quantity'),
|
|
('delete', 'Delete'),
|
|
('discount', 'Discount - F3'),
|
|
('modifier', 'Modifier'),
|
|
('waiter', 'Waiter - F5'),
|
|
('print_kot', 'Print KOT - F12'),
|
|
('print_bill', 'Print Bill - F11'),
|
|
('clear', 'Clear - Esc'),
|
|
('settle_bill', 'Settle Bill'),
|
|
('rate', 'Rate'),
|
|
('move_table', 'Move Table'),
|
|
('void_bill', 'Void Bill'),
|
|
('move_kot', 'Move KOT'),
|
|
('split_bill', 'Split Bill')
|
|
]
|
|
for name, text in buttons:
|
|
self.addActionButton(name, text, self.hide_button)
|
|
|
|
|
|
def addMainButton(self, name, text, connect=None):
|
|
button = self.addButton(self.mbWidget, self.flMainButtons, name, text, connect)
|
|
self.mainButtons.append(button)
|
|
|
|
def hide_button(self, button):
|
|
def inner():
|
|
button.hide()
|
|
|
|
return inner
|
|
|
|
def fillMainButtons(self):
|
|
buttons = [
|
|
('quantity', 'Quantity'),
|
|
('delete', 'Delete'),
|
|
('discount', 'Discount - F3'),
|
|
('modifier', 'Modifier'),
|
|
('waiter', 'Waiter - F5'),
|
|
('print_kot', 'Print KOT - F12'),
|
|
('print_bill', 'Print Bill - F11'),
|
|
('clear', 'Clear - Esc'),
|
|
('settle_bill', 'Settle Bill'),
|
|
('rate', 'Rate'),
|
|
('move_table', 'Move Table'),
|
|
('void_bill', 'Void Bill'),
|
|
('move_kot', 'Move KOT'),
|
|
('split_bill', 'Split Bill')
|
|
]
|
|
for name, text in buttons:
|
|
self.addMainButton(name, text, self.hide_button)
|