Esempio n. 1
0
        def unlook():
            if dialog.ui.check_for_unlook():
                self.btn_enable_password.setDisabled(False)
                self.btn_change_password.setDisabled(True)
                self.btn_disaable_password.setDisabled(True)

                Func_DataBase.delate_password()
                dialog.close()

                set_for_change_password()
Esempio n. 2
0
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(317, 131)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("Icons/loock.png"), QtGui.QIcon.Normal,
                       QtGui.QIcon.Off)
        Dialog.setWindowIcon(icon)
        Dialog.setMinimumSize(QtCore.QSize(317, 131))
        Dialog.setMaximumSize(QtCore.QSize(317, 131))
        self.btn_set = QtWidgets.QPushButton(Dialog)
        self.btn_set.setGeometry(QtCore.QRect(50, 90, 75, 23))
        self.btn_set.setAutoDefault(False)
        self.btn_set.setDefault(True)
        self.btn_set.setObjectName("btn_set")
        self.btn_cancel = QtWidgets.QPushButton(Dialog)
        self.btn_cancel.setGeometry(QtCore.QRect(190, 90, 75, 23))
        self.btn_cancel.setAutoDefault(False)
        self.btn_cancel.setObjectName("btn_cancel")
        self.layoutWidget = QtWidgets.QWidget(Dialog)
        self.layoutWidget.setGeometry(QtCore.QRect(20, 20, 281, 48))
        self.layoutWidget.setObjectName("layoutWidget")
        self.gridLayout = QtWidgets.QGridLayout(self.layoutWidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setObjectName("gridLayout")
        self.txt_enter_password = QtWidgets.QLabel(self.layoutWidget)
        font = QtGui.QFont()
        font.setPointSize(9)
        self.txt_enter_password.setFont(font)
        self.txt_enter_password.setObjectName("txt_enter_password")
        self.gridLayout.addWidget(self.txt_enter_password, 0, 0, 1, 1)
        self.input_enter_password = QtWidgets.QLineEdit(self.layoutWidget)
        self.input_enter_password.setMaxLength(16)
        self.input_enter_password.setEchoMode(QtWidgets.QLineEdit.Password)
        self.input_enter_password.setObjectName("input_enter_password")
        self.gridLayout.addWidget(self.input_enter_password, 0, 1, 1, 1)
        self.txt_enter_again_password = QtWidgets.QLabel(self.layoutWidget)
        font = QtGui.QFont()
        font.setPointSize(9)
        self.txt_enter_again_password.setFont(font)
        self.txt_enter_again_password.setObjectName("txt_enter_again_password")
        self.gridLayout.addWidget(self.txt_enter_again_password, 1, 0, 1, 1)
        self.input_enter_again_password = QtWidgets.QLineEdit(
            self.layoutWidget)
        self.input_enter_again_password.setMaxLength(16)
        self.input_enter_again_password.setEchoMode(
            QtWidgets.QLineEdit.Password)
        self.input_enter_again_password.setObjectName(
            "input_enter_again_password")
        self.gridLayout.addWidget(self.input_enter_again_password, 1, 1, 1, 1)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        # ================== Coding ==================
        Func_DataBase.set_setting(Dialog)
Esempio n. 3
0
    def update_table_inventory(self):
        self.treeWidget.clear()

        Payments = 0
        Recives = 0
        try:
            for i in Func_DataBase.Search_in_DataBase():
                if self.rdb_all.isChecked():
                    item = QtWidgets.QTreeWidgetItem(
                        self.treeWidget, [str(i[1]), i[2], i[3], i[4], i[5]])
                    self.treeWidget.addTopLevelItem(item)
                elif self.rdb_Payments.isChecked():
                    if i[2] == "Payment":
                        item = QtWidgets.QTreeWidgetItem(
                            self.treeWidget,
                            [str(i[1]), i[2], i[3], i[4], i[5]])
                        self.treeWidget.addTopLevelItem(item)
                elif self.rdb_received.isChecked():
                    if i[2] == "Received":
                        item = QtWidgets.QTreeWidgetItem(
                            self.treeWidget,
                            [str(i[1]), i[2], i[3], i[4], i[5]])
                        self.treeWidget.addTopLevelItem(item)

                if i[2] == "Payment":
                    Payments += i[1]
                elif i[2] == "Received":
                    Recives += i[1]
                else:
                    print(f"Error Not Found !!! {i[2]}")

            amount = Recives - Payments
            self.txtline_inventory.setText(self.convert_number_to_sort(amount))
        except:
            self.txtline_inventory.setText("0")
Esempio n. 4
0
    def command_btn_ok(self):
        Kes_for_information = ["amount", "Type Amount",
                               "From/To", "Date", "Description"]
        Values_for_information = []
        # ------------- Check True Enter Amount -----------
        if self.check_amount():
            Values_for_information.append(self.input_amount.text())
        else:
            self.win_error_amount = QtWidgets.QMessageBox()
            self.win_error_amount.setText(Words.translate_words(Words.M_Enter_amount))
            self.win_error_amount.show()
            return None
        # ------------- Check Enter recived or paymount ---------------
        if self.check_rdbs():
            Values_for_information.append(self.check_rdbs())
        else:
            self.win_error_amount = QtWidgets.QMessageBox()
            self.win_error_amount.setText(Words.translate_words(Words.M_Enter_type))
            self.win_error_amount.show()
            return None
        # ------------------- check Enter From Or To -----------------
        if self.check_Enter_from_or_to():
            Values_for_information.append(self.check_Enter_from_or_to())
        else:
            self.win_error_amount = QtWidgets.QMessageBox()
            self.win_error_amount.setText(Words.translate_words(Words.M_Enter_from_to))
            self.win_error_amount.show()
            return None
        # -------------- Get Date -----------------
        Values_for_information.append(self.input_date.text())
        # ---------- Get Descripton ---------------
        if self.input_description.toPlainText() == "":
            Values_for_information.append("Null")
        else:
            Values_for_information.append(self.input_description.toPlainText())

        # This code conver two lists to one dict
        information_for_add = dict(
            zip(Kes_for_information, Values_for_information))

        # ------------- Work With Database -------------------
        Func_DataBase.Create_DataBase()
        Func_DataBase.Add_in_DataBase(0, information_for_add['amount'], information_for_add['Type Amount'],
                                      information_for_add['From/To'], information_for_add['Date'], information_for_add['Description'])
        Func_DataBase.Search_in_DataBase()
        # ----------------------------------------------------
        return True
Esempio n. 5
0
            def unlook():
                if dialog.ui.check_for_unlook():
                    try:
                        Func_DataBase.Delate_in_DataBase()
                    except:
                        pass

                    dialog.close()
Esempio n. 6
0
 def remove_item(self):
     for currentItem in self.treeWidget.selectedItems():
         Func_DataBase.Delate_item_in_DataBase(currentItem.text(0),
                                               currentItem.text(1),
                                               currentItem.text(2),
                                               currentItem.text(3),
                                               currentItem.text(4))
     self.update_table_inventory()
Esempio n. 7
0
    def win_setting(self):
        def command_btn_save():
            self.win_aleart = QtWidgets.QMessageBox()
            self.win_aleart.setWindowTitle("Restart")
            self.win_aleart.setText(
                Words.translate_words(Words.restart_Programm))
            self.win_aleart.show()

            dialog.close()
            MainWindow.close()

        dialog = QtWidgets.QDialog()
        dialog.ui = page_setting()
        dialog.ui.setupUi(dialog)
        dialog.ui.btn_close.clicked.connect(dialog.close)
        dialog.ui.btn_save.clicked.connect(command_btn_save)

        dialog.exec_()

        self.update_table_inventory()
        Func_DataBase.set_setting(MainWindow)
Esempio n. 8
0
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(219, 127)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("Icons/loock.png"), QtGui.QIcon.Normal,
                       QtGui.QIcon.Off)
        Dialog.setWindowIcon(icon)
        self.btn_unloock = QtWidgets.QPushButton(Dialog)
        self.btn_unloock.setGeometry(QtCore.QRect(20, 80, 75, 23))
        self.btn_unloock.setAutoDefault(False)
        self.btn_unloock.setDefault(True)
        self.btn_unloock.setObjectName("btn_unloock")
        self.btn_exit = QtWidgets.QPushButton(Dialog)
        self.btn_exit.setGeometry(QtCore.QRect(120, 80, 75, 23))
        self.btn_exit.setAutoDefault(False)
        self.btn_exit.setObjectName("btn_exit")
        self.input_password = QtWidgets.QLineEdit(Dialog)
        self.input_password.setGeometry(QtCore.QRect(20, 20, 181, 31))
        self.input_password.setEchoMode(QtWidgets.QLineEdit.Password)
        self.input_password.setAlignment(QtCore.Qt.AlignLeading
                                         | QtCore.Qt.AlignLeft
                                         | QtCore.Qt.AlignVCenter)
        self.input_password.setObjectName("input_password")
        self.btn_forgget_password = QtWidgets.QPushButton(Dialog)
        self.btn_forgget_password.setGeometry(QtCore.QRect(20, 50, 91, 21))
        self.btn_forgget_password.setAutoDefault(False)
        self.btn_forgget_password.setFlat(True)
        self.btn_forgget_password.setObjectName("btn_forgget_password")
        self.btn_unloock.raise_()
        self.btn_exit.raise_()
        self.btn_forgget_password.raise_()
        self.input_password.raise_()

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        # ================== Coding ==================
        Func_DataBase.set_setting(Dialog)
        self.btn_forgget_password.clicked.connect(self.forget_password)
