-
Notifications
You must be signed in to change notification settings - Fork 1
/
guiController.py
64 lines (51 loc) · 2.84 KB
/
guiController.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
56
57
58
59
60
61
62
63
64
from sqltesting import *
import sys
from PyQt6 import uic
from PyQt6.QtWidgets import *
class MainWindow(QMainWindow):
def __init__(self):
"""
Initializes the main window of the application and sets up the UI, widgets,
as well as initializes data for the information being displayed.
"""
super().__init__()
uic.loadUi('videoGameStore.ui', self)
self.newInvoiceWidgetSetup()
def newInvoiceWidgetSetup(self):
self.nameComboBoxNewInvoiceTab = self.findChild(QComboBox, 'nameComboBoxNewInvoiceTab')
self.emailLineNewInvoiceTab = self.findChild(QLineEdit, 'emailLineEditNewInvoiceTab')
self.idLineEditNewInvoiceTab = self.findChild(QLineEdit, 'idLineEditNewInvoiceTab')
self.productComboBoxNewInvoiceTab = self.findChild(QComboBox, 'productComboBoxNewInvoiceTab')
self.productNumberSpinBoxNewInvoiceTab = self.findChild(QSpinBox, 'productNumberSpinBoxNewInvoiceTab')
self.invoiceTotalLineEditNewInvoiceTab = self.findChild(QLineEdit, 'invoiceTotalLineEditNewInvoiceTab')
self.invoiceListTableWidgetNewInvoiceTab = self.findChild(QTableWidget, 'invoiceListTableWidgetNewInvoiceTab')
self.addProductButtonNewInvoiceTab = self.findChild(QPushButton, 'addProductButtonNewInvoiceTab')
# self.addProductButtonNewInvoiceTab.clicked.connect(self.addProductButtonNewInvoiceTabClickHandler)
self.removeProductButtonNewInvoiceTab = self.findChild(QPushButton, 'removeProductButtonNewInvoiceTab')
#self.removeProductButtonNewInvoiceTab.clicked.connect(self.removeProductButtonNewInvoiceTabClickHandler)
self.purchaseButtonNewInvoiceTab = self.findChild(QPushButton, 'purchasebutton')
#self.purchaseButtonNewInvoiceTab.clicked.connect(purchaseButtonNewInvoiceTabClickHandler)
customers = getCustomerNames()
games = getProductNames()
for name in customers:
self.nameComboBoxNewInvoiceTab.addItem(str(name))
self.nameComboBoxNewInvoiceTab.currentIndexChanged.connect(self.nameComboBoxNewInvoiceTabCurrentIndexChangedHandler)
for game in games:
self.productComboBoxNewInvoiceTab.addItem(str(game))
def nameComboBoxNewInvoiceTabCurrentIndexChangedHandler(self):
try:
custName = self.nameComboBoxNewInvoiceTab.currentText()
info = getCustByName(custName)
self.emailLineNewInvoiceTab.setText(info['email'])
self.idLineEditNewInvoiceTab.setText(str(info['customer_id']))
except Exception as e:
print(e)
# def addProductButtonNewInvoiceTabClickHandler(self):
# try:
# prodName = self.productComboBoxNewInvoiceTab.currentText()
# info = getGameInfoByName(prodName)
if __name__ == '__main__':
app = QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec()