Beispiel #1
0
 def __init__(self):
     super().__init__()
     self.db = DataBaseManager()
     self.check_manager = CheckManager()
     self.warning_manager = WarningManager()
     self.email_notifications = EmailNotifications()
     self.helpers = Helpers()
Beispiel #2
0
 def __init__(self, user_name):
     self.USER_NAME = user_name
     self.db = DataBaseManager()
     self.check_manager = CheckManager()
     self.warning_manager = WarningManager()
     self.email_notifications = EmailNotifications()
     self.helpers = Helpers()
class Sheet(QMainWindow):
    def __init__(self):
        super().__init__()
        self.db = DataBaseManager()
        self.check_manager = CheckManager()
        self.warning_manager = WarningManager()
        self.email_notifications = EmailNotifications()
        self.helpers = Helpers()
        self.show_sprzet()

    def show_sprzet(self):
        headers = ['sprzet', 'ilosc']

        list_sprzet = self.db.get_all_sprzet()
        self.widget = Table_sprzet(len(list_sprzet), 2)
        self.widget.setHorizontalHeaderLabels(headers)

        i = 0
        for sprzet in list_sprzet:
            item_nazwa = QTableWidgetItem(sprzet.sprzet)
            item_ilosc = QTableWidgetItem(str(sprzet.ilosc))
            self.widget.setItem(i, 0, item_nazwa)
            self.widget.setItem(i, 1, item_ilosc)

            i += 1

        self.setCentralWidget(self.widget)
        self.resize(250, 300)
        self.show()
class Sheet(QMainWindow):
    def __init__(self):
        super().__init__()
        self.db = DataBaseManager()
        self.check_manager = CheckManager()
        self.warning_manager = WarningManager()
        self.email_notifications = EmailNotifications()
        self.helpers = Helpers()
        self.show_sprzet()

    def show_sprzet(self):
        headers = ['ulicy', 'data', 'klient']

        list_orders = self.db.get_all_orders()
        self.widget = Table_sprzet(len(list_orders), 3)
        self.widget.setHorizontalHeaderLabels(headers)

        i = 0
        for order in list_orders:
            item_ulicy = QTableWidgetItem(order.order_description)
            item_data = QTableWidgetItem(str(order.order_date))
            item_klient = QTableWidgetItem(str(order.klient_username))
            self.widget.setItem(i, 0, item_ulicy)
            self.widget.setItem(i, 1, item_data)
            self.widget.setItem(i, 2, item_klient)

            i += 1

        self.setCentralWidget(self.widget)
        self.resize(350, 300)
        self.show()
class Sheet(QMainWindow):
    USER_NAME = ''

    def __init__(self, user_name):
        super().__init__()
        self.db = DataBaseManager()
        self.check_manager = CheckManager()
        self.warning_manager = WarningManager()
        self.email_notifications = EmailNotifications()
        self.helpers = Helpers()

        self.USER_NAME = user_name
        self.show_users()

    def show_users(self):
        headers = [
            'klient', 'ulica', 'pracownik', 'pojazd', 'date', 'sprzet',
            'sprzet_ilosc'
        ]

        list_harmonograms = self.db.get_all_actual_harmonogram_for_user(
            self.USER_NAME)
        self.widget = Table_users(len(list_harmonograms), len(headers))
        self.widget.setHorizontalHeaderLabels(headers)

        i = 0
        for harmonograms in list_harmonograms:
            klient_nazwa = QTableWidgetItem(harmonograms.klient_nazwa)
            ulica = QTableWidgetItem(harmonograms.ulica)
            pracownik = QTableWidgetItem(harmonograms.pracownik)
            pojazd = QTableWidgetItem(harmonograms.pojazd)
            date = QTableWidgetItem(str(harmonograms.date))
            sprzet = QTableWidgetItem(str(harmonograms.sprzet))
            sprzet_ilosc = QTableWidgetItem(str(harmonograms.sprzet_ilosc))

            # if (harmonograms.active == 1):
            #     active = QTableWidgetItem('Active')
            # elif (harmonograms.active == 0):
            #     active = QTableWidgetItem('Inactive')
            # else:
            #     active = QTableWidgetItem('Else')

            self.widget.setItem(i, 0, klient_nazwa)
            self.widget.setItem(i, 1, ulica)
            self.widget.setItem(i, 2, pracownik)
            self.widget.setItem(i, 3, pojazd)
            self.widget.setItem(i, 4, date)
            self.widget.setItem(i, 5, sprzet)
            self.widget.setItem(i, 6, sprzet_ilosc)

            i += 1

        self.setCentralWidget(self.widget)
        self.resize(600, 300)
        self.show()
Beispiel #6
0
class Ui_MainWindow(object):
    def __init__(self):
        super().__init__()
        self.save_to_csv = saveCSV
        self.db = DataBaseManager()
        self.check_manager = CheckManager()
        self.warning_manager = WarningManager()
        self.email_notifications = EmailNotifications()
        self.helpers = Helpers()

    def generujRaport(self):
        list_harmonograms = self.db.get_all_actual_harmonogram()
        self.save_to_csv(list_harmonograms)
        self.warning_manager.showWarningBox('Error', 'Wygenerowano')
        return None

    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(430, 348)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.centralwidget)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setMinimumSize(QtCore.QSize(0, 50))
        self.pushButton.setObjectName("pushButton")
        ############### Button Event ####################
        self.pushButton.clicked.connect(self.generujRaport)
        #################################################
        self.verticalLayout.addWidget(self.pushButton)

        self.verticalLayout_2.addLayout(self.verticalLayout)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 430, 22))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.pushButton.setText(_translate("MainWindow", "Generuj Raport"))

        ####################################

        self.MainWindow = MainWindow
Beispiel #7
0
class Sheet(QMainWindow):
    def __init__(self):
        super().__init__()
        self.db = DataBaseManager()
        self.check_manager = CheckManager()
        self.warning_manager = WarningManager()
        self.email_notifications = EmailNotifications()
        self.helpers = Helpers()
        self.show_users()

    def show_users(self):
        headers = [
            'user_name', 'password', 'account_type', 'mail', 'imie',
            'nazwisko', 'telefon', 'adres', 'active'
        ]

        list_users = self.db.get_all_users()
        self.widget = Table_users(len(list_users), len(headers))
        self.widget.setHorizontalHeaderLabels(headers)

        i = 0
        for user in list_users:
            user_name = QTableWidgetItem(user.user_name)
            password = QTableWidgetItem(user.password)
            account_type = QTableWidgetItem(user.account_type)
            mail = QTableWidgetItem(user.mail)
            imie = QTableWidgetItem(user.imie)
            nazwisko = QTableWidgetItem(user.nazwisko)
            telefon = QTableWidgetItem(str(user.telefon))
            adres = QTableWidgetItem(user.adres)

            if (user.active == 1):
                active = QTableWidgetItem('Active')
            elif (user.active == 0):
                active = QTableWidgetItem('Inactive')
            else:
                active = QTableWidgetItem('Else')

            self.widget.setItem(i, 0, user_name)
            self.widget.setItem(i, 1, password)
            self.widget.setItem(i, 2, account_type)
            self.widget.setItem(i, 3, mail)
            self.widget.setItem(i, 4, imie)
            self.widget.setItem(i, 5, nazwisko)
            self.widget.setItem(i, 6, telefon)
            self.widget.setItem(i, 7, adres)
            self.widget.setItem(i, 8, active)

            i += 1

        self.setCentralWidget(self.widget)
        self.resize(901, 300)
        self.show()
Beispiel #8
0
class Ui_MainWindow(object):

    USER_NAME = ''

    def __init__(self):
        self.db = DataBaseManager()
        self.check_manager = CheckManager()
        self.warning_manager = WarningManager()
        self.email_notifications = EmailNotifications()
        self.helpers = Helpers()

    def radioIsChecked(self):
        if self.radio_User.isChecked():
            self.account_type = 'user'
        elif self.radio_Admin.isChecked():
            self.account_type = 'admin'
        elif self.radio_Klient_2.isChecked():
            self.account_type = 'klient'
        else:
            return False

    def check_type_of_account(self, account_type):
        if account_type == 'user':
            self.radio_User.click()
        elif account_type == 'admin':
            self.radio_Admin.click()
        elif account_type == 'klient':
            self.radio_Klient_2.click()

    def clear_all_lines(self):
        self.lineEdit_imie.clear()
        self.lineEdit_nazwisko.clear()
        self.lineEdit_telefon.clear()
        self.lineEdit_email.clear()
        self.lineEdit_Adres.clear()
        self.lineEdit_kod_pocztowy.clear()
        self.lineEdit_PESEL.clear()
        self.lineEdit_haslo.clear()

    def get_info_about_user(self):
        self.clear_all_lines()
        self.USER_NAME = self.lineEdit_login.text()
        self.user_data_obj = self.db.getUserData(self.USER_NAME)
        if self.user_data_obj is None:
            self.warning_manager.showWarningBox('error', 'incorrect user_name')
            return None

        self.lineEdit_imie.insert(self.user_data_obj.imie)
        self.lineEdit_nazwisko.insert(self.user_data_obj.nazwisko)
        self.lineEdit_telefon.insert(str(self.user_data_obj.telefon))
        self.lineEdit_email.insert(self.user_data_obj.mail)
        self.lineEdit_Adres.insert(self.user_data_obj.adres)
        self.lineEdit_kod_pocztowy.insert(self.user_data_obj.kod_pocztowy)
        self.lineEdit_PESEL.insert(str(self.user_data_obj.PESEL))
        self.lineEdit_haslo.insert(self.user_data_obj.password)

        account_type = self.user_data_obj.account_type
        self.check_type_of_account(account_type)

    def editUser(self):
        password = self.lineEdit_haslo.text()
        self.account_type = ''
        mail = self.lineEdit_email.text()
        imie = self.lineEdit_imie.text()
        nazwisko = self.lineEdit_nazwisko.text()
        telefon = self.lineEdit_telefon.text()
        adres = self.lineEdit_Adres.text()
        kod_pocztowy = self.lineEdit_kod_pocztowy.text()
        pesel = self.lineEdit_PESEL.text()

        self.user_data_obj = self.db.getUserData(self.USER_NAME)
        if self.user_data_obj is None:
            self.warning_manager.showWarningBox('error', 'incorrect user_name')
            return None

        if not self.helpers.checkCorrectionMail(mail):
            self.warning_manager.showWarningBox('error', 'incorrect mail!!!')
            return None

        correction_logindata = self.check_manager.checkCorrectionLoginData(
            self.USER_NAME, password)
        if not correction_logindata:
            self.warning_manager.showWarningBox('error',
                                                'incorrect login data')
            return None

        if self.radioIsChecked():
            self.warning_manager.showWarningBox(
                'error', 'please check an account type')
            return None

        data = {}
        data['username'] = self.USER_NAME
        data['password'] = password
        data['account_type'] = self.account_type
        data['mail'] = mail
        data['imie'] = imie
        data['nazwisko'] = nazwisko
        data['telefon'] = telefon
        data['adres'] = adres
        data['kod_pocztowy'] = kod_pocztowy
        data['pesel'] = pesel

        check_exception = self.db.editUser(data)
        if check_exception:
            self.warning_manager.showWarningBox('Error', str(check_exception))
            return None

        # check_exception = self.email_notifications.sendUserRegistered(mail,self.USER_NAME,password)
        # if check_exception:
        #     self.warning_manager.showWarningBox('Error', str(check_exception))
        #     return None

        self.MainWindow.close()

    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.setEnabled(True)
        MainWindow.resize(429, 516)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored,
                                           QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            MainWindow.sizePolicy().hasHeightForWidth())
        MainWindow.setSizePolicy(sizePolicy)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.centralwidget)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setObjectName("label_2")
        self.verticalLayout.addWidget(self.label_2)
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.label_9 = QtWidgets.QLabel(self.centralwidget)
        self.label_9.setObjectName("label_9")
        self.horizontalLayout_3.addWidget(self.label_9)
        spacerItem = QtWidgets.QSpacerItem(40, 20,
                                           QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem)
        self.lineEdit_login = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_login.setMinimumSize(QtCore.QSize(280, 0))
        self.lineEdit_login.setObjectName("lineEdit_login")
        self.horizontalLayout_3.addWidget(self.lineEdit_login)
        self.verticalLayout.addLayout(self.horizontalLayout_3)
        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setObjectName("pushButton")
        self.verticalLayout.addWidget(self.pushButton)
        ############### Button Event ####################
        self.pushButton.clicked.connect(self.get_info_about_user)
        #################################################
        self.line = QtWidgets.QFrame(self.centralwidget)
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line.setObjectName("line")
        self.verticalLayout.addWidget(self.line)
        self.horizontalLayout_10 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_10.setObjectName("horizontalLayout_10")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setObjectName("label")
        self.horizontalLayout_10.addWidget(self.label)
        spacerItem1 = QtWidgets.QSpacerItem(20, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_10.addItem(spacerItem1)
        self.lineEdit_imie = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_imie.setMinimumSize(QtCore.QSize(280, 0))
        self.lineEdit_imie.setMaximumSize(QtCore.QSize(900, 16777215))
        self.lineEdit_imie.setObjectName("lineEdit_imie")
        self.horizontalLayout_10.addWidget(self.lineEdit_imie)
        self.verticalLayout.addLayout(self.horizontalLayout_10)
        self.horizontalLayout_9 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_9.setObjectName("horizontalLayout_9")
        self.label_3 = QtWidgets.QLabel(self.centralwidget)
        self.label_3.setObjectName("label_3")
        self.horizontalLayout_9.addWidget(self.label_3)
        spacerItem2 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_9.addItem(spacerItem2)
        self.lineEdit_nazwisko = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_nazwisko.setMinimumSize(QtCore.QSize(280, 0))
        self.lineEdit_nazwisko.setObjectName("lineEdit_nazwisko")
        self.horizontalLayout_9.addWidget(self.lineEdit_nazwisko)
        self.verticalLayout.addLayout(self.horizontalLayout_9)
        self.horizontalLayout_8 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_8.setObjectName("horizontalLayout_8")
        # self.label_4 = QtWidgets.QLabel(self.centralwidget)
        # self.label_4.setObjectName("label_4")
        # self.horizontalLayout_8.addWidget(self.label_4)
        # spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        # self.horizontalLayout_8.addItem(spacerItem3)
        # self.lineEdit_id = QtWidgets.QLineEdit(self.centralwidget)
        # self.lineEdit_id.setMinimumSize(QtCore.QSize(280, 0))
        # self.lineEdit_id.setObjectName("lineEdit_id")
        # self.horizontalLayout_8.addWidget(self.lineEdit_id)
        self.verticalLayout.addLayout(self.horizontalLayout_8)
        self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_7.setObjectName("horizontalLayout_7")
        self.label_5 = QtWidgets.QLabel(self.centralwidget)
        self.label_5.setObjectName("label_5")
        self.horizontalLayout_7.addWidget(self.label_5)
        spacerItem4 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_7.addItem(spacerItem4)
        self.lineEdit_telefon = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_telefon.setMinimumSize(QtCore.QSize(280, 0))
        self.lineEdit_telefon.setObjectName("lineEdit_telefon")
        self.horizontalLayout_7.addWidget(self.lineEdit_telefon)
        self.verticalLayout.addLayout(self.horizontalLayout_7)
        self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_6.setObjectName("horizontalLayout_6")
        self.label_6 = QtWidgets.QLabel(self.centralwidget)
        self.label_6.setObjectName("label_6")
        self.horizontalLayout_6.addWidget(self.label_6)
        spacerItem5 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_6.addItem(spacerItem5)
        self.lineEdit_email = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_email.setMinimumSize(QtCore.QSize(280, 0))
        self.lineEdit_email.setObjectName("lineEdit_email")
        self.horizontalLayout_6.addWidget(self.lineEdit_email)
        self.verticalLayout.addLayout(self.horizontalLayout_6)
        self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_5.setObjectName("horizontalLayout_5")
        self.label_7 = QtWidgets.QLabel(self.centralwidget)
        self.label_7.setObjectName("label_7")
        self.horizontalLayout_5.addWidget(self.label_7)
        spacerItem6 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_5.addItem(spacerItem6)
        self.lineEdit_Adres = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_Adres.setMinimumSize(QtCore.QSize(280, 0))
        self.lineEdit_Adres.setObjectName("lineEdit_Adres")
        self.horizontalLayout_5.addWidget(self.lineEdit_Adres)
        self.verticalLayout.addLayout(self.horizontalLayout_5)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.label_11 = QtWidgets.QLabel(self.centralwidget)
        self.label_11.setObjectName("label_11")
        self.horizontalLayout_2.addWidget(self.label_11)
        spacerItem7 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem7)
        self.lineEdit_kod_pocztowy = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_kod_pocztowy.setMinimumSize(QtCore.QSize(280, 0))
        self.lineEdit_kod_pocztowy.setObjectName("lineEdit_kod_pocztowy")
        self.horizontalLayout_2.addWidget(self.lineEdit_kod_pocztowy)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.label_8 = QtWidgets.QLabel(self.centralwidget)
        self.label_8.setObjectName("label_8")
        self.horizontalLayout_4.addWidget(self.label_8)
        spacerItem8 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_4.addItem(spacerItem8)
        self.lineEdit_PESEL = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_PESEL.setMinimumSize(QtCore.QSize(280, 0))
        self.lineEdit_PESEL.setObjectName("lineEdit_PESEL")
        self.horizontalLayout_4.addWidget(self.lineEdit_PESEL)
        self.verticalLayout.addLayout(self.horizontalLayout_4)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.label_10 = QtWidgets.QLabel(self.centralwidget)
        self.label_10.setObjectName("label_10")
        self.horizontalLayout.addWidget(self.label_10)
        spacerItem9 = QtWidgets.QSpacerItem(40, 20,
                                            QtWidgets.QSizePolicy.Expanding,
                                            QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem9)
        self.lineEdit_haslo = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_haslo.setMinimumSize(QtCore.QSize(280, 0))
        self.lineEdit_haslo.setObjectName("lineEdit_haslo")
        self.horizontalLayout.addWidget(self.lineEdit_haslo)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.radio_User = QtWidgets.QRadioButton(self.centralwidget)
        self.radio_User.setObjectName("radio_User")
        self.verticalLayout.addWidget(self.radio_User)
        self.radio_Admin = QtWidgets.QRadioButton(self.centralwidget)
        self.radio_Admin.setObjectName("radio_Admin")
        self.verticalLayout.addWidget(self.radio_Admin)
        self.radio_Klient_2 = QtWidgets.QRadioButton(self.centralwidget)
        self.radio_Klient_2.setObjectName("radio_Klient_2")
        self.verticalLayout.addWidget(self.radio_Klient_2)
        self.horizontalLayout_11 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_11.setObjectName("horizontalLayout_11")
        spacerItem10 = QtWidgets.QSpacerItem(40, 20,
                                             QtWidgets.QSizePolicy.Expanding,
                                             QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_11.addItem(spacerItem10)
        self.btn_edit = QtWidgets.QPushButton(self.centralwidget)
        self.btn_edit.setObjectName("btn_edit")
        ############### Button Event ####################
        self.btn_edit.clicked.connect(self.editUser)
        #################################################
        self.horizontalLayout_11.addWidget(self.btn_edit)
        spacerItem11 = QtWidgets.QSpacerItem(40, 20,
                                             QtWidgets.QSizePolicy.Expanding,
                                             QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout_11.addItem(spacerItem11)
        self.verticalLayout.addLayout(self.horizontalLayout_11)
        self.verticalLayout_2.addLayout(self.verticalLayout)
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.label_2.setText(_translate("MainWindow", "Edycja konta"))
        self.label_9.setText(_translate("MainWindow", "Login: "******"MainWindow",
                                           "get info about user"))
        self.label.setText(_translate("MainWindow", "Imie:"))
        self.label_3.setText(_translate("MainWindow", "Nazwisko: "))
        # self.label_4.setText(_translate("MainWindow", "ID: "))
        self.label_5.setText(_translate("MainWindow", "Telefon: "))
        self.label_6.setText(_translate("MainWindow", "Adres email: "))
        self.label_7.setText(_translate("MainWindow", "Adres: "))
        self.label_11.setText(_translate("MainWindow", "Kod pocztowy:"))
        self.label_8.setText(_translate("MainWindow", "PESEL: "))
        self.label_10.setText(_translate("MainWindow", "Haslo: "))
        self.radio_User.setText(_translate("MainWindow", "User"))
        self.radio_Admin.setText(_translate("MainWindow", "Admin"))
        self.radio_Klient_2.setText(_translate("MainWindow", "Klient"))
        self.btn_edit.setText(_translate("MainWindow", "Edytuj"))

        ####################################

        self.MainWindow = MainWindow
class Ui_MainWindow(object):
    def __init__(self):
        self.db = DataBaseManager()
        self.check_manager = CheckManager()
        self.warning_manager = WarningManager()
        self.email_notifications = EmailNotifications()
        self.helpers = Helpers()

    def delete_user(self):
        USER_NAME = self.lineEdit.text()
        self.user_data_obj = self.db.getUserData(USER_NAME)
        if self.user_data_obj is None:
            self.warning_manager.showWarningBox('error', 'incorrect user_name')
            return None

        check_exc = self.db.insert_not_active_status(USER_NAME)
        if check_exc is not None:
            self.warning_manager.showWarningBox('error', 'incorrect user_name')
            return None

        self.MainWindow.close()
        return None

    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(361, 294)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.centralwidget)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setObjectName("label")
        self.horizontalLayout.addWidget(self.label)
        self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit.setText("")
        self.lineEdit.setObjectName("lineEdit")
        self.horizontalLayout.addWidget(self.lineEdit)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_2.setObjectName("pushButton_2")
        ############### Button Event ####################
        self.pushButton_2.clicked.connect(self.delete_user)
        #################################################
        self.verticalLayout.addWidget(self.pushButton_2)
        self.verticalLayout_2.addLayout(self.verticalLayout)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 361, 22))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.label.setText(_translate("MainWindow", "user_name:"))
        self.pushButton_2.setText(_translate("MainWindow", "Usun uzytkownika"))

        ####################################

        self.MainWindow = MainWindow
Beispiel #10
0
class Ui_MainWindow(object):
    def __init__(self, user_name):
        self.USER_NAME = user_name
        self.db = DataBaseManager()
        self.check_manager = CheckManager()
        self.warning_manager = WarningManager()
        self.email_notifications = EmailNotifications()
        self.helpers = Helpers()

    def add_zgloszenie(self):
        ulicy = self.lineEdit.text()

        if len(ulicy) <= 0:
            self.warning_manager.showWarningBox('error', 'wprowadz ulicy')
            return None

        checker = self.db.add_order(klient_username=self.USER_NAME,
                                    ulicy=ulicy)
        if checker:
            self.warning_manager.showWarningBox('error', checker)
            return None

        self.warning_manager.showWarningBox('error', 'Dodano')

    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(401, 228)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.centralwidget)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setMinimumSize(QtCore.QSize(100, 0))
        self.label_2.setObjectName("label_2")
        self.horizontalLayout.addWidget(self.label_2)
        self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit.setMaximumSize(QtCore.QSize(12000, 16777215))
        self.lineEdit.setObjectName("lineEdit")
        self.horizontalLayout.addWidget(self.lineEdit)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setObjectName("pushButton")
        ############### Button Event ####################
        self.pushButton.clicked.connect(self.add_zgloszenie)
        # ###############################################
        self.verticalLayout.addWidget(self.pushButton)
        self.verticalLayout_2.addLayout(self.verticalLayout)
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "Dodaj zgloszenie"))
        self.label_2.setText(_translate("MainWindow", "Dodaj ulicy: "))
        self.pushButton.setText(_translate("MainWindow", "Dodaj"))

        ####################################
        self.MainWindow = MainWindow
