コード例 #1
0
    def initUI(self):
        t1 = AppName("")
        t1.setMaximumWidth(600)
        t1.setGeometry(100, 0, 600, 160)

        t2 = Login()

        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)

        layout.addWidget(t2)
        layout.addWidget(t1)

        centralWidget = QWidget()
        centralWidget.setLayout(layout)

        self.setCentralWidget(centralWidget)

        self.resize(800, 1000)
        self.setWindowTitle("Test")

        self.show()
コード例 #2
0
    def initUI(self):

        # sidebar = Sidebar(self)
        # self.addDockWidget(Qt.LeftDockWidgetArea, sidebar)

        header = AppName("login")
        footer = Footer()

        layout = QVBoxLayout()

        username_row = QHBoxLayout()
        password_row = QHBoxLayout()
        login_btn = QHBoxLayout()
        errorMsg = QHBoxLayout()

        self.labelUsername = QLabel("Username")
        self.usernameInput = QLineEdit()
        self.usernameInput.setFixedWidth(300)

        self.labelPassword = QLabel("Password")
        self.passwordInput = QLineEdit()
        self.passwordInput.setEchoMode(QLineEdit.Password)

        self.passwordInput.setFixedWidth(300)

        self.loginBtn = QPushButton("Login")
        self.loginBtn.setFixedWidth(200)
        self.loginBtn.setFocusPolicy(Qt.StrongFocus)
        self.loginBtn.setShortcut("Return")
        self.loginBtn.clicked.connect(self.loginBtnClicked)

        self.loginErrorMsg = QLabel("")

        username_row.addStretch()
        username_row.addWidget(self.labelUsername)
        username_row.addWidget(self.usernameInput)
        username_row.addStretch()

        password_row.addStretch()
        password_row.addWidget(self.labelPassword)
        password_row.addWidget(self.passwordInput)
        password_row.addStretch()

        login_btn.addStretch()
        login_btn.addWidget(self.loginBtn)
        login_btn.addStretch()

        errorMsg.addStretch()
        errorMsg.addWidget(self.loginErrorMsg)
        errorMsg.addStretch()

        layout.addWidget(header)
        # layout.addWidget(frame)
        layout.addStretch()
        layout.addLayout(username_row)
        layout.addLayout(password_row)
        layout.addLayout(login_btn)
        layout.addLayout(errorMsg)
        layout.addStretch()
        layout.addWidget(footer)

        layout.setContentsMargins(0, 0, 0, 0)

        centralWidget = QWidget()
        centralWidget.setLayout(layout)

        self.setCentralWidget(centralWidget)
        self.setContentsMargins(0, 0, 0, 0)

        self.resize(800, 600)
        self.setWindowTitle("Login")
        self.show()

        self.center()
コード例 #3
0
    def initUI(self):

        in_class = "menu"

        self.sidebar = sidebar.Sidebar(self)
        self.sidebar.window.connect(self.getvalue)

        self.addDockWidget(Qt.LeftDockWidgetArea, self.sidebar)

        header = AppName(in_class)
        footer = Footer()

        add_and_search = AddSearchFrame(in_class)
        add_and_search.add_button.clicked.connect(lambda: self.add_menu(in_class))
        add_and_search.search_button.clicked.connect(
                                        lambda: self.search_menu(add_and_search.search_box))


        self.table = QTableWidget()
        self.table.setColumnCount(5)
        # self.table.setStyleSheet("border: none")
        # self.table.setStyleSheet(
        #     "background-color: rgb(255, 255, 255);\n"
        #     'font: 10pt "MS Shell Dlg 2";\n'
        #     "color: rgb(30, 45, 66);"
        # )

        # self.table.setHorizontalHeaderItem(0, QTableWidgetItem("ID"))
        self.table.setHorizontalHeaderItem(0, QTableWidgetItem("Food"))
        self.table.setHorizontalHeaderItem(1, QTableWidgetItem("Category"))
        self.table.setHorizontalHeaderItem(2, QTableWidgetItem("Price"))
        # self.table.setHorizontalHeaderItem(3, QTableWidgetItem("Bonus"))
        # self.table.setHorizontalHeaderItem(3, QTableWidgetItem("Joining Date"))
        # self.table.setHorizontalHeaderItem(6, QTableWidgetItem("Total Salary"))
        self.table.setHorizontalHeaderItem(3, QTableWidgetItem("Edit"))
        self.table.setHorizontalHeaderItem(4, QTableWidgetItem("Delete"))


        data = self.load_menu_data()
        print(data)

        for x in data:
            print(x)

        self.populate_table(data)
        self.table.resizeColumnsToContents()

        layout = QVBoxLayout()

        layout.addWidget(header)
        layout.addWidget(add_and_search)
        layout.addWidget(self.table)
        # layout.addStretch()
        layout.addWidget(footer)

        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)

        centralWidget = QWidget()
        centralWidget.setLayout(layout)

        self.setCentralWidget(centralWidget)
        self.setContentsMargins(0, 0, 0, 0)

        # self.resize(800, 600)
        self.setWindowTitle("Employee")
        self.resize(1160, 605)

        self.show()
        self.center()