Esempio n. 9
0
    def check_passsword(self):
        self.password_entered = self.input_password.text()

        password_hashed = hashlib.sha224()
        password_hashed.update(self.password_entered.encode("utf-8"))

        try:
            self.password = Func_DataBase.get_password_in_database()
        except:
            pass

        if password_hashed.hexdigest() == self.password:
            return True
        else:
            return False
Esempio n. 10
0
    def set_password(self):
        self.password = self.input_enter_password.text()
        self.again_password = self.input_enter_again_password.text()

        if self.password != self.again_password:
            self.win_error = QtWidgets.QMessageBox()
            self.win_error.setWindowTitle("ERROR")
            self.win_error.setText("Password and again password are not like")
            self.win_error.show()
            return False
        elif self.password == "":
            self.win_error = QtWidgets.QMessageBox()
            self.win_error.setWindowTitle("ERROR")
            self.win_error.setText("You should not let the None password")
            self.win_error.show()
            return False

        password_hashed = hashlib.sha224()
        password_hashed.update(self.password.encode("utf-8"))

        Func_DataBase.Data_Base_Password(password_hashed.hexdigest())

        return True
Esempio n. 11
0
    def reset_information(self):
        if self.status_password:
            dialog = QtWidgets.QDialog()
            dialog.ui = page_unlook_password()
            dialog.ui.setupUi(dialog)

            def unlook():
                if dialog.ui.check_for_unlook():
                    try:
                        Func_DataBase.Delate_in_DataBase()
                    except:
                        pass

                    dialog.close()

            dialog.ui.btn_unloock.clicked.connect(unlook)
            dialog.ui.btn_exit.clicked.connect(dialog.close)

            dialog.exec_()
        else:
            try:
                Func_DataBase.Delate_in_DataBase()
            except:
                pass
