Esempio n. 1
0
    def add_user(self):
        if self.addUserUnameEdit.isModified() == True and self.addUserPwdEdit.isModified() == True and \
                        self.addUserRptPwdEdit.isModified() == True:
            if self.addUserPwdEdit.text() == self.addUserRptPwdEdit.text():
                u_name = self.addUserUnameEdit.text()
                pwd = self.addUserPwdEdit.text()
                databaseManagement.create_user(u_name, pwd)
                self.addUserUnameEdit.clear()
                self.addUserPwdEdit.clear()
                self.addUserRptPwdEdit.clear()
                msg_box = QMessageBox(self)
                msg_box.setText('New user Added!!!!')
                msg_box.show()
                msg_box.exec_()
                self.userComboBox.clear()
                self.userComboBox.addItems(databaseManagement.get_users())

            else:
                msg_box = QMessageBox(self)
                msg_box.setText('The passwords do not match')
                msg_box.show()
                msg_box.exec_()
                self.addUserUnameEdit.clear()
                self.addUserPwdEdit.clear()
                self.addUserRptPwdEdit.clear()
        else:
            mBox = QMessageBox(self)
            mBox.setText('Make sure you fill all the spaces')
            mBox.show()
            mBox.exec_()
            self.addUserUnameEdit.clear()
            self.addUserPwdEdit.clear()
            self.addUserRptPwdEdit.clear()
Esempio n. 2
0
 def delete_user(self):
     user_del = self.userComboBox.currentText()
     """first confirm"""
     confirm_box = QMessageBox(self)
     confirm_box.setText("This user will be deleted.")
     confirm_box.setInformativeText("Once the user is deleted, they can not be recovered.")
     confirm_box.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
     confirm_box.setDefaultButton(QMessageBox.Cancel)
     ret = confirm_box.exec_()
     if ret == QMessageBox.Ok:
         databaseManagement.delete_user(user_del)
         self.userComboBox.clear()
         self.userComboBox.addItems(databaseManagement.get_users())
     else:
         pass
Esempio n. 3
0
 def __init__(self, parent=None):
     super(AdminMainWindow, self).__init__(parent)
     self.setupUi(self)
     self.tabWidget.setCurrentWidget(self.reportsTab)
     self.userComboBox.clear()
     self.userComboBox.addItems(databaseManagement.get_users())
     self.connect(self.inventoryBtn, SIGNAL('clicked()'),
                  self.inventory_btn_signal)
     self.connect(self.reportsBtn, SIGNAL('clicked()'),
                  self.reports_btn_signal)
     self.connect(self.logoutBtn, SIGNAL('clicked()'), self.logout)
     self.connect(self.addUserBtn, SIGNAL('clicked()'), self.add_user)
     self.connect(self.deleteUserBtn, SIGNAL('clicked()'), self.delete_user)
     self.setWindowTitle("Point of Sale System")
     self.connect(self.inventoryAddItemBtn, SIGNAL('clicked()'), self.add_new_item)
     self.connect(self.searchBtn, SIGNAL('clicked()'), self.search_inventory)
     self.connect(self.inventorySeachEdit, SIGNAL('returnPressed()'), self.search_inventory)
     sales_today = databaseManagement.today_sales()
     self.todaysSalesLCD.setSegmentStyle(QLCDNumber.Flat)
     self.todaysSalesLCD.setDigitCount(7)
     self.todaysSalesLCD.display(sales_today)
Esempio n. 4
0
 def __init__(self, parent=None):
     super(LoginDlg, self).__init__(parent)
     self.setupUi(self)
     self.userComboBox.clear()
     self.userComboBox.addItems(databaseManagement.get_users())
     self.connect(self.loginBtn, SIGNAL('clicked()'), self.login)