コード例 #4
0
    def initUI(self):
        self.sidebar = sidebar.Sidebar(self)
        self.sidebar.window.connect(self.getvalue)

        print("Dashboard")
        self.addDockWidget(Qt.LeftDockWidgetArea, self.sidebar)

        header = AppName("dashboard")
        footer = Footer()

        statslabel = QLabel("Statistics")
        statslabel.setStyleSheet("color: rgb(30, 45, 66);"
                                 'font: 75 16pt "MS Shell Dlg 2";')
        statslabel.setContentsMargins(20, 15, 0, 0)

        statistics = QHBoxLayout()

        dashboardsales = DashboardSales()
        dashboardorders = DashboardOrders()
        # dashboardprofits = DashboardProfits()

        statistics.addStretch()
        statistics.addWidget(dashboardsales)
        statistics.addStretch()
        statistics.addWidget(dashboardorders)
        statistics.addStretch()
        # statistics.addWidget(dashboardprofits)
        # statistics.addStretch()

        restaurantlabel = QLabel("Restaurant")
        restaurantlabel.setStyleSheet("color: rgb(30, 45, 66);"
                                      'font: 75 16pt "MS Shell Dlg 2";')
        restaurantlabel.setContentsMargins(20, 0, 0, 0)

        restaurantdetails = RestaurantDetails()

        layout = QVBoxLayout()

        layout.addWidget(header)
        layout.addWidget(statslabel)
        layout.addWidget(HLine())
        layout.addLayout(statistics)
        layout.addWidget(HLine())
        layout.addWidget(restaurantlabel)
        layout.addWidget(HLine())
        layout.addWidget(restaurantdetails)
        layout.addStretch()
        layout.addWidget(footer)

        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)

        centralWidget = QWidget()
        centralWidget.setLayout(layout)

        print("hello")

        self.setCentralWidget(centralWidget)
        self.setContentsMargins(0, 0, 0, 0)

        self.resize(1160, 605)
        self.setWindowTitle("Login")

        self.show()

        self.center()
コード例 #5
0
    def initUI(self):

        in_class = "tables"

        self.sidebar = sidebar.Sidebar(self)
        self.sidebar.window.connect(self.getvalue)

        self.addDockWidget(Qt.LeftDockWidgetArea, self.sidebar)

        header = AppName(in_class)
        footer = Footer()

        add_and_search = AddSearchFrame(in_class)
        add_and_search.add_button.clicked.connect(
            lambda: self.add_tables(in_class))
        add_and_search.search_button.clicked.connect(
            lambda: self.search_tables(add_and_search.search_box))

        self.table = QTableWidget()
        self.table.setColumnCount(4)
        # self.table.setStyleSheet("border: none")
        # self.table.setStyleSheet(
        #     "background-color: rgb(255, 255, 255);\n"
        #     'font: 10pt "MS Shell Dlg 2";\n'
        #     "color: rgb(30, 45, 66);"
        # )

        # self.table.setHorizontalHeaderItem(0, QTableWidgetItem("ID"))
        self.table.setHorizontalHeaderItem(0, QTableWidgetItem("Table Name"))
        self.table.setHorizontalHeaderItem(1, QTableWidgetItem("Covers"))
        self.table.setHorizontalHeaderItem(2, QTableWidgetItem("Edit"))
        self.table.setHorizontalHeaderItem(3, QTableWidgetItem("Delete"))

        # self.table.insertRow(self.table.rowCount())
        #
        # self.table.setItem(self.table.rowCount() - 1, 0, QTableWidgetItem("ID1"))
        # self.table.setItem(self.table.rowCount() - 1, 1, QTableWidgetItem("Name1"))
        # self.table.setItem(self.table.rowCount() - 1, 2, QTableWidgetItem("Job1"))
        # self.table.setItem(self.table.rowCount() - 1, 3, QTableWidgetItem("Joining Date1"))
        # self.table.setItem(self.table.rowCount() - 1, 4, QTableWidgetItem("Salary1"))
        # self.table.setItem(self.table.rowCount() - 1, 5, QTableWidgetItem("Bonus1"))
        # self.table.setItem(self.table.rowCount() - 1, 6, QTableWidgetItem("Total Salary1"))
        # self.table.setItem(self.table.rowCount() - 1, 7, QTableWidgetItem("Edit1"))
        # self.table.setItem(self.table.rowCount() - 1, 8, QTableWidgetItem("Delete1"))

        data = self.load_tables_data()
        print(data)

        for x in data:
            print(x)

        self.populate_table(data)

        layout = QVBoxLayout()

        layout.addWidget(header)
        layout.addWidget(add_and_search)
        layout.addWidget(self.table)
        # layout.addStretch()
        layout.addWidget(footer)

        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)

        centralWidget = QWidget()
        centralWidget.setLayout(layout)

        self.setCentralWidget(centralWidget)
        self.setContentsMargins(0, 0, 0, 0)

        # self.resize(800, 600)
        self.setWindowTitle("Login")
        self.resize(1160, 605)

        self.show()
        self.center()