Esempio n. 12
0
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(447, 255)
        Dialog.setMinimumSize(447, 255)
        Dialog.setMaximumSize(447, 255)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("Icons/setting.png"), QtGui.QIcon.Normal,
                       QtGui.QIcon.Off)
        Dialog.setWindowIcon(icon)
        self.tabWidget = QtWidgets.QTabWidget(Dialog)
        self.tabWidget.setGeometry(QtCore.QRect(10, 10, 431, 191))
        self.tabWidget.setObjectName("tabWidget")
        self.tab = QtWidgets.QWidget()
        self.tab.setObjectName("tab")
        self.layoutWidget = QtWidgets.QWidget(self.tab)
        self.layoutWidget.setGeometry(QtCore.QRect(10, 2, 401, 161))
        self.layoutWidget.setObjectName("layoutWidget")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.layoutWidget)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.txt_languge = QtWidgets.QLabel(self.layoutWidget)
        self.txt_languge.setObjectName("txt_languge")
        self.horizontalLayout_3.addWidget(self.txt_languge)
        self.combo_languge = QtWidgets.QComboBox(self.layoutWidget)
        self.combo_languge.setObjectName("combo_languge")
        self.combo_languge.addItem("")
        self.combo_languge.addItem("")
        self.combo_languge.addItem("")
        self.horizontalLayout_3.addWidget(self.combo_languge)
        self.verticalLayout.addLayout(self.horizontalLayout_3)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.txt_type_font = QtWidgets.QLabel(self.layoutWidget)
        self.txt_type_font.setObjectName("txt_type_font")
        self.horizontalLayout_2.addWidget(self.txt_type_font)
        self.combo_font = QtWidgets.QFontComboBox(self.layoutWidget)
        self.combo_font.setObjectName("combo_font")
        self.horizontalLayout_2.addWidget(self.combo_font)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.txt_size_font = QtWidgets.QLabel(self.layoutWidget)
        self.txt_size_font.setObjectName("txt_size_font")
        self.horizontalLayout.addWidget(self.txt_size_font)
        self.input_num = QtWidgets.QSpinBox(self.layoutWidget)
        self.input_num.setWrapping(False)
        self.input_num.setFrame(True)
        self.input_num.setMaximum(14)
        self.input_num.setMinimum(6)
        self.input_num.setProperty("value", 8)
        self.input_num.setObjectName("input_num")
        self.horizontalLayout.addWidget(self.input_num)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.line = QtWidgets.QFrame(self.layoutWidget)
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line.setObjectName("line")
        self.verticalLayout.addWidget(self.line)
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.label = QtWidgets.QLabel(self.layoutWidget)
        self.label.setObjectName("label")
        self.horizontalLayout_4.addWidget(self.label)
        self.rdb_dark = QtWidgets.QRadioButton(self.layoutWidget)
        self.rdb_dark.setObjectName("rdb_dark")
        self.horizontalLayout_4.addWidget(self.rdb_dark)
        self.rdb_light = QtWidgets.QRadioButton(self.layoutWidget)
        self.rdb_light.setChecked(True)
        self.rdb_light.setObjectName("rdb_light")
        self.horizontalLayout_4.addWidget(self.rdb_light)
        self.verticalLayout.addLayout(self.horizontalLayout_4)
        self.tabWidget.addTab(self.tab, "")
        self.tab_2 = QtWidgets.QWidget()
        self.tab_2.setObjectName("tab_2")
        self.btn_reset_information = QtWidgets.QPushButton(self.tab_2)
        self.btn_reset_information.setGeometry(QtCore.QRect(10, 110, 121, 41))
        self.btn_reset_information.setAutoDefault(False)
        self.btn_reset_information.setObjectName("btn_reset_information")
        self.groupBox = QtWidgets.QGroupBox(self.tab_2)
        self.groupBox.setGeometry(QtCore.QRect(10, 20, 381, 81))
        self.groupBox.setObjectName("groupBox")
        self.btn_change_password = QtWidgets.QPushButton(self.groupBox)
        self.btn_change_password.setGeometry(QtCore.QRect(250, 30, 111, 41))
        self.btn_change_password.setAutoDefault(False)
        self.btn_change_password.setObjectName("btn_change_password")
        self.btn_disaable_password = QtWidgets.QPushButton(self.groupBox)
        # self.btn_disaable_password.setGeometry(QtCore.QRect(10, 20, 111, 41))
        self.btn_disaable_password.setGeometry(QtCore.QRect(130, 30, 111, 41))
        self.btn_disaable_password.setAutoDefault(False)
        self.btn_disaable_password.setObjectName("btn_disaable_password")
        self.btn_enable_password = QtWidgets.QPushButton(self.groupBox)
        self.btn_enable_password.setGeometry(QtCore.QRect(10, 30, 111, 41))
        self.btn_enable_password.setAutoDefault(False)
        self.btn_enable_password.setObjectName("btn_enable_password")
        self.btn_change_password.raise_()
        self.btn_disaable_password.raise_()
        self.btn_enable_password.raise_()
        self.tabWidget.addTab(self.tab_2, "")
        self.btn_save = QtWidgets.QPushButton(Dialog)
        self.btn_save.setGeometry(QtCore.QRect(170, 210, 81, 31))
        self.btn_save.setAutoDefault(False)
        self.btn_save.setDefault(True)
        self.btn_save.setObjectName("btn_save")
        self.btn_rest_setting = QtWidgets.QPushButton(Dialog)
        self.btn_rest_setting.setGeometry(QtCore.QRect(10, 210, 151, 31))
        self.btn_rest_setting.setAutoDefault(False)
        self.btn_rest_setting.setObjectName("btn_rest_setting")
        self.btn_close = QtWidgets.QPushButton(Dialog)
        self.btn_close.setGeometry(QtCore.QRect(350, 210, 75, 30))
        self.btn_close.setAutoDefault(False)
        self.btn_close.setObjectName("btn_close")

        self.retranslateUi(Dialog)
        self.tabWidget.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        Dialog.setTabOrder(self.btn_save, self.btn_rest_setting)
        Dialog.setTabOrder(self.btn_rest_setting, self.btn_close)
        Dialog.setTabOrder(self.btn_close, self.combo_font)
        Dialog.setTabOrder(self.combo_font, self.combo_languge)
        Dialog.setTabOrder(self.combo_languge, self.btn_reset_information)
        Dialog.setTabOrder(self.btn_reset_information, self.input_num)
        Dialog.setTabOrder(self.input_num, self.tabWidget)
        # ================== Coding ==================
        try:
            with open("setting.json", 'r') as File:
                File = json.load(File)
                if File["language_Programm"] != "English":
                    self.tabWidget.setLayoutDirection(QtCore.Qt.RightToLeft)
        except:
            pass

        Func_DataBase.set_setting(Dialog)

        # Try for if not exist file setting.json
        try:
            self.set_setting()
        except:
            self.reset_setting()
            self.command_save()

        try:
            Func_DataBase.get_password_in_database()
            self.status_password = True
        except:
            self.status_password = False

        self.btn_save.clicked.connect(self.command_save)
        self.btn_rest_setting.clicked.connect(self.reset_setting)

        self.btn_enable_password.clicked.connect(self.enble_password)
        self.btn_disaable_password.clicked.connect(self.disable_password)
        self.btn_change_password.clicked.connect(self.change_password)
        self.btn_reset_information.clicked.connect(self.reset_information)

        if self.status_password:
            self.btn_enable_password.setEnabled(False)
            self.btn_change_password.setEnabled(True)
            self.btn_disaable_password.setEnabled(True)
        elif not self.status_password:
            self.btn_enable_password.setDisabled(False)
            self.btn_change_password.setDisabled(True)
            self.btn_disaable_password.setDisabled(True)