Beispiel #11
0
 def __init__(self):
     self.check_manager = CheckManager()
     self.db = DataBaseManager()
     self.warning_manager = WarningManager()
Beispiel #12
0
class Ui_MainWindow(object):

    def __init__(self):
        super().__init__()
        self.db = DataBaseManager()
        self.check_manager = CheckManager()
        self.warning_manager = WarningManager()
        self.email_notifications = EmailNotifications()
        self.helpers = Helpers()

    def get_list_klientow(self):
        list_db_klient = self.db.get_all_klientow()
        for user in list_db_klient:
            self.comboBox_klient.addItem(user.user_name)

    def get_list_pracownik(self):
        list_db_users = self.db.get_all_pracownikow()
        for user in list_db_users:
            self.comboBox_pracownik.addItem(user.user_name)

    def get_list_pojzdow(self):
        list_db_pojazd = self.db.get_all_active_pojazd()
        for pojazd in list_db_pojazd:
            self.comboBox_pojazd.addItem(str(pojazd.nazwa)+' : '+str(pojazd.numer))

    def get_list_sprzet(self):
        list_db_sprzet = self.db.get_all_sprzet()
        for sprzet in list_db_sprzet:
            self.comboBox_sprzet.addItem(str(sprzet.sprzet)+' : '+str(sprzet.ilosc))

    def set_date(self, date):
        self.date = date.toString()

    def insert_to_harmonogram(self):
        klient_nazwa = self.comboBox_klient.currentText()
        pracownik = self.comboBox_pracownik.currentText()
        pojazd = self.comboBox_pojazd.currentText().split(':')[1].strip()
        ulica = self.lineEdit_ulica.text()
        sprzet = self.comboBox_sprzet.currentText().split(':')[0].strip()
        try:
            sprzet_ilosc = int(self.lineEdit.text())
        except:
            sprzet_ilosc = 0
        try:
            date = dateparser.parse(self.date)
        except:
            self.warning_manager.showWarningBox('Error', 'Wybierz date')
            return None

        sprzet_db_ilosc = int(self.comboBox_sprzet.currentText().split(':')[1].strip())
        if sprzet_db_ilosc < sprzet_ilosc:
            self.warning_manager.showWarningBox('Error', 'Wybrales wiecej sprzetu niz istnieje')
            return None

        data = {}

        data['klient_nazwa'] = klient_nazwa
        data['pracownik'] = pracownik
        data['pojazd'] = pojazd
        data['ulica'] = ulica
        data['date'] = date
        data['sprzet'] = sprzet
        data['sprzet_ilosc'] = sprzet_ilosc

        check_exception = self.db.check_person_in_harmonogram(pracownik,date)
        if check_exception is not None:
            self.warning_manager.showWarningBox('Error', 'Juz istnieje')
            return None

        check_exception = self.db.check_ilosc_pracownikow_na_pojazdzie(pojazd, date)
        print(len(check_exception))
        if len(check_exception) >= 3:
            self.warning_manager.showWarningBox('Error', 'Limit pracownikow dla jednego pojazdu')
            return None

        check_exception = self.db.add_item_to_harmongram(data)
        if check_exception:
            self.warning_manager.showWarningBox('Error', str(check_exception))
            # return None

        self.warning_manager.showWarningBox('', 'Dodano')

    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(640, 480)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
        self.verticalLayout.setObjectName("verticalLayout")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout()
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_5.setObjectName("horizontalLayout_5")
        self.label_3 = QtWidgets.QLabel(self.centralwidget)
        self.label_3.setMaximumSize(QtCore.QSize(100, 50))
        self.label_3.setObjectName("label_3")
        self.horizontalLayout_5.addWidget(self.label_3)
        self.comboBox_klient = QtWidgets.QComboBox(self.centralwidget)
        self.comboBox_klient.setObjectName("comboBox_2")
        self.horizontalLayout_5.addWidget(self.comboBox_klient)
        self.verticalLayout_2.addLayout(self.horizontalLayout_5)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setMaximumSize(QtCore.QSize(100, 50))
        self.label_2.setObjectName("label_2")
        self.horizontalLayout_2.addWidget(self.label_2)
        self.comboBox_pracownik = QtWidgets.QComboBox(self.centralwidget)
        self.comboBox_pracownik.setObjectName("comboBox")
        self.horizontalLayout_2.addWidget(self.comboBox_pracownik)
        self.verticalLayout_2.addLayout(self.horizontalLayout_2)

        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setMaximumSize(QtCore.QSize(100, 50))
        self.label.setObjectName("label")
        self.horizontalLayout.addWidget(self.label)
        self.comboBox_pojazd = QtWidgets.QComboBox(self.centralwidget)
        self.comboBox_pojazd.setObjectName("comboBox_3")
        self.horizontalLayout.addWidget(self.comboBox_pojazd)
        self.verticalLayout_2.addLayout(self.horizontalLayout)

        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.label_6 = QtWidgets.QLabel(self.centralwidget)
        self.label_6.setMaximumSize(QtCore.QSize(60, 50))
        self.label_6.setObjectName("label_6")
        self.horizontalLayout_4.addWidget(self.label_6)
        self.comboBox_sprzet = QtWidgets.QComboBox(self.centralwidget)
        self.comboBox_sprzet.setObjectName("comboBox_sprzet")
        self.horizontalLayout_4.addWidget(self.comboBox_sprzet)
        self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit.setObjectName("lineEdit")
        self.horizontalLayout_4.addWidget(self.lineEdit)
        self.verticalLayout_2.addLayout(self.horizontalLayout_4)
        self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_6.setObjectName("horizontalLayout_6")
        self.label_5 = QtWidgets.QLabel(self.centralwidget)
        self.label_5.setObjectName("label_5")
        self.horizontalLayout_6.addWidget(self.label_5)
        self.lineEdit_ulica = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_ulica.setObjectName("lineEdit_ulica")
        self.horizontalLayout_6.addWidget(self.lineEdit_ulica)
        self.label_4 = QtWidgets.QLabel(self.centralwidget)
        self.label_4.setText("")
        self.label_4.setObjectName("label_4")
        self.horizontalLayout_6.addWidget(self.label_4)
        self.verticalLayout_2.addLayout(self.horizontalLayout_6)
        self.calendarWidget = QtWidgets.QCalendarWidget(self.centralwidget)
        self.calendarWidget.setObjectName("calendarWidget")
        self.verticalLayout_2.addWidget(self.calendarWidget)
        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setObjectName("pushButton")
        self.verticalLayout_2.addWidget(self.pushButton)
        self.verticalLayout.addLayout(self.verticalLayout_2)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 640, 22))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        ##########################################################
        self.pushButton.clicked.connect(self.insert_to_harmonogram)
        ###########################################################
        ##############
        self.calendarWidget.clicked.connect(self.set_date)
        ##############
        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.label_3.setText(_translate("MainWindow", "Dodaj klienta:"))
        self.label_2.setText(_translate("MainWindow", "Dodaj pracownika:"))
        self.label.setText(_translate("MainWindow", "Doadj pojazd:"))
        self.comboBox_pojazd.setItemText(0, _translate("MainWindow", "dsadas"))
        self.comboBox_pojazd.setItemText(1, _translate("MainWindow", "dsa"))
        self.comboBox_pojazd.setItemText(2, _translate("MainWindow", "aaaa"))
        self.comboBox_pojazd.setItemText(3, _translate("MainWindow", "dasdas"))
        self.label_6.setText(_translate("MainWindow", "Sprzet: "))
        self.label_5.setText(_translate("MainWindow", "Ulica:"))
        self.pushButton.setText(_translate("MainWindow", "PushButton"))

        self.get_list_pracownik()
        self.get_list_klientow()
        self.get_list_pojzdow()
        self.get_list_sprzet()

        ####################################
        self.MainWindow = MainWindow