コード例 #6
0
    def initUI(self):

        in_class = "orders"

        self.sidebar = sidebar.Sidebar(self)
        self.sidebar.window.connect(self.getvalue)

        self.addDockWidget(Qt.LeftDockWidgetArea, self.sidebar)

        header = AppName(in_class)
        footer = Footer()

        self.scrollArea = QScrollArea()
        # self.scrollArea.setContentsMargins(0, 0, 0, 0)
        self.scrollArea.setStyleSheet("Border: none")

        left_content = QVBoxLayout(self.scrollArea)
        left_content.setContentsMargins(0, 0, 0, 0)
        left_content.setSpacing(0)

        table = QLabel("Table No")

        table_list = self.get_tables()

        self.table_no = QComboBox()
        self.table_no.setFixedWidth(250)
        self.table_no.addItems(table_list)

        hl = QHBoxLayout()
        hl.addStretch()
        hl.addWidget(table)
        hl.addStretch()
        hl.addWidget(self.table_no)
        hl.addStretch()

        # left_content.addLayout(hlayout1)
        left_content.addLayout(hl)

        menu_list = self.get_menu_items()

        for key, value in menu_list.items():
            if value:
                category = QLabel(key)
                category.setAlignment(Qt.AlignCenter)

                left_content.addWidget(category)

                for x in value:
                    quantity = QLineEdit()
                    quantity.setFixedWidth(50)
                    quantity.setFixedHeight(50)

                    xtimes = QLabel(" X ")

                    widget2 = MenuItems(x)
                    widget2.setMouseTracking(True)
                    widget2.mouseMoveEvent = functools.partial(self.mouse_moved, source_object=widget2)
                    widget2.leaveEvent = functools.partial(self.mouse_left, source_object=widget2)
                    widget2.mousePressEvent = functools.partial(self.mouse_pressed,
                                                                source_object=[quantity, widget2])
                    widget2.setStyleSheet("background-color: grey; color: black")

                    hlayout2 = QHBoxLayout()
                    hlayout2.setContentsMargins(10, 10, 0, 0)
                    hlayout2.addWidget(quantity)
                    hlayout2.addWidget(xtimes)
                    hlayout2.addWidget(widget2)

                    # widget2.mousePressEvent = functools.partial(self.mouse_pressed, source_object=hlayout2)

                    left_content.addLayout(hlayout2)
                    left_content.addStretch()

        # left_content.addLayout(hlayout2)



        # self.thumbnail = QHBoxLayout()
        # self.scrollArea.setMaximumWidth(self.width()/2)

        self.scrollChildArea = QWidget()
        self.scrollChildArea.setLayout(left_content)

        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        # self.scrollArea.setMinimumHeight(160)
        # self.scrollArea.setMaximumHeight(160)
        self.scrollArea.setWidget(self.scrollChildArea)
        # self.scrollArea.setFrameShape(QFrame().NoFrame)
        self.scrollArea.setStatusTip("Preview")

        # ---------------------------------------------------
        self.scrollArea2 = QScrollArea()
        # self.scrollArea2.setContentsMargins(0, 0, 0, 0)
        self.scrollArea2.setStyleSheet("Border: none")
        # ---------------------------------------------------

        self.right_content = QVBoxLayout(self.scrollArea2)
        self.right_content.setContentsMargins(0, 0, 0, 0)
        # self.right_content.setAlignment(Qt.AlignCenter)

        # ---------------------------------------------------
        self.scrollChildArea2 = QWidget()
        self.scrollChildArea2.setLayout(self.right_content)

        self.scrollArea2.setWidgetResizable(True)
        self.scrollArea2.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.scrollArea2.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        # self.scrollArea2.setMinimumHeight(160)
        # self.scrollArea2.setMaximumHeight(160)
        self.scrollArea2.setWidget(self.scrollChildArea2)
        # self.scrollArea2.setFrameShape(QFrame().NoFrame)
        self.scrollArea2.setStatusTip("Preview")
        bar = self.scrollArea2.verticalScrollBar()
        bar.rangeChanged.connect(lambda: bar.setValue(bar.maximum()))
        # ---------------------------------------------------

        bill = QLabel()
        bill.setText("Bill")
        bill.setAlignment(Qt.AlignCenter)
        bill.setFixedWidth(450)
        bill.setStyleSheet("font: 75 20pt \"MS Shell Dlg 2\";")

        self.msg = QLabel("")
        self.msg.setFixedHeight(50)

        print_bill = QPushButton("Send")
        print_bill.setFixedWidth(100)
        print_bill.setFixedHeight(50)
        print_bill.setStyleSheet("font: 75 12pt \"MS Shell Dlg 2\";\n"
                                 "background-color: rgb(30, 45, 66);\n"
                                 "color: rgb(255, 255, 255);")
        print_bill.clicked.connect(self.send_bill)

        hl2 = QHBoxLayout()
        hl2.addWidget(self.msg, alignment=Qt.AlignCenter)
        hl2.addWidget(print_bill, alignment=Qt.AlignRight)

        self.total = 0.00
        self.food_order = []

        self.total_amount = QLabel("Total : " + str(self.total))
        self.total_amount.setAlignment(Qt.AlignRight)


        self.right_content.addWidget(bill)
        self.right_content.addStretch()
        self.right_content.addWidget(self.total_amount)
        self.right_content.addLayout(hl2)
        self.right_content.addStretch()

        content = QGridLayout()
        content.setContentsMargins(0, 0, 0, 0)
        content.setSpacing(0)

        content.addWidget(self.scrollArea, 0, 0)
        content.addWidget(self.scrollArea2, 0, 1)


        layout = QVBoxLayout()

        layout.addWidget(header)
        layout.addLayout(content)
        layout.addStretch()
        layout.addWidget(footer)

        layout.setContentsMargins(0, 0, 0, 0)

        centralWidget = QWidget()
        centralWidget.setLayout(layout)

        self.setCentralWidget(centralWidget)
        self.setContentsMargins(0, 0, 0, 0)



        self.setWindowTitle("Settings")
        self.resize(1160, 605)

        self.show()
        self.center()
コード例 #7
0
    def initUI(self):

        in_class = "settings"

        self.sidebar = sidebar.Sidebar(self)
        self.sidebar.window.connect(self.getvalue)

        self.addDockWidget(Qt.LeftDockWidgetArea, self.sidebar)

        header = AppName(in_class)
        footer = Footer()

        change_passwordbtn = QPushButton("Change Password")
        change_passwordbtn.setStyleSheet("background-color: rgb(30, 45, 66);\n"
                                         "font: 75 12pt \"MS Shell Dlg 2\";\n"
                                         "color: rgb(255, 255, 255);")
        change_passwordbtn.setFixedWidth(170)
        change_passwordbtn.setFixedHeight(40)
        change_passwordbtn.clicked.connect(self.change_password)

        add_userbtn = QPushButton("Add User")
        add_userbtn.setStyleSheet("background-color: rgb(30, 45, 66);\n"
                                  "font: 75 12pt \"MS Shell Dlg 2\";\n"
                                  "color: rgb(255, 255, 255);")
        add_userbtn.setFixedWidth(170)
        add_userbtn.setFixedHeight(40)
        add_userbtn.clicked.connect(self.add_user)

        edit_restaurant_label = QLabel("Edit Restaurant Information")
        edit_restaurant_label.setStyleSheet(
            "color: rgb(30, 45, 66);\n"
            "font: 75 20pt \"MS Shell Dlg 2\";")

        restaurantlabel = QLabel()
        restaurantlabel.setText("Name")
        restaurantlabel.setGeometry(QRect(80, 100, 47, 13))
        restaurantlabel.setFixedWidth(190)
        restaurantlabel.setFixedHeight(40)
        restaurantlabel.setStyleSheet("color: rgb(30, 45, 66);\n"
                                      'font: 75 18pt "MS Shell Dlg 2";')

        self.restauranttextbox = QLineEdit()
        self.restauranttextbox.setGeometry(QRect(160, 90, 181, 31))
        self.restauranttextbox.setFixedWidth(280)
        self.restauranttextbox.setFixedHeight(40)

        addresslabel = QLabel()
        addresslabel.setText("Job Title")
        addresslabel.setGeometry(QRect(80, 140, 61, 16))
        addresslabel.setFixedWidth(190)
        addresslabel.setFixedHeight(40)
        addresslabel.setStyleSheet("color: rgb(30, 45, 66);\n"
                                   'font: 75 18pt "MS Shell Dlg 2";')

        self.addresstextbox = QLineEdit()
        self.addresstextbox.setGeometry(QRect(160, 130, 181, 31))
        self.addresstextbox.setFixedWidth(280)
        self.addresstextbox.setFixedHeight(40)

        contact = QLabel()
        contact.setText("Salary")
        contact.setGeometry(QRect(80, 180, 47, 13))
        contact.setFixedWidth(190)
        contact.setFixedHeight(40)
        contact.setStyleSheet("color: rgb(30, 45, 66);\n"
                              'font: 75 18pt "MS Shell Dlg 2";')

        self.contacttextbox = QLineEdit()
        self.contacttextbox.setGeometry(QRect(160, 170, 181, 31))
        self.contacttextbox.setFixedWidth(280)
        self.contacttextbox.setFixedHeight(40)
        self.contacttextbox.setValidator(QIntValidator())

        update_btn = QPushButton("Update")
        update_btn.setGeometry(QRect(370, 500, 131, 41))
        update_btn.setStyleSheet("background-color: rgb(30, 45, 66);\n"
                                 "font: 75 12pt \"MS Shell Dlg 2\";\n"
                                 "color: rgb(255, 255, 255);")
        update_btn.setFixedWidth(130)
        update_btn.setFixedHeight(40)
        update_btn.clicked.connect(self.update_data)

        self.load_data()

        hlayout1 = QHBoxLayout()
        hlayout1.addStretch()
        hlayout1.addWidget(change_passwordbtn)
        hlayout1.addWidget(add_userbtn)
        hlayout1.addStretch()

        hlayout2 = QHBoxLayout()
        hlayout2.addStretch()
        hlayout2.addWidget(edit_restaurant_label)
        hlayout2.addStretch()

        hlayout3 = QHBoxLayout()
        hlayout3.addStretch()
        hlayout3.addWidget(restaurantlabel)
        hlayout3.addWidget(self.restauranttextbox)
        hlayout3.addStretch()

        hlayout4 = QHBoxLayout()
        hlayout4.addStretch()
        hlayout4.addWidget(addresslabel)
        hlayout4.addWidget(self.addresstextbox)
        hlayout4.addStretch()

        hlayout5 = QHBoxLayout()
        hlayout5.addStretch()
        hlayout5.addWidget(contact)
        hlayout5.addWidget(self.contacttextbox)
        hlayout5.addStretch()

        hlayout6 = QHBoxLayout()
        hlayout6.addStretch()
        hlayout6.addWidget(update_btn)
        hlayout6.addStretch()

        layout = QVBoxLayout()

        layout.addWidget(header)
        layout.addLayout(hlayout1)
        layout.addStretch()
        layout.addLayout(hlayout2)
        layout.addLayout(hlayout3)
        layout.addLayout(hlayout4)
        layout.addLayout(hlayout5)
        layout.addLayout(hlayout6)
        layout.addStretch()
        layout.addStretch()
        layout.addWidget(footer)

        layout.setContentsMargins(0, 0, 0, 0)

        centralWidget = QWidget()
        centralWidget.setLayout(layout)

        self.setCentralWidget(centralWidget)
        self.setContentsMargins(0, 0, 0, 0)

        self.setWindowTitle("Settings")
        self.resize(1160, 605)

        self.show()
        self.center()