Esempio n. 13
0
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(620, 455)
        MainWindow.setMinimumSize(620, 455)
        MainWindow.setMaximumSize(620, 455)
        MainWindow.setMinimumSize(QtCore.QSize(620, 455))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("Icons/Money_Manager.png"),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)  # ICON FOR WINDOW
        MainWindow.setWindowIcon(icon)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")

        self.btn_info = QtWidgets.QPushButton(self.centralwidget)
        self.btn_info.setGeometry(QtCore.QRect(330, 5, 60, 60))
        self.btn_info.setText("")
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap("Icons/info.png"), QtGui.QIcon.Normal,
                        QtGui.QIcon.Off)  # ICON INFO
        self.btn_info.setIcon(icon3)
        self.btn_info.setIconSize(QtCore.QSize(55, 55))
        self.btn_info.setFlat(True)
        self.btn_info.setObjectName("btn_info")
        self.line = QtWidgets.QFrame(self.centralwidget)
        self.line.setGeometry(QtCore.QRect(0, 65, 621, 21))
        self.line.setFrameShadow(QtWidgets.QFrame.Raised)
        self.line.setLineWidth(2)
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setObjectName("line")

        self.btn_setting = QtWidgets.QPushButton(self.centralwidget)
        self.btn_setting.setGeometry(QtCore.QRect(250, 5, 60, 60))
        self.btn_setting.setText("")
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap("Icons/setting.png"), QtGui.QIcon.Normal,
                        QtGui.QIcon.Off)  # ICON SETTING
        self.btn_setting.setIcon(icon2)
        self.btn_setting.setIconSize(QtCore.QSize(55, 55))
        self.btn_setting.setFlat(True)
        self.btn_setting.setObjectName("btn_setting")

        self.btn_s_g = QtWidgets.QPushButton(self.centralwidget)
        self.btn_s_g.setGeometry(QtCore.QRect(170, 5, 60, 60))
        self.btn_s_g.setText("")
        icon4 = QtGui.QIcon()
        icon4.addPixmap(QtGui.QPixmap("Icons/s_g.png"), QtGui.QIcon.Normal,
                        QtGui.QIcon.Off)  # ICON s_g
        self.btn_s_g.setIcon(icon4)
        self.btn_s_g.setIconSize(QtCore.QSize(50, 50))
        self.btn_s_g.setFlat(True)
        self.btn_s_g.setObjectName("btn_s_g")

        self.btn_delete = QtWidgets.QPushButton(self.centralwidget)
        self.btn_delete.setGeometry(QtCore.QRect(90, 5, 60, 60))
        self.btn_delete.setText("")
        icon5 = QtGui.QIcon()
        icon5.addPixmap(QtGui.QPixmap("Icons/Delate.png"), QtGui.QIcon.Normal,
                        QtGui.QIcon.Off)  # ICON DELATE
        self.btn_delete.setIcon(icon5)
        self.btn_delete.setIconSize(QtCore.QSize(55, 55))
        self.btn_delete.setFlat(True)
        self.btn_delete.setObjectName("btn_delete")
        self.treeWidget = QtWidgets.QTreeWidget(self.centralwidget)
        self.treeWidget.setGeometry(QtCore.QRect(10, 120, 601, 301))

        self.btn_add = QtWidgets.QPushButton(self.centralwidget)
        self.btn_add.setGeometry(QtCore.QRect(10, 5, 60, 60))
        self.btn_add.setText("")
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap("Icons/Add.png"), QtGui.QIcon.Normal,
                        QtGui.QIcon.Off)  # ICON ADD
        self.btn_add.setIcon(icon1)
        self.btn_add.setIconSize(QtCore.QSize(55, 55))
        self.btn_add.setFlat(True)
        self.btn_add.setObjectName("btn_add")
        # ----------------------
        font = QtGui.QFont()
        font.setPointSize(9)
        self.treeWidget.setFont(font)
        self.treeWidget.setFrameShadow(QtWidgets.QFrame.Plain)
        self.treeWidget.setAutoScroll(True)
        self.treeWidget.setTabKeyNavigation(False)
        self.treeWidget.setProperty("showDropIndicator", True)
        self.treeWidget.setDragEnabled(False)
        self.treeWidget.setDragDropOverwriteMode(False)
        self.treeWidget.setDefaultDropAction(QtCore.Qt.IgnoreAction)
        self.treeWidget.setAlternatingRowColors(True)
        self.treeWidget.setSelectionMode(
            QtWidgets.QAbstractItemView.SingleSelection)
        self.treeWidget.setAutoExpandDelay(-1)
        self.treeWidget.setIndentation(0)
        self.treeWidget.setObjectName("treeWidget")
        self.treeWidget.header().setDefaultSectionSize(110)
        self.txt_inventory = QtWidgets.QLabel(self.centralwidget)
        self.txt_inventory.setGeometry(QtCore.QRect(330, 90, 111, 20))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.txt_inventory.setFont(font)
        self.txt_inventory.setObjectName("txt_inventory")
        self.txtline_inventory = QtWidgets.QLineEdit(self.centralwidget)
        self.txtline_inventory.setGeometry(QtCore.QRect(450, 90, 141, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.txtline_inventory.setFont(font)
        self.txtline_inventory.setAlignment(QtCore.Qt.AlignCenter)
        self.txtline_inventory.setReadOnly(True)
        self.txtline_inventory.setObjectName("txtline_inventory")
        self.layoutWidget = QtWidgets.QWidget(self.centralwidget)
        self.layoutWidget.setGeometry(QtCore.QRect(10, 90, 291, 19))
        self.layoutWidget.setObjectName("layoutWidget")
        self.horizontalLayout = QtWidgets.QHBoxLayout(self.layoutWidget)
        self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.rdb_all = QtWidgets.QRadioButton(self.layoutWidget)
        self.rdb_all.setChecked(True)
        self.rdb_all.setObjectName("rdb_all")
        self.horizontalLayout.addWidget(self.rdb_all)
        self.rdb_received = QtWidgets.QRadioButton(self.layoutWidget)
        self.rdb_received.setObjectName("rdb_received")
        self.horizontalLayout.addWidget(self.rdb_received)
        self.rdb_Payments = QtWidgets.QRadioButton(self.layoutWidget)
        self.rdb_Payments.setObjectName("rdb_Payments")
        self.horizontalLayout.addWidget(self.rdb_Payments)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 620, 21))
        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)
        # ================== Coding ==================
        # Try for if not exists setting.json not give error
        try:
            with open("setting.json", 'r') as File:
                File = json.load(File)
                if File["language_Programm"] != "English":
                    self.centralwidget.setLayoutDirection(
                        QtCore.Qt.RightToLeft)

                self.them = File["them"]
        except:
            pass

        # Set Settig on the programm
        Func_DataBase.set_setting(MainWindow)

        try:
            Func_DataBase.get_password_in_database()
            self.status_password = True
        except:
            self.status_password = False

        # for if enable password first Enter password to open programm
        self.unlook()

        # Update Tabel inforamtion
        self.update_table_inventory()

        self.btn_add.clicked.connect(self.add_item)
        self.btn_delete.clicked.connect(self.remove_item)
        self.btn_s_g.clicked.connect(self.s_g)
        self.btn_setting.clicked.connect(self.win_setting)
        self.btn_info.clicked.connect(self.win_info)

        self.rdb_all.clicked.connect(self.update_table_inventory)
        self.rdb_received.clicked.connect(self.update_table_inventory)
        self.rdb_Payments.clicked.connect(self.update_table_inventory)

        # ==================== Status Bar ==========================
        self.btn_add.setStatusTip("Add Item")
        self.btn_delete.setStatusTip("Delete Item")
        self.btn_setting.setStatusTip("Setting program")
        self.btn_s_g.setStatusTip("This Create Comming Soon ")
        self.btn_info.setStatusTip("Info Programm And Developer")
        self.rdb_received.setStatusTip("Filter On Table")
        self.rdb_Payments.setStatusTip("Filter On Table")
        self.rdb_all.setStatusTip("Filter On Table")
        self.treeWidget.setStatusTip(
            f" {str(datetime.now())[0:10]} | {self.treeWidget.topLevelItemCount()} "
        )
        self.txtline_inventory.setStatusTip("Your Money Inventory")
        MainWindow.setStatusTip("Manager Money")
Esempio n. 14
0
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(393, 186)
        Dialog.setMinimumSize(393, 186)
        Dialog.setMaximumSize(393, 186)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("Icons/info.png"), QtGui.QIcon.Normal,
                       QtGui.QIcon.Off)
        Dialog.setWindowIcon(icon)
        self.txt_info = QtWidgets.QTextBrowser(Dialog)
        self.txt_info.setGeometry(QtCore.QRect(10, 10, 371, 101))
        self.txt_info.setObjectName("txt_info")
        self.txt_communicate = QtWidgets.QLabel(Dialog)
        self.txt_communicate.setGeometry(QtCore.QRect(10, 120, 211, 51))
        font = QtGui.QFont()
        font.setPointSize(9)
        self.txt_communicate.setFont(font)
        self.txt_communicate.setObjectName("txt_communicate")
        self.link_GitHub = QtWidgets.QCommandLinkButton(Dialog)
        self.link_GitHub.setGeometry(QtCore.QRect(210, 120, 50, 51))
        self.link_GitHub.setText("")
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap("Icons/gitub.png"), QtGui.QIcon.Normal,
                        QtGui.QIcon.Off)  # Icon GitHub
        self.link_GitHub.setIcon(icon1)
        self.link_GitHub.setIconSize(QtCore.QSize(40, 40))
        self.link_GitHub.setObjectName("link_instagram")
        self.link_Linkin = QtWidgets.QCommandLinkButton(Dialog)
        self.link_Linkin.setGeometry(QtCore.QRect(260, 120, 51, 51))
        self.link_Linkin.setText("")
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap("Icons/Linkden.png"), QtGui.QIcon.Normal,
                        QtGui.QIcon.Off)  # ICON Linkin
        self.link_Linkin.setIcon(icon2)
        self.link_Linkin.setIconSize(QtCore.QSize(40, 40))
        self.link_Linkin.setObjectName("link_Linkin")
        self.link_gmail = QtWidgets.QCommandLinkButton(Dialog)
        self.link_gmail.setGeometry(QtCore.QRect(310, 125, 51, 51))
        self.link_gmail.setText("")
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap("Icons/Gmail.png"), QtGui.QIcon.Normal,
                        QtGui.QIcon.Off)  # ICON GMAIL
        self.link_gmail.setIcon(icon3)
        self.link_gmail.setIconSize(QtCore.QSize(40, 40))
        self.link_gmail.setObjectName("link_gmail")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        # ================== Coding ==================
        Func_DataBase.set_setting(Dialog)

        if "Linux" in platform.platform():
            open_url = "xdg-open"
        elif "Window" in platform.platform():
            open_url = "start"
        else:
            open_url = "firefox"
            print("is a problem in open url")

        self.link_gmail.clicked.connect(lambda: self.send_gmail())

        # in windows with command start "target Site" open site in chrom
        self.link_GitHub.clicked.connect(
            lambda: os.system(f"{open_url} https://github.com/PooyaRezaee"))
        self.link_Linkin.clicked.connect(lambda: os.system(
            f"{open_url} https://www.linkedin.com/in/pooya-rezaee-moghadam-1700721b9"
        ))