class Ui_MainWindow(object):

    def __init__(self):
        self.db = DataBaseManager()
        self.check_manager = CheckManager()
        self.warning_manager = WarningManager()
        self.email_notifications = EmailNotifications()
        self.helpers = Helpers()

    def edit_ilosc(self):
        nazwa_srzetu = self.lineEdit.text()
        try:
            ilosc = int(self.lineEdit_2.text())
        except:
            self.warning_manager.showWarningBox('error', 'incorrect ilosc')
            return None

        check_exc = self.db.change_ilosc_sprzetu(nazwa_sprzetu=nazwa_srzetu, new_ilosc=ilosc)
        if check_exc is not None:
            self.warning_manager.showWarningBox('error', str(check_exc))
            return None

        self.MainWindow.close()

    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(401, 228)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.centralwidget)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setObjectName("label")
        self.horizontalLayout.addWidget(self.label)
        self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit.setObjectName("lineEdit")
        self.horizontalLayout.addWidget(self.lineEdit)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setObjectName("label_2")
        self.horizontalLayout_2.addWidget(self.label_2)
        self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.horizontalLayout_2.addWidget(self.lineEdit_2)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setObjectName("pushButton")
        self.verticalLayout.addWidget(self.pushButton)
        self.verticalLayout_2.addLayout(self.verticalLayout)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 640, 22))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

        ############### Button Event ####################
        self.pushButton.clicked.connect(self.edit_ilosc)
        ################################################

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.label.setText(_translate("MainWindow", "Nazwa sprzetu:"))
        self.label_2.setText(_translate("MainWindow", "Nowa ilość:"))
        self.pushButton.setText(_translate("MainWindow", "Zmień"))

        ####################################

        self.MainWindow = MainWindow
