def DetMenu(self): Gfont = cpn.font['general'] cpn.settext(self, 'StN', Gfont, (80, 300, 171, 31), "<font color=%s>%s</font>" % ('#5F2F2D', "Stall Name")) cpn.settext(self, 'ItN', Gfont, (80, 360, 171, 31), "<font color=%s>%s</font>" % ('#5F2F2D', "Item Name")) cpn.setTXbox(self, 'txt_S', (220, 300, 251, 41), "Enter here") cpn.setTXbox(self, 'txt_I', (220, 360, 251, 41), "Enter here") #lock stall Name cpn.txtbox['txt_S'].setDisabled(True) self.checkBox = QtWidgets.QCheckBox(self) self.checkBox.setGeometry(QtCore.QRect(530, 310, 85, 21)) self.checkBox.setChecked(True) self.checkBox.toggled.connect(cpn.txtbox['txt_S'].setDisabled) self.checkBox_balel = QtWidgets.QLabel(self) self.checkBox_balel.setGeometry(QtCore.QRect(550, 310, 85, 21)) self.checkBox_balel.setFont(QFont("Arial", 13, QFont.Bold)) self.checkBox_balel.setText("<font color=%s>%s</font>" % ('#5F2F2D', "LOCK")) self.pushButton = QtWidgets.QPushButton(self) self.pushButton.setGeometry(QtCore.QRect(530, 360, 121, 70)) self.pushButton.setText("DELETE\n The Menu") self.pushButton.setFont(QFont("Arial", 15, QFont.Bold)) cpn.settext( self, 'delhead', QFont("Arial", 40, 100, QFont.Bold), (110, 40, 500, 90), "<font color=%s>%s</font>" % ('#5F2F2D', "DETELE THE MENU")) self.pushButton.clicked.connect(self.delfromDB)
def SetupCalenderSet(self): cpn.setfont('Calender', 20, 75, True) self.stallCalenderTime = QtWidgets.QDateTimeEdit(self) self.stallCalenderTime.setGeometry(QtCore.QRect(120, 120, 351, 51)) self.stallCalenderTime.setFont(cpn.font['Calender']) self.stallCalenderTime.setDateTime(QtCore.QDateTime.currentDateTime()) self.stallCalenderTime.setButtonSymbols( QtWidgets.QAbstractSpinBox.NoButtons) self.stallCalenderTime.setKeyboardTracking(True) self.stallCalenderTime.setAlignment(QtCore.Qt.AlignCenter) self.stallCalenderTime.setStyleSheet("#stallCalenderTime {\n" " border-radius: 10px;\n" " padding: 2px 4px;\n" " color: #6c6c6c;}\n" "#stallCalenderTime:focus {\n" " color: #010101;}\n") #calender only self.calendarWidget = QtWidgets.QCalendarWidget(self) self.calendarWidget.setGeometry(QtCore.QRect(120, 230, 400, 300)) self.calendarWidget.setVerticalHeaderFormat( self.calendarWidget.NoVerticalHeader) fmtGreen = QtGui.QTextCharFormat() fmtGreen.setForeground(QtGui.QBrush(QtCore.Qt.green)) self.calendarWidget.setWeekdayTextFormat(QtCore.Qt.Saturday, fmtGreen) fmtOrange = QtGui.QTextCharFormat() fmtOrange.setForeground(QtGui.QBrush(QtGui.QColor(252, 140, 28))) self.calendarWidget.setWeekdayTextFormat(QtCore.Qt.Sunday, fmtOrange)
def load_stall_buttons(self): stalbtn = menu_data.ViewMenuButtons['stallBut'] for stall in stalbtn: cpn.buttonFullStyle(self, self.Get_click(stall['buttxt'][:3]), **stall)
def CartTaleb(self): cpn.setfont('table', 12, 75, True) self.tableWidget = QtWidgets.QTableWidget(self) self.tableWidget.setGeometry(QtCore.QRect(400, 90, 341, 421)) self.tableWidget.setColumnCount(0) self.tableWidget.setRowCount(0) self.tableWidget.horizontalHeader().setFont(cpn.font['table']) self.tableWidget.setFrameShape(QFrame.NoFrame) self.tableWidget.setColumnCount(3) self.tableWidget.setHorizontalHeaderLabels(['Items', 'Numbers', 'Price']) self.tableWidget.horizontalHeader().setFixedHeight(50) self.tableWidget.horizontalHeader().setSectionResizeMode(2, QHeaderView.Stretch)
def popup_message(self, textss): msg = QMessageBox(self.mainwidget) msg.setFont(Hfont) msg.setWindowTitle("Warning !!") if textss == 1: msg.setText(cpn.setcolor("Only Numbers Allowed!! <br />Please enter a valid integer number !", '#582255')) elif textss == 2: msg.setText(cpn.setcolor(" Exceed the Range!! Too big!! <br />Please enter a valid integer number !", '#B85255')) else: msg.setText(cpn.setcolor("Exceed the Range!! No Negative Value!! <br />Please enter a valid integer number !", '#881193')) msg.setGeometry(QtCore.QRect(400, 300, 200, 400)) x = msg.exec_()
def __init__(self, menuStall, DatetimeList=0, parent=None): super(View_Menu_Third_Page, self).__init__(parent) self.mainwidget = QtWidgets.QWidget(self) self.count = 0 self.items = {} ## ### loop and check for correct stall choosed ### pass value into the functions ### self.find_stall(menuStall) # set goback button cpn.newbuttonfunction(self, "goback", (640, 440, 72, 72), "GO \nBack", None, **style1)
def calculate_waiting_time(self, input_text): try: num_of_people = int(input_text) if num_of_people > 100: self.label_5.setText("Please enter a valid integer number") self.popup_message(textss=2) elif num_of_people < 0: self.label_5.setText("Please enter a valid integer number") self.popup_message(textss=0) else: self.label_6.setText("Your estimated waitting time is "+str(num_of_people*2)+" mins\n") self.label_5.setText(cpn.setcolor("Thank You for Using! <br />Have A Nice Day!",'#FA2C00')) except: self.label_5.setText(cpn.setcolor("Only Numbers Allowed! <br /> Please enter a valid integer number", '#DD5555')) self.popup_message(textss=1)
def __init__(self, parent=None): super(View_Menu_1st_Page, self).__init__(parent) #load background cpn.Set_Background(self, './Pictures/northspine.jpg') #set heading self.Page_heading()
def AddtoMenu(self): ## page set up self.menus() ## setup background cpn.Set_Background(self.centralWidget, "./Pictures/restaurant-menu-background.jpg") ## lock stall Name by check box cpn.txtbox['Stall Name'].setDisabled(True) ## check box self.checkBox = QtWidgets.QCheckBox(self) self.checkBox.setGeometry(QtCore.QRect(530, 310, 85, 21)) self.checkBox.setChecked(True) self.checkBox.toggled.connect(cpn.txtbox['Stall Name'].setDisabled) ## new txt lable cpn.settext(self, 'checkBox', cpn.Gefont, (550, 310, 85, 21), "<font color=%s>%s</font>" %('#5F2F2D', "LOCK")) ## new buttons cpn.newbuttonfunction(self, 'submit', (610, 340, 121, 70), "Submit\nTo Menu", None, **cpn.style2) cpn.newbuttonfunction(self, 'Browse', (500, 340, 121, 70), "Browse\nImage", self.getImage, **cpn.style2) self.submit_function ## new label title self.labeltitle = QtWidgets.QLabel(self) self.labeltitle.setGeometry(QtCore.QRect(210, 20, 300, 90)) self.labeltitle.setFont(QFont("Arial", 30, QFont.Bold)) self.labeltitle.setText("<font color=%s>%s</font>" %('#5F2F2D', "ADD TO MENU")) ## set image lables for selected dish self.label = QtWidgets.QLabel(self) self.label.setGeometry(QtCore.QRect(500, 160, 140, 120))
def __init__(self, parent=None): super(DeleteMenu, self).__init__(parent) #setup widget self.centralWidget = QtWidgets.QWidget(self) self.DeletMenu = QtWidgets.QWidget(self.centralWidget) self.DeletMenu.setGeometry(cpn.geometrysize) cpn.Set_Background(self, "./Pictures/restaurant-menu-background.jpg") self.items = {} self.DetMenu()
def __init__(self, menuStall, parent=None): super(View_Menu_2nd_Page, self).__init__(parent) ### loop and check for correct stall choosed ### pass value into the functions for stall in stallist: if (menuStall in stall['stallName']): # load background cpn.Set_Background(self, stall['menuBackground']) # set other lables and heading self.logoTips(stall) # set submit buttons cpn.newbuttonfunction(self, "calendarSubmit", (530, 110, 81, 91), "calendar \nSubmit", None, **style1) #set canlendar self.SetupCalenderSet()
def logoTips(self, stall): ## use setFont cpn.setfont('tip', 20, 85, True) ## use setlable cpn.settext(self, 'Tip', cpn.font['tip'], (150, 60, 350, 61), 'Please Select Date & Time') ## use setlable cpn.setlable(self, 'logo', (30, 150, 80, 70), stall['icon'], True)
def find_stall(self, menuStall): for stall in stallist: if (menuStall in stall['stallName']): ### set background ### cpn.Set_Background(self.mainwidget, stall['backGround']) for menu in stall['stallMenu']: ### ### this is form stalls page ### ### New function for loading menus ### Resued the menu function in stalls page ### It works perfectly fine. ### stalls.stalls_window.StallIcoPriName(self, menu, False)
def setup_Ui(self): self.setObjectName("Pay_First_Page") #self.CartTaleb() #set a stall background cpn.Set_Background(self, "./Pictures/northspine.jpg") self.label = QtWidgets.QLabel(self) self.label.setGeometry(QtCore.QRect(20, 90, 331, 321)) self.label.setPixmap(QtGui.QPixmap("./Pictures/NTU.jpg")) self.label.setScaledContents(True) cpn.setfont('Cartpay', 16, 75, True) self.label_2 = QtWidgets.QLabel(self) self.label_2.setGeometry(QtCore.QRect(240, 30, 350, 51)) self.label_2.setFont(cpn.font['Cartpay']) self.label_2.setAlignment(QtCore.Qt.AlignCenter) cpn.newbuttonfunction(self, "Paybut", (30, 430, 96, 96), "Pay", None, **styleblue) cpn.button['Paybut'].hide() cpn.newbuttonfunction(self, "loadbut", (240, 430, 96, 96), "Load \nData", self.load_data, **styleblue) self.label_2.setText(_translate("Cart_and_Pay", "<html><p><span style=\" font-size:26pt; font-weight:700; font-style:italic; color:#fcbf3e;\">Pay Your Bill Here<br /> </span></p></html>")) self.CartTaleb()
def setup_Ui(self): self.setObjectName("Form") self.mainwidget = QtWidgets.QWidget(self) self.CartPay_BG = QtWidgets.QLabel(self) self.CartPay_BG.setGeometry(cpn.geometrysize) self.CartPay_BG.setPixmap(QtGui.QPixmap('./Pictures/northspine.jpg')) self.CartPay_BG.setScaledContents(True) #create lables cpn.setlable(self, 'ntulion', (50, 410, 141, 171), "./Pictures/ntu_lion.png", True) cpn.setlable(self, 'queue', (240, 400, 551, 221), "./Pictures/paidui1.png", True) #creat txt lables cpn.settext(self, 'QHead', Hfont, (100, 40, 631, 81), cpn.setcolor("Enter the number of people in front of you", '#FF1144')) cpn.settext(self, 'num', Afont, (180, 150, 121, 20), cpn.setcolor("Number: ", '#630030')) #create text box cpn.setTXbox(self, 'Qnumb', (310, 150, 195, 31), ' ') #create lables self.label_5 = QtWidgets.QLabel(self) self.label_5.setGeometry(QtCore.QRect(190, 270, 431, 71)) self.label_6 = QtWidgets.QLabel(self) self.label_6.setGeometry(QtCore.QRect(190, 230, 431, 71)) self.label_5.setFont(Bfont) self.label_6.setFont(Bfont) #create a click button cpn.newbuttonfunction(self,"Blueclik", (530, 130, 72, 72), "Click", None, **styleblue) self.setWindowTitle(_translate("Form", "Form")) '''
def menus(self): # setup text box and text lables for index, i in enumerate(menu_data.menuKeys): verIncrease = 60 cpn.settext(self, i, cpn.Gefont, (80, 130 + index * verIncrease, 171, 31), "<font color=%s>%s</font>" %('#5F2F2D', i)) cpn.setTXbox(self, i, (220, 130 + index * verIncrease, 251, 41), "Enter here")
import sys from PyQt5.QtWidgets import QWidget, QMessageBox, QStackedWidget, QHeaderView, QFrame, QTableWidgetItem from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtGui import * from Functional import Component as cpn _translate = QtCore.QCoreApplication.translate buttons = {} styleblue = {"size":15, 'bold':True, 'weight':65, 'colorbgd':'#A03d5e', 'colorpress':'#04070f', 'colorhover':'#516cb0', 'w':'96', 'h':'105'} cpn.setfont('waiting', 14, 75, True) Afont = QFont("Arial", 16, 75, QFont.Bold) Bfont = QFont("Arial", 16, 75, QFont.Bold) Hfont = QFont("Arial", 22, 90, QFont.Bold) class Pay_First_Page(QWidget): #initialize def __init__(self, parent=None): super(Pay_First_Page, self).__init__(parent) self.setup_Ui() #self.loaddatabut.clicked.connect(self.load_data) #to load data from cart.txt def setup_Ui(self): self.setObjectName("Pay_First_Page") #self.CartTaleb() #set a stall background cpn.Set_Background(self, "./Pictures/northspine.jpg") self.label = QtWidgets.QLabel(self)