Esempio n. 15
0
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(553, 335)
        Dialog.setMinimumSize(553, 335)
        Dialog.setMaximumSize(553, 335)
        Dialog.setMinimumSize(QtCore.QSize(55, 335))
        Dialog.setMaximumSize(QtCore.QSize(555, 335))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("Icons/Add.png"),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        Dialog.setWindowIcon(icon)
        self.widget = QtWidgets.QWidget(Dialog)
        self.widget.setGeometry(QtCore.QRect(10, 10, 531, 311))
        self.widget.setObjectName("widget")
        self.gridLayout_2 = QtWidgets.QGridLayout(self.widget)
        self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.line_8 = QtWidgets.QFrame(self.widget)
        self.line_8.setFrameShadow(QtWidgets.QFrame.Plain)
        self.line_8.setLineWidth(2)
        self.line_8.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_8.setObjectName("line_8")
        self.gridLayout.addWidget(self.line_8, 1, 0, 1, 1)
        self.line = QtWidgets.QFrame(self.widget)
        self.line.setFrameShadow(QtWidgets.QFrame.Plain)
        self.line.setLineWidth(2)
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setObjectName("line")
        self.gridLayout.addWidget(self.line, 1, 2, 1, 1)
        self.line_7 = QtWidgets.QFrame(self.widget)
        self.line_7.setFrameShadow(QtWidgets.QFrame.Plain)
        self.line_7.setLineWidth(2)
        self.line_7.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_7.setObjectName("line_7")
        self.gridLayout.addWidget(self.line_7, 5, 2, 1, 1)
        self.line_2 = QtWidgets.QFrame(self.widget)
        self.line_2.setFrameShadow(QtWidgets.QFrame.Plain)
        self.line_2.setLineWidth(2)
        self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_2.setObjectName("line_2")
        self.gridLayout.addWidget(self.line_2, 3, 2, 1, 1)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.txt_amount = QtWidgets.QLabel(self.widget)
        font = QtGui.QFont()
        font.setPointSize(10)
        self.txt_amount.setFont(font)
        self.txt_amount.setObjectName("txt_amount")
        self.horizontalLayout.addWidget(self.txt_amount)
        self.input_amount = QtWidgets.QLineEdit(self.widget)
        self.input_amount.setObjectName("input_amount")
        self.horizontalLayout.addWidget(self.input_amount)
        self.gridLayout.addLayout(self.horizontalLayout, 2, 0, 1, 1)
        self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_6.setObjectName("horizontalLayout_6")
        self.txt_description = QtWidgets.QLabel(self.widget)
        font = QtGui.QFont()
        font.setPointSize(8)
        self.txt_description.setFont(font)
        self.txt_description.setObjectName("txt_description")
        self.horizontalLayout_6.addWidget(self.txt_description)
        self.input_description = QtWidgets.QTextEdit(self.widget)
        self.input_description.setObjectName("input_description")
        self.horizontalLayout_6.addWidget(self.input_description)
        self.gridLayout.addLayout(self.horizontalLayout_6, 6, 0, 1, 3)
        self.line_4 = QtWidgets.QFrame(self.widget)
        self.line_4.setFrameShadow(QtWidgets.QFrame.Plain)
        self.line_4.setLineWidth(2)
        self.line_4.setFrameShape(QtWidgets.QFrame.VLine)
        self.line_4.setObjectName("line_4")
        self.gridLayout.addWidget(self.line_4, 4, 1, 1, 1)
        self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_5.setObjectName("horizontalLayout_5")
        self.txt_date = QtWidgets.QLabel(self.widget)
        font = QtGui.QFont()
        font.setPointSize(10)
        self.txt_date.setFont(font)
        self.txt_date.setObjectName("txt_date")
        self.horizontalLayout_5.addWidget(self.txt_date)
        self.input_date = QtWidgets.QDateEdit(self.widget)
        self.input_date.setObjectName("input_date")
        self.horizontalLayout_5.addWidget(self.input_date)
        self.gridLayout.addLayout(self.horizontalLayout_5, 2, 2, 1, 1)
        self.line_5 = QtWidgets.QFrame(self.widget)
        self.line_5.setFrameShadow(QtWidgets.QFrame.Plain)
        self.line_5.setLineWidth(2)
        self.line_5.setFrameShape(QtWidgets.QFrame.VLine)
        self.line_5.setObjectName("line_5")
        self.gridLayout.addWidget(self.line_5, 2, 1, 1, 1)
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.txt_fromorto = QtWidgets.QLabel(self.widget)
        font = QtGui.QFont()
        font.setPointSize(10)
        self.txt_fromorto.setFont(font)
        self.txt_fromorto.setObjectName("txt_fromorto")
        self.horizontalLayout_4.addWidget(self.txt_fromorto)
        self.input_fromorto = QtWidgets.QLineEdit(self.widget)
        self.input_fromorto.setText("")
        self.input_fromorto.setObjectName("input_fromorto")
        self.horizontalLayout_4.addWidget(self.input_fromorto)
        self.gridLayout.addLayout(self.horizontalLayout_4, 4, 0, 1, 1)
        self.txt_helper = QtWidgets.QLabel(self.widget)
        font = QtGui.QFont()
        font.setPointSize(15)
        font.setBold(True)
        font.setWeight(75)
        self.txt_helper.setFont(font)
        self.txt_helper.setFrameShadow(QtWidgets.QFrame.Plain)
        self.txt_helper.setLineWidth(2)
        self.txt_helper.setAlignment(QtCore.Qt.AlignCenter)
        self.txt_helper.setObjectName("txt_helper")
        self.gridLayout.addWidget(self.txt_helper, 0, 0, 1, 3)
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.txt_type = QtWidgets.QLabel(self.widget)
        font = QtGui.QFont()
        font.setPointSize(10)
        self.txt_type.setFont(font)
        self.txt_type.setObjectName("txt_type")
        self.horizontalLayout_3.addWidget(self.txt_type)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.rdb_payment = QtWidgets.QRadioButton(self.widget)
        self.rdb_payment.setObjectName("rdb_payment")
        self.horizontalLayout_2.addWidget(self.rdb_payment)
        self.rdb_received = QtWidgets.QRadioButton(self.widget)
        self.rdb_received.setObjectName("rdb_received")
        self.horizontalLayout_2.addWidget(self.rdb_received)
        self.horizontalLayout_3.addLayout(self.horizontalLayout_2)
        self.gridLayout.addLayout(self.horizontalLayout_3, 4, 2, 1, 1)
        self.line_6 = QtWidgets.QFrame(self.widget)
        self.line_6.setFrameShadow(QtWidgets.QFrame.Plain)
        self.line_6.setLineWidth(2)
        self.line_6.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_6.setObjectName("line_6")
        self.gridLayout.addWidget(self.line_6, 3, 0, 1, 1)
        self.line_3 = QtWidgets.QFrame(self.widget)
        self.line_3.setFrameShadow(QtWidgets.QFrame.Plain)
        self.line_3.setLineWidth(2)
        self.line_3.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_3.setObjectName("line_3")
        self.gridLayout.addWidget(self.line_3, 5, 0, 1, 1)
        self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 2)
        self.btn_ok = QtWidgets.QPushButton(self.widget)
        self.btn_ok.setCheckable(False)
        self.btn_ok.setAutoRepeat(False)
        self.btn_ok.setAutoDefault(False)
        self.btn_ok.setDefault(True)
        self.btn_ok.setObjectName("btn_ok")
        self.gridLayout_2.addWidget(self.btn_ok, 1, 0, 1, 1)
        self.btn_cancel = QtWidgets.QPushButton(self.widget)
        self.btn_cancel.setAutoDefault(False)
        self.btn_cancel.setObjectName("btn_cancel")
        self.gridLayout_2.addWidget(self.btn_cancel, 1, 1, 1, 1)

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

        # ================== Coding ==================
        try:
            with open("setting.json", 'r') as File:
                File = json.load(File)
                if File["language_Programm"] != "English":
                    self.widget.setLayoutDirection(QtCore.Qt.RightToLeft)  
        except:
            pass
        
        Func_DataBase.set_setting(Dialog)