Beispiel #14
0
 def __init__(self):
     self.db = DataBaseManager()
class Ui_MainWindow(object):
    def __init__(self):
        super().__init__()
        self.db = DataBaseManager()
        self.check_manager = CheckManager()
        self.warning_manager = WarningManager()
        self.email_notifications = EmailNotifications()
        self.helpers = Helpers()

    def get_list_wyjazdow(self):
        list_harmonogram = self.db.get_all_actual_harmonogram()
        for wyjazd in list_harmonogram:
            self.comboBox_harmonograms.addItem(
                str(wyjazd.id) + ' : ' + wyjazd.klient_nazwa + ' : ' +
                wyjazd.pojazd + ' : ' + wyjazd.ulica + ' : ' +
                wyjazd.pracownik + ' : ' + str(wyjazd.date))

    def delete_pojazd(self):
        harmonogram_id = self.comboBox_harmonograms.currentText().split(
            ':')[0].strip()

        check_exception = self.db.delete_wyjazd(harmonogram_id)
        if check_exception:
            self.warning_manager.showWarningBox('Error', str(check_exception))
            return None

        self.warning_manager.showWarningBox('', 'Usunieto')

    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(448, 269)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setMaximumSize(QtCore.QSize(80, 50))
        self.label.setObjectName("label")
        self.horizontalLayout_4.addWidget(self.label)
        self.comboBox_harmonograms = QtWidgets.QComboBox(self.centralwidget)
        self.comboBox_harmonograms.setObjectName("comboBox_pojazd")
        self.horizontalLayout_4.addWidget(self.comboBox_harmonograms)
        self.verticalLayout.addLayout(self.horizontalLayout_4)
        self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_5.setObjectName("horizontalLayout_5")
        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setObjectName("pushButton")

        ############### Button Event ####################
        self.pushButton.clicked.connect(self.delete_pojazd)
        #################################################

        self.verticalLayout.addWidget(self.pushButton)
        self.horizontalLayout.addLayout(self.verticalLayout)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 448, 22))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "Pojazd Status"))
        self.label.setText(_translate("MainWindow", "Wyjazdy:"))
        self.pushButton.setText(_translate("MainWindow", "Usun"))

        self.get_list_wyjazdow()
class Ui_MainWindow(object):

    def __init__(self):
        self.db = DataBaseManager()
        self.check_manager = CheckManager()
        self.warning_manager = WarningManager()
        self.email_notifications = EmailNotifications()
        self.helpers = Helpers()

    def addSprzet(self):
        nazwa_sprzetu = self.lineEdit.text()
        ilosc = self.lineEdit_2.text()

        if len(nazwa_sprzetu) < 3:
            self.warning_manager.showWarningBox('error', 'nie prawydlowa nazwa')
            return None

        try:
            ilosc = int(ilosc)
            if ilosc <= 0:
                self.warning_manager.showWarningBox('error', 'nie prawydlowa ilosc')
                return None
        except:
            self.warning_manager.showWarningBox('error', 'nie prawydlowa ilosc')
            return None

        does_sprzet_exist = self.db.get_sprzet_info(nazwa_sprzetu=nazwa_sprzetu)
        if does_sprzet_exist is not None:
            current_amount = int(does_sprzet_exist.ilosc) + int(ilosc)
            check_exception = self.db.change_ilosc_sprzetu(nazwa_sprzetu, current_amount)
            if check_exception:
                self.warning_manager.showWarningBox('Error', str(check_exception))
                return None

        else:
            check_exception = self.db.addSprzet(nazwa_sprzetu, ilosc)
            if check_exception:
                self.warning_manager.showWarningBox('Error', str(check_exception))
                return None


        self.MainWindow.close()


    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(401, 228)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.centralwidget)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setMaximumSize(QtCore.QSize(120, 20))
        self.label.setObjectName("label")
        self.verticalLayout_2.addWidget(self.label)
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setMinimumSize(QtCore.QSize(100, 0))
        self.label_2.setObjectName("label_2")
        self.horizontalLayout.addWidget(self.label_2)
        self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit.setMaximumSize(QtCore.QSize(12000, 16777215))
        self.lineEdit.setObjectName("lineEdit")
        self.horizontalLayout.addWidget(self.lineEdit)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.label_3 = QtWidgets.QLabel(self.centralwidget)
        self.label_3.setMinimumSize(QtCore.QSize(100, 0))
        self.label_3.setMaximumSize(QtCore.QSize(220, 16777215))
        self.label_3.setObjectName("label_3")
        self.horizontalLayout_2.addWidget(self.label_3)
        self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget)
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.horizontalLayout_2.addWidget(self.lineEdit_2)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setObjectName("pushButton")
        ############### Button Event ####################
        self.pushButton.clicked.connect(self.addSprzet)
        # ###############################################
        self.verticalLayout.addWidget(self.pushButton)
        self.verticalLayout_2.addLayout(self.verticalLayout)
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "Dodanie Sprzetu"))
        self.label.setText(_translate("MainWindow", "Dodanie sprzetu"))
        self.label_2.setText(_translate("MainWindow", "Nazwa sprzetu: "))
        self.label_3.setText(_translate("MainWindow", "Ilość: "))
        self.pushButton.setText(_translate("MainWindow", "Dodaj"))

        ####################################
        self.MainWindow = MainWindow
Beispiel #17
0
class Ui_MainWindow(object):

    def __init__(self):
        self.check_manager = CheckManager()
        self.db = DataBaseManager()
        self.warning_manager = WarningManager()

    def loginCheck(self):
        username = self.line_user_name.text()
        password = self.line_password.text()

        correction_logindata = self.check_manager.checkCorrectionLoginData(username,password)
        if correction_logindata:
            pass
        else:
            self.warning_manager.showWarningBox('testtitle', 'incorrect login data')
            return None

        userData = self.db.getUserData(username=username)
        if userData:
            try:
                userData.password
            except:
                self.warning_manager.showWarningBox('testtitle', 'incorrect password')
                return None
        else:
            self.warning_manager.showWarningBox('testtitle', 'incorrect incorrect password')
            return None

        status = self.check_manager.checkLoginData(password=password,userData=userData)
        if status is not True:
            self.warning_manager.showWarningBox('testtitle', 'user is not exist')
            return None

        if userData.account_type == admin:
            self.adminMainWindow = QtWidgets.QMainWindow()
            self.ui = admin_main_menu.Ui_MainWindow()
            self.ui.setupUi(self.adminMainWindow)
            self.adminMainWindow.show()
            self.MainWindow.close()

        elif userData.account_type == user:
            self.userMainWindow = QtWidgets.QMainWindow()
            self.ui = usermainmenu.Ui_MainWindow(username)
            self.ui.setupUi(self.userMainWindow)
            self.userMainWindow.show()
            self.MainWindow.close()

        elif userData.account_type == klient:
            self.klientMainWindow = QtWidgets.QMainWindow()
            self.ui = klientmainmenu.Ui_MainWindow(username)
            self.ui.setupUi(self.klientMainWindow)
            self.klientMainWindow.show()
            self.MainWindow.close()


    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(379, 295)
        self.centralWidget = QtWidgets.QWidget(MainWindow)
        self.centralWidget.setObjectName("centralWidget")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.centralWidget)
        self.verticalLayout_2.setContentsMargins(11, 11, 11, 11)
        self.verticalLayout_2.setSpacing(6)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setSpacing(6)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setSpacing(6)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.label = QtWidgets.QLabel(self.centralWidget)
        self.label.setMinimumSize(QtCore.QSize(60, 20))
        self.label.setMaximumSize(QtCore.QSize(60, 20))
        self.label.setObjectName("label")
        self.horizontalLayout_2.addWidget(self.label)
        self.line_user_name = QtWidgets.QLineEdit(self.centralWidget)
        self.line_user_name.setObjectName("line_user_name")
        self.horizontalLayout_2.addWidget(self.line_user_name)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setSpacing(6)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.label_2 = QtWidgets.QLabel(self.centralWidget)
        self.label_2.setMinimumSize(QtCore.QSize(60, 0))
        self.label_2.setMaximumSize(QtCore.QSize(50, 20))
        self.label_2.setObjectName("label_2")
        self.horizontalLayout.addWidget(self.label_2)
        self.line_password = QtWidgets.QLineEdit(self.centralWidget)
        self.line_password.setEchoMode(QtWidgets.QLineEdit.Password)
        self.line_password.setObjectName("line_password")
        self.horizontalLayout.addWidget(self.line_password)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.verticalLayout_2.addLayout(self.verticalLayout)
        self.btn_login = QtWidgets.QPushButton(self.centralWidget)
        self.btn_login.setObjectName("btn_login")
        ############### Button Event ####################
        self.btn_login.clicked.connect(self.loginCheck)
        # ###############################################
        self.verticalLayout_2.addWidget(self.btn_login)
        MainWindow.setCentralWidget(self.centralWidget)
        self.mainToolBar = QtWidgets.QToolBar(MainWindow)
        self.mainToolBar.setObjectName("mainToolBar")
        MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.mainToolBar)
        self.statusBar = QtWidgets.QStatusBar(MainWindow)
        self.statusBar.setObjectName("statusBar")
        MainWindow.setStatusBar(self.statusBar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)


    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "Login"))
        self.label.setText(_translate("MainWindow", "Login"))
        self.label_2.setText(_translate("MainWindow", "Password"))
        self.btn_login.setText(_translate("MainWindow", "Zaloguj"))

        ####################################
        self.MainWindow = MainWindow