From 9e287f0e20a109ae565c1452acae786a9fff3052 Mon Sep 17 00:00:00 2001 From: TS2_YouGame Date: Tue, 23 Aug 2022 20:40:49 +0300 Subject: [PATCH] 1.7 --- Emook_code/Fond.py | 58 +- Emook_code/Fond_old.py | 107 + ...0\273\321\214\321\210\320\260\321\217.ini" | 181 - ...275\320\264\320\260\321\200\321\202 2.ini" | 181 - ...0\275\320\264\320\260\321\200\321\202.ini" | 174 +- ...0\265\321\202\320\273\320\260\321\217.ini" | 6 +- ...1\221\320\274\320\275\320\260\321\217.ini" | 6 +- ...0\265\321\202\320\273\320\260\321\217.ini" | 6 +- ...1\221\320\274\320\275\320\260\321\217.ini" | 6 +- .../OriginUI/Fond.ui" | 128 +- .../Workspace/Fond.ui" | 140 +- .../Workspace/Main.ui" | 36 +- .../Workspace/Settings.ui" | 12 +- .../Workspace/Subselection.ui" | 12 +- .../Workspace/addDB.ui" | 10 +- .../Workspace/addForm.ui" | 52 +- .../Workspace/addFormPartTwo.ui" | 22 +- .../Workspace/readFond.ui" | 68 +- .../start.py" | 355 +- Emook_code/main.py | 3250 +++++++++-------- Emook_code/search.py | 44 + 21 files changed, 2496 insertions(+), 2358 deletions(-) create mode 100644 Emook_code/Fond_old.py delete mode 100644 "Emook_code/Resourses/Geometry/\320\221\320\276\320\273\321\214\321\210\320\260\321\217.ini" delete mode 100644 "Emook_code/Resourses/Geometry/\320\241\321\202\320\260\320\275\320\264\320\260\321\200\321\202 2.ini" create mode 100644 Emook_code/search.py diff --git a/Emook_code/Fond.py b/Emook_code/Fond.py index b94fba0..1df0ca1 100644 --- a/Emook_code/Fond.py +++ b/Emook_code/Fond.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'C:/Users/Иван/Desktop/Музейное дело/Fond.ui' +# Form implementation generated from reading ui file 'C:/Users/Админ/Desktop/Fond.ui' # -# Created by: PyQt5 UI code generator 5.15.4 +# Created by: PyQt5 UI code generator 5.15.7 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. @@ -14,7 +14,7 @@ class Ui_Fond(object): def setupUi(self, Fond): Fond.setObjectName("Fond") - Fond.resize(606, 569) + Fond.resize(606, 579) Fond.setStyleSheet("") self.Title = QtWidgets.QLabel(Fond) self.Title.setGeometry(QtCore.QRect(6, 20, 591, 31)) @@ -24,63 +24,67 @@ def setupUi(self, Fond): self.Title.setAlignment(QtCore.Qt.AlignCenter) self.Title.setObjectName("Title") self.listWidget = QtWidgets.QListWidget(Fond) - self.listWidget.setGeometry(QtCore.QRect(15, 195, 571, 311)) + self.listWidget.setGeometry(QtCore.QRect(15, 205, 571, 311)) font = QtGui.QFont() font.setPointSize(12) self.listWidget.setFont(font) self.listWidget.setObjectName("listWidget") - self.comboBoxSearch = QtWidgets.QComboBox(Fond) - self.comboBoxSearch.setGeometry(QtCore.QRect(20, 100, 561, 22)) - font = QtGui.QFont() - font.setPointSize(11) - self.comboBoxSearch.setFont(font) - self.comboBoxSearch.setEditable(True) - self.comboBoxSearch.setCurrentText("") - self.comboBoxSearch.setObjectName("comboBoxSearch") self.labelSearch = QtWidgets.QLabel(Fond) - self.labelSearch.setGeometry(QtCore.QRect(20, 71, 181, 16)) + self.labelSearch.setGeometry(QtCore.QRect(20, 70, 211, 21)) font = QtGui.QFont() font.setPointSize(14) self.labelSearch.setFont(font) self.labelSearch.setObjectName("labelSearch") self.backButton = QtWidgets.QPushButton(Fond) - self.backButton.setGeometry(QtCore.QRect(15, 520, 131, 31)) + self.backButton.setGeometry(QtCore.QRect(15, 530, 131, 31)) font = QtGui.QFont() font.setPointSize(11) self.backButton.setFont(font) self.backButton.setObjectName("backButton") self.labelSearch_2 = QtWidgets.QLabel(Fond) - self.labelSearch_2.setGeometry(QtCore.QRect(20, 131, 311, 21)) + self.labelSearch_2.setGeometry(QtCore.QRect(20, 130, 361, 31)) font = QtGui.QFont() font.setPointSize(14) self.labelSearch_2.setFont(font) self.labelSearch_2.setObjectName("labelSearch_2") - self.comboBoxSearch_2 = QtWidgets.QComboBox(Fond) - self.comboBoxSearch_2.setGeometry(QtCore.QRect(20, 160, 561, 22)) - font = QtGui.QFont() - font.setPointSize(11) - self.comboBoxSearch_2.setFont(font) - self.comboBoxSearch_2.setEditable(True) - self.comboBoxSearch_2.setCurrentText("") - self.comboBoxSearch_2.setObjectName("comboBoxSearch_2") self.refreshButton = QtWidgets.QPushButton(Fond) - self.refreshButton.setGeometry(QtCore.QRect(460, 520, 131, 31)) + self.refreshButton.setGeometry(QtCore.QRect(460, 530, 131, 31)) font = QtGui.QFont() font.setPointSize(11) self.refreshButton.setFont(font) self.refreshButton.setObjectName("refreshButton") self.exporthButton = QtWidgets.QPushButton(Fond) - self.exporthButton.setGeometry(QtCore.QRect(320, 520, 131, 31)) + self.exporthButton.setGeometry(QtCore.QRect(310, 530, 141, 31)) font = QtGui.QFont() font.setPointSize(11) self.exporthButton.setFont(font) self.exporthButton.setObjectName("exporthButton") self.importButton = QtWidgets.QPushButton(Fond) - self.importButton.setGeometry(QtCore.QRect(180, 520, 131, 31)) + self.importButton.setGeometry(QtCore.QRect(160, 530, 141, 31)) font = QtGui.QFont() font.setPointSize(11) self.importButton.setFont(font) self.importButton.setObjectName("importButton") + self.search_name_button = QtWidgets.QPushButton(Fond) + self.search_name_button.setGeometry(QtCore.QRect(490, 95, 93, 31)) + font = QtGui.QFont() + font.setPointSize(11) + self.search_name_button.setFont(font) + self.search_name_button.setObjectName("search_name_button") + self.search_name_line = QtWidgets.QLineEdit(Fond) + self.search_name_line.setGeometry(QtCore.QRect(20, 100, 461, 22)) + self.search_name_line.setText("") + self.search_name_line.setObjectName("search_name_line") + self.search_num_button = QtWidgets.QPushButton(Fond) + self.search_num_button.setGeometry(QtCore.QRect(490, 165, 93, 31)) + font = QtGui.QFont() + font.setPointSize(11) + self.search_num_button.setFont(font) + self.search_num_button.setObjectName("search_num_button") + self.search_num_line = QtWidgets.QLineEdit(Fond) + self.search_num_line.setGeometry(QtCore.QRect(20, 170, 461, 22)) + self.search_num_line.setText("") + self.search_num_line.setObjectName("search_num_line") self.retranslateUi(Fond) QtCore.QMetaObject.connectSlotsByName(Fond) @@ -95,6 +99,8 @@ def retranslateUi(self, Fond): self.refreshButton.setText(_translate("Fond", "Обновить")) self.exporthButton.setText(_translate("Fond", "Экспортировать")) self.importButton.setText(_translate("Fond", "Импортировать")) + self.search_name_button.setText(_translate("Fond", "Поиск")) + self.search_num_button.setText(_translate("Fond", "Поиск")) if __name__ == "__main__": diff --git a/Emook_code/Fond_old.py b/Emook_code/Fond_old.py new file mode 100644 index 0000000..b94fba0 --- /dev/null +++ b/Emook_code/Fond_old.py @@ -0,0 +1,107 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'C:/Users/Иван/Desktop/Музейное дело/Fond.ui' +# +# Created by: PyQt5 UI code generator 5.15.4 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_Fond(object): + def setupUi(self, Fond): + Fond.setObjectName("Fond") + Fond.resize(606, 569) + Fond.setStyleSheet("") + self.Title = QtWidgets.QLabel(Fond) + self.Title.setGeometry(QtCore.QRect(6, 20, 591, 31)) + font = QtGui.QFont() + font.setPointSize(22) + self.Title.setFont(font) + self.Title.setAlignment(QtCore.Qt.AlignCenter) + self.Title.setObjectName("Title") + self.listWidget = QtWidgets.QListWidget(Fond) + self.listWidget.setGeometry(QtCore.QRect(15, 195, 571, 311)) + font = QtGui.QFont() + font.setPointSize(12) + self.listWidget.setFont(font) + self.listWidget.setObjectName("listWidget") + self.comboBoxSearch = QtWidgets.QComboBox(Fond) + self.comboBoxSearch.setGeometry(QtCore.QRect(20, 100, 561, 22)) + font = QtGui.QFont() + font.setPointSize(11) + self.comboBoxSearch.setFont(font) + self.comboBoxSearch.setEditable(True) + self.comboBoxSearch.setCurrentText("") + self.comboBoxSearch.setObjectName("comboBoxSearch") + self.labelSearch = QtWidgets.QLabel(Fond) + self.labelSearch.setGeometry(QtCore.QRect(20, 71, 181, 16)) + font = QtGui.QFont() + font.setPointSize(14) + self.labelSearch.setFont(font) + self.labelSearch.setObjectName("labelSearch") + self.backButton = QtWidgets.QPushButton(Fond) + self.backButton.setGeometry(QtCore.QRect(15, 520, 131, 31)) + font = QtGui.QFont() + font.setPointSize(11) + self.backButton.setFont(font) + self.backButton.setObjectName("backButton") + self.labelSearch_2 = QtWidgets.QLabel(Fond) + self.labelSearch_2.setGeometry(QtCore.QRect(20, 131, 311, 21)) + font = QtGui.QFont() + font.setPointSize(14) + self.labelSearch_2.setFont(font) + self.labelSearch_2.setObjectName("labelSearch_2") + self.comboBoxSearch_2 = QtWidgets.QComboBox(Fond) + self.comboBoxSearch_2.setGeometry(QtCore.QRect(20, 160, 561, 22)) + font = QtGui.QFont() + font.setPointSize(11) + self.comboBoxSearch_2.setFont(font) + self.comboBoxSearch_2.setEditable(True) + self.comboBoxSearch_2.setCurrentText("") + self.comboBoxSearch_2.setObjectName("comboBoxSearch_2") + self.refreshButton = QtWidgets.QPushButton(Fond) + self.refreshButton.setGeometry(QtCore.QRect(460, 520, 131, 31)) + font = QtGui.QFont() + font.setPointSize(11) + self.refreshButton.setFont(font) + self.refreshButton.setObjectName("refreshButton") + self.exporthButton = QtWidgets.QPushButton(Fond) + self.exporthButton.setGeometry(QtCore.QRect(320, 520, 131, 31)) + font = QtGui.QFont() + font.setPointSize(11) + self.exporthButton.setFont(font) + self.exporthButton.setObjectName("exporthButton") + self.importButton = QtWidgets.QPushButton(Fond) + self.importButton.setGeometry(QtCore.QRect(180, 520, 131, 31)) + font = QtGui.QFont() + font.setPointSize(11) + self.importButton.setFont(font) + self.importButton.setObjectName("importButton") + + self.retranslateUi(Fond) + QtCore.QMetaObject.connectSlotsByName(Fond) + + def retranslateUi(self, Fond): + _translate = QtCore.QCoreApplication.translate + Fond.setWindowTitle(_translate("Fond", "Form")) + self.Title.setText(_translate("Fond", "Нумизматика: Медали")) + self.labelSearch.setText(_translate("Fond", "Поиск на названию")) + self.backButton.setText(_translate("Fond", "Назад")) + self.labelSearch_2.setText(_translate("Fond", "Поиск по номеру учётной записи")) + self.refreshButton.setText(_translate("Fond", "Обновить")) + self.exporthButton.setText(_translate("Fond", "Экспортировать")) + self.importButton.setText(_translate("Fond", "Импортировать")) + + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + Fond = QtWidgets.QWidget() + ui = Ui_Fond() + ui.setupUi(Fond) + Fond.show() + sys.exit(app.exec_()) diff --git "a/Emook_code/Resourses/Geometry/\320\221\320\276\320\273\321\214\321\210\320\260\321\217.ini" "b/Emook_code/Resourses/Geometry/\320\221\320\276\320\273\321\214\321\210\320\260\321\217.ini" deleted file mode 100644 index 1d1e0af..0000000 --- "a/Emook_code/Resourses/Geometry/\320\221\320\276\320\273\321\214\321\210\320\260\321\217.ini" +++ /dev/null @@ -1,181 +0,0 @@ -[Main] -Window = 853, 735 -Title = 10, 20, 841, 111 -labelSelection = 20, 120, 611, 101 -allButton = 640, 580, 191, 51 -addButton = 570, 650, 271, 61 -exitButton = 10, 660, 161, 51 -pushButton_1 = 40, 230, 321, 61 -pushButton_2 = 500, 230, 321, 61 -pushButton_3 = 40, 300, 321, 61 -pushButton_4 = 500, 300, 321, 61 -pushButton_5 = 40, 370, 321, 61 -pushButton_6 = 500, 370, 321, 61 -pushButton_7 = 40, 440, 321, 71 -pushButton_8 = 500, 440, 321, 71 -settingsButton = 190, 660, 171, 51 - -FontTitle = 28 -FontlabelSelection = 22 - -[Fond] -Window = 861, 708 -Title = 6, 20, 851, 41 -listWidget = 15, 270, 831, 361 -comboBoxSearch = 20, 111, 821, 31 -labelSearch = 20, 80, 261, 21 -backButton = 15, 650, 171, 41 -labelSearch_2 = 20, 160, 531, 31 -comboBoxSearch_2 = 20, 210, 821, 31 -refreshButton = 660, 650, 191, 51 -exporthButton = 470, 650, 171, 51 -importButton = 300, 650, 161, 51 - -FontTitle = 23 -FontlabelSearch = 17 -FontlabelSearch_2 = 16 -FontlistWidget = 15 -FontcomboBoxSearch = 13 -FontcomboBoxSearch_2 = 13 - -[addForm] -Window = 691, 696 -Title = 10, 15, 671, 51 -labelSelection = 20, 100, 321, 31 -Section = 20, 150, 601, 41 -labelSubselection = 20, 210, 331, 31 -Subselection = 20, 250, 601, 41 -radioButtonFond_1 = 30, 314, 281, 31 -radioButtonFond_2 = 30, 360, 351, 31 -nextButton = 480, 610, 201, 71 -backButton = 10, 620, 181, 61 -lineEditName = 20, 440, 631, 41 -labelName = 20, 390, 411, 41 -labelNumber = 20, 500, 371, 31 -lineEditNumber = 20, 540, 631, 41 - -FontTitle = 21 -FontlabelSelection = 16 -FontSection = 15 -FontlabelSubselection = 16 -FontSubselection = 15 -FontradioButtonFond_1 = 13 -FontradioButtonFond_2 = 13 -FontlineEditName = 14 -FontlabelName = 16 -FontlabelNumber = 16 -FontlineEditNumber = 14 - -[addFormPartTwo] -Window = 637, 698 -Title = 10, 15, 650, 41 -labelGifter = 20, 100, 351, 31 -lineEditGifter = 20, 150, 601, 41 -labelDescription = 20, 290, 311, 31 -textEditDescription = 20, 330, 601, 241 -labelPoint = 20, 200, 371, 31 -lineEditPoint = 20, 240, 601, 41 -saveButton = 450, 620, 171, 51 -backButton = 10, 620, 181, 51 - -FontTitle = 20 -FontlabelGifter = 17 -FontlineEditGifter = 17 -FontlabelDescription = 16 -FonttextEditDescription = 13 -FontlabelPoint = 17 -FontlineEditPoint = 17 - -[UiSubselection] -Window = 783, 474 -Title = 10, 20, 761, 81 -labelSubselection = 40, 170, 431, 31 -backButton = 10, 410, 161, 51 -pushButton_1 = 40, 220, 351, 51 -pushButton_2 = 400, 220, 341, 51 -pushButton_3 = 40, 280, 351, 51 -pushButton_4 = 400, 280, 341, 51 - -FontTitle = 30 -FontlabelSubselection = 17 - -[UiReadForm] -Window = 502, 658 -Title = 10, 15, 481, 31 -titleSelection = 20, 60, 121, 31 -titleSubselection = 20, 90, 231, 31 -labelNumber = 20, 180, 211, 31 -labelGifter = 20, 230, 311, 21 -labelDescription = 20, 370, 311, 21 -labelPoint = 20, 300, 311, 21 -labelSelection = 140, 60, 341, 31 -labelSubselection = 250, 90, 241, 31 -labelTypeFond = 20, 140, 471, 21 -lableNumber = 240, 180, 251, 31 -lableGifter = 20, 260, 471, 21 -lablePoint = 20, 330, 471, 21 -textBrowserDescription = 20, 400, 461, 192 -pushButtonDelite = 370, 610, 111, 31 -pushButtonClose = 20, 610, 111, 31 -pushButtonEdit = 250, 610, 111, 31 - -FontTitle = 17 -FonttitleSelection = 14 -FonttitleSubselection = 14 -FontlabelNumber = 14 -FontlabelGifter = 14 -FontlabelDescription = 14 -FontlabelPoint = 14 -FontlabelSelection = 14 -FontlabelSubselection = 14 -FontlabelTypeFond = 14 -FontlableNumber = 14 -FontlableGifter = 14 -FontlablePoint = 14 -FonttextBrowserDescription = 11 - -[UiSettings] -Window = 625, 456 -Title = 10, 10, 601, 61 -appyButton = 410, 380, 201, 61 -themeLabel = 20, 110, 231, 31 -themeComboBox = 20, 150, 441, 31 -geometryComboBox = 20, 270, 441, 31 -geometryLabel = 20, 230, 301, 31 - -FontTitle = 30 -FontthemeLabel = 16 -FontthemeComboBox = 14 -FontgeometryLabel = 16 -FontgeometryComboBox = 14 - -[wSingIn] -Window = 778, 491 -Title = 10, 9, 751, 71 -listWidget = 20, 98, 741, 301 -editButton = 650, 440, 121, 41 -addButton = 510, 440, 131, 41 -removeButton = 370, 440, 131, 41 -exitButton = 10, 440, 141, 41 - -FontTitle = 32 -FontlistWidget = 13 - -[wAddDB] -Window = 638, 370 -Title = 16, 9, 611, 51 -labelName = 20, 100, 231, 31 -lineName = 20, 140, 611, 31 -labelConnect = 20, 200, 291, 31 -lineConnect = 20, 240, 611, 31 -addButton = 500, 320, 131, 41 -closeButton = 10, 320, 121, 41 - -FontTitle = 25 -FontlabelName = 19 -FontlineName = 13 -FontlabelConnect = 19 -FontlineConnect = 13 - -[Additions] -ButtonFontPointSize = 15 \ No newline at end of file diff --git "a/Emook_code/Resourses/Geometry/\320\241\321\202\320\260\320\275\320\264\320\260\321\200\321\202 2.ini" "b/Emook_code/Resourses/Geometry/\320\241\321\202\320\260\320\275\320\264\320\260\321\200\321\202 2.ini" deleted file mode 100644 index a0b233c..0000000 --- "a/Emook_code/Resourses/Geometry/\320\241\321\202\320\260\320\275\320\264\320\260\321\200\321\202 2.ini" +++ /dev/null @@ -1,181 +0,0 @@ -[Main] -Window = 625, 437 -Title = 10, 20, 591, 81 -labelSelection = 20, 110, 341, 31 -allButton = 460, 345, 141, 31 -addButton = 410, 395, 201, 31 -exitButton = 10, 400, 101, 31 -pushButton_1 = 20, 150, 281, 31 -pushButton_2 = 310, 150, 281, 31 -pushButton_3 = 20, 190, 281, 31 -pushButton_4 = 310, 190, 281, 31 -pushButton_5 = 20, 230, 281, 31 -pushButton_6 = 310, 230, 281, 31 -pushButton_7 = 20, 270, 281, 31 -pushButton_8 = 310, 270, 281, 31 -settingsButton = 130, 400, 111, 31 - -FontTitle = 28 -FontlabelSelection = 14 - -[Fond] -Window = 663, 634 -Title = 10, 20, 641, 41 -listWidget = 15, 235, 631, 341 -comboBoxSearch = 20, 130, 621, 22 -labelSearch = 20, 90, 211, 21 -backButton = 20, 590, 131, 31 -labelSearch_2 = 20, 160, 361, 31 -comboBoxSearch_2 = 20, 200, 621, 22 -refreshButton = 510, 590, 131, 31 -exporthButton = 350, 590, 141, 31 -importButton = 170, 590, 141, 31 - -FontTitle = 19 -FontlabelSearch = 14 -FontlabelSearch_2 = 14 -FontlistWidget = 12 -FontcomboBoxSearch = 11 -FontcomboBoxSearch_2 = 11 - -[addForm] -Window = 502, 478 -Title = 10, 15, 481, 31 -labelSelection = 20, 50, 231, 31 -Section = 20, 90, 471, 31 -labelSubselection = 20, 130, 271, 31 -Subselection = 20, 170, 471, 31 -radioButtonFond_1 = 20, 216, 231, 21 -radioButtonFond_2 = 20, 236, 291, 31 -nextButton = 360, 440, 131, 31 -backButton = 10, 440, 131, 31 -lineEditName = 20, 310, 471, 31 -labelName = 20, 280, 291, 21 -labelNumber = 20, 350, 291, 31 -lineEditNumber = 20, 390, 471, 31 - -FontTitle = 17 -FontlabelSelection = 14 -FontSection = 11 -FontlabelSubselection = 14 -FontSubselection = 11 -FontradioButtonFond_1 = 11 -FontradioButtonFond_2 = 11 -FontlineEditName = 14 -FontlabelName = 14 -FontlabelNumber = 14 -FontlineEditNumber = 14 - -[addFormPartTwo] -Window = 502, 479 -Title = 10, 15, 481, 31 -labelGifter = 20, 50, 311, 31 -lineEditGifter = 20, 90, 471, 31 -labelDescription = 20, 210, 311, 21 -textEditDescription = 20, 240, 471, 171 -labelPoint = 20, 130, 311, 31 -lineEditPoint = 20, 170, 471, 31 -saveButton = 360, 430, 131, 31 -backButton = 10, 430, 131, 31 - -FontTitle = 17 -FontlabelGifter = 14 -FontlineEditGifter = 14 -FontlabelDescription = 14 -FonttextEditDescription = 11 -FontlabelPoint = 14 -FontlineEditPoint = 14 - -[UiSubselection] -Window = 660, 369 -Title = 10, 20, 641, 81 -labelSubselection = 20, 110, 381, 31 -backButton = 10, 320, 101, 31 -pushButton_1 = 20, 150, 281, 31 -pushButton_2 = 360, 150, 281, 31 -pushButton_3 = 20, 190, 281, 31 -pushButton_4 = 360, 190, 281, 31 - -FontTitle = 23 -FontlabelSubselection = 14 - -[UiReadForm] -Window = 502, 658 -Title = 10, 15, 481, 31 -titleSelection = 20, 60, 131, 31 -titleSubselection = 20, 90, 271, 31 -labelNumber = 20, 180, 251, 31 -labelGifter = 20, 220, 311, 31 -labelDescription = 20, 370, 311, 21 -labelPoint = 20, 300, 311, 21 -labelSelection = 160, 60, 341, 31 -labelSubselection = 290, 90, 241, 31 -labelTypeFond = 20, 140, 471, 21 -lableNumber = 270, 180, 251, 31 -lableGifter = 20, 260, 471, 21 -lablePoint = 20, 330, 471, 21 -textBrowserDescription = 20, 400, 461, 192 -pushButtonDelite = 370, 610, 111, 31 -pushButtonClose = 20, 610, 111, 31 -pushButtonEdit = 250, 610, 111, 31 - -FontTitle = 17 -FonttitleSelection = 14 -FonttitleSubselection = 14 -FontlabelNumber = 14 -FontlabelGifter = 14 -FontlabelDescription = 14 -FontlabelPoint = 14 -FontlabelSelection = 14 -FontlabelSubselection = 14 -FontlabelTypeFond = 14 -FontlableNumber = 14 -FontlableGifter = 14 -FontlablePoint = 14 -FonttextBrowserDescription = 11 - -[UiSettings] -Window = 411, 293 -Title = 10, 10, 391, 61 -appyButton = 290, 250, 101, 31 -themeLabel = 20, 80, 121, 21 -themeComboBox = 20, 110, 261, 22 -geometryComboBox = 20, 190, 261, 22 -geometryLabel = 20, 160, 181, 21 - -FontTitle = 26 -FontthemeLabel = 14 -FontthemeComboBox = 11 -FontgeometryLabel = 14 -FontgeometryComboBox = 11 - -[wSingIn] -Window = 624, 387 -Title = 10, 9, 611, 71 -listWidget = 20, 98, 591, 231 -editButton = 510, 340, 101, 31 -addButton = 400, 340, 101, 31 -removeButton = 280, 340, 101, 31 -exitButton = 20, 338, 101, 31 - -FontTitle = 23 -FontlistWidget = 11 - -[wAddDB] -Window = 521, 300 -Title = 16, 9, 491, 41 -labelName = 20, 70, 191, 31 -lineName = 20, 110, 481, 31 -labelConnect = 20, 150, 241, 31 -lineConnect = 20, 190, 481, 31 -addButton = 410, 262, 101, 31 -closeButton = 10, 260, 101, 31 - -FontTitle = 20 -FontlabelName = 14 -FontlineName = 13 -FontlabelConnect = 14 -FontlineConnect = 13 - -[Additions] -ButtonFontPointSize = 11 \ No newline at end of file diff --git "a/Emook_code/Resourses/Geometry/\320\241\321\202\320\260\320\275\320\264\320\260\321\200\321\202.ini" "b/Emook_code/Resourses/Geometry/\320\241\321\202\320\260\320\275\320\264\320\260\321\200\321\202.ini" index bbb1a70..3d7f0be 100644 --- "a/Emook_code/Resourses/Geometry/\320\241\321\202\320\260\320\275\320\264\320\260\321\200\321\202.ini" +++ "b/Emook_code/Resourses/Geometry/\320\241\321\202\320\260\320\275\320\264\320\260\321\200\321\202.ini" @@ -1,59 +1,61 @@ [Main] -Window = 625, 437 -Title = 10, 20, 591, 81 -labelSelection = 20, 120, 281, 21 -allButton = 460, 345, 141, 31 -addButton = 410, 395, 201, 31 -exitButton = 10, 400, 101, 31 -pushButton_1 = 20, 150, 281, 31 -pushButton_2 = 310, 150, 281, 31 -pushButton_3 = 20, 190, 281, 31 -pushButton_4 = 310, 190, 281, 31 -pushButton_5 = 20, 230, 281, 31 -pushButton_6 = 310, 230, 281, 31 -pushButton_7 = 20, 270, 281, 31 -pushButton_8 = 310, 270, 281, 31 -pushButton_9 = 20, 310, 111, 31 -settingsButton = 130, 400, 111, 31 +Window = 625, 455 +Title = 10, 10, 591, 91 +labelSelection = 20, 120, 561, 31 +allButton = 460, 355, 141, 31 +addButton = 410, 405, 201, 31 +exitButton = 10, 410, 101, 31 +pushButton_1 = 20, 160, 281, 31 +pushButton_2 = 310, 160, 281, 31 +pushButton_3 = 20, 200, 281, 31 +pushButton_4 = 310, 200, 281, 31 +pushButton_5 = 20, 240, 281, 31 +pushButton_6 = 310, 240, 281, 31 +pushButton_7 = 20, 280, 281, 31 +pushButton_8 = 310, 280, 281, 31 +pushButton_9 = 20, 320, 111, 31 +settingsButton = 130, 410, 111, 31 FontTitle = 28 FontlabelSelection = 14 [Fond] -Window = 606, 569 -Title = 6, 20, 591, 31 -listWidget = 15, 195, 571, 311 -comboBoxSearch = 20, 100, 561, 22 -labelSearch = 20, 71, 181, 16 -backButton = 15, 520, 131, 31 -labelSearch_2 = 20, 131, 311, 21 -comboBoxSearch_2 = 20, 160, 561, 22 -refreshButton = 460, 520, 131, 31 -exporthButton = 320, 520, 131, 31 -importButton = 180, 520, 131, 31 +Window = 606, 604 +Title = 6, 10, 591, 41 +listWidget = 15, 235, 571, 311 +search_name_button = 490, 100, 93, 31 +search_name_line = 20, 100, 461, 31 +labelSearch = 20, 70, 211, 21 +backButton = 15, 560, 131, 31 +labelSearch_2 = 20, 140, 361, 31 +search_num_button = 490, 180, 93, 31 +search_num_line = 20, 180, 461, 31 +refreshButton = 460, 560, 131, 31 +exporthButton = 310, 560, 141, 31 +importButton = 160, 560, 141, 31 FontTitle = 22 FontlabelSearch = 14 FontlabelSearch_2 = 14 FontlistWidget = 12 -FontcomboBoxSearch = 11 -FontcomboBoxSearch_2 = 11 +Fontsearch_name_line = 12 +Fontsearch_num_line = 12 [addForm] -Window = 502, 478 -Title = 10, 15, 481, 31 -labelSelection = 20, 60, 231, 21 -Section = 20, 90, 471, 31 -labelSubselection = 20, 140, 231, 21 -Subselection = 20, 170, 471, 31 -radioButtonFond_1 = 20, 220, 141, 17 -radioButtonFond_2 = 20, 250, 271, 17 -nextButton = 360, 440, 131, 31 -backButton = 10, 440, 131, 31 -lineEditName = 20, 310, 471, 31 -labelName = 20, 280, 291, 21 -labelNumber = 20, 350, 291, 21 -lineEditNumber = 20, 380, 471, 31 +Window = 502, 563 +Title = 10, 15, 481, 41 +labelSelection = 20, 70, 471, 31 +Section = 20, 120, 471, 31 +labelSubselection = 20, 170, 461, 31 +Subselection = 20, 210, 471, 31 +radioButtonFond_1 = 20, 260, 471, 31 +radioButtonFond_2 = 20, 300, 471, 31 +nextButton = 360, 510, 131, 31 +backButton = 10, 510, 131, 31 +lineEditName = 20, 380, 471, 31 +labelName = 20, 340, 471, 31 +labelNumber = 20, 420, 461, 31 +lineEditNumber = 20, 460, 471, 31 FontTitle = 17 FontlabelSelection = 14 @@ -68,16 +70,16 @@ FontlabelNumber = 14 FontlineEditNumber = 14 [addFormPartTwo] -Window = 502, 479 +Window = 502, 499 Title = 10, 15, 481, 31 -labelGifter = 20, 60, 311, 21 -lineEditGifter = 20, 90, 471, 31 -labelDescription = 20, 210, 311, 21 -textEditDescription = 20, 240, 471, 171 -labelPoint = 20, 130, 311, 21 -lineEditPoint = 20, 160, 471, 31 -saveButton = 360, 430, 131, 31 -backButton = 10, 430, 131, 31 +labelGifter = 20, 60, 311, 31 +lineEditGifter = 20, 100, 471, 31 +labelDescription = 20, 220, 311, 31 +textEditDescription = 20, 260, 471, 171 +labelPoint = 20, 140, 311, 31 +lineEditPoint = 20, 180, 471, 31 +saveButton = 360, 450, 131, 31 +backButton = 10, 450, 131, 31 FontTitle = 17 FontlabelGifter = 14 @@ -90,35 +92,35 @@ FontlineEditPoint = 14 [UiSubselection] Window = 615, 369 Title = 10, 20, 601, 81 -labelSubselection = 20, 120, 321, 21 +labelSubselection = 20, 120, 411, 31 backButton = 10, 320, 101, 31 -pushButton_1 = 20, 150, 281, 31 -pushButton_2 = 310, 150, 281, 31 -pushButton_3 = 20, 190, 281, 31 -pushButton_4 = 310, 190, 281, 31 +pushButton_1 = 20, 170, 281, 31 +pushButton_2 = 310, 170, 281, 31 +pushButton_3 = 20, 210, 281, 31 +pushButton_4 = 310, 210, 281, 31 -FontTitle = 30 +FontTitle = 20 FontlabelSubselection = 14 [UiReadForm] -Window = 502, 658 -Title = 10, 15, 481, 31 -titleSelection = 20, 60, 121, 31 -titleSubselection = 20, 90, 231, 31 -labelNumber = 20, 180, 211, 31 -labelGifter = 20, 230, 311, 21 -labelDescription = 20, 370, 311, 21 -labelPoint = 20, 300, 311, 21 -labelSelection = 140, 60, 341, 31 -labelSubselection = 250, 90, 241, 31 -labelTypeFond = 20, 140, 471, 21 -lableNumber = 240, 180, 251, 31 -lableGifter = 20, 260, 471, 21 -lablePoint = 20, 330, 471, 21 -textBrowserDescription = 20, 400, 461, 192 -pushButtonDelite = 370, 610, 111, 31 -pushButtonClose = 20, 610, 111, 31 -pushButtonEdit = 250, 610, 111, 31 +Window = 1018, 547 +Title = 10, 15, 991, 31 +titleSelection = 20, 60, 131, 31 +titleSubselection = 20, 90, 271, 31 +labelNumber = 20, 220, 261, 31 +labelGifter = 20, 300, 311, 31 +labelDescription = 510, 70, 321, 31 +labelPoint = 20, 380, 311, 21 +labelSelection = 160, 60, 341, 31 +labelSubselection = 20, 130, 381, 31 +labelTypeFond = 20, 180, 471, 21 +lableNumber = 20, 260, 251, 31 +lableGifter = 20, 340, 471, 21 +lablePoint = 20, 410, 471, 21 +textBrowserDescription = 510, 110, 491, 331 +pushButtonDelite = 890, 500, 111, 31 +pushButtonClose = 10, 500, 111, 31 +pushButtonEdit = 770, 500, 111, 31 FontTitle = 17 FonttitleSelection = 14 @@ -137,12 +139,12 @@ FonttextBrowserDescription = 11 [UiSettings] Window = 399, 300 -Title = 10, 20, 381, 31 +Title = 10, 20, 381, 51 appyButton = 284, 252, 101, 31 -themeLabel = 20, 80, 121, 21 -themeComboBox = 20, 110, 261, 22 -geometryComboBox = 20, 190, 261, 22 -geometryLabel = 20, 160, 151, 21 +themeLabel = 20, 90, 121, 21 +themeComboBox = 20, 120, 261, 22 +geometryComboBox = 20, 200, 261, 22 +geometryLabel = 20, 170, 191, 21 FontTitle = 26 FontthemeLabel = 14 @@ -164,11 +166,11 @@ FontlistWidget = 11 [wAddDB] Window = 521, 300 -Title = 16, 9, 491, 41 -labelName = 20, 80, 191, 21 -lineName = 20, 110, 481, 31 -labelConnect = 20, 160, 241, 21 -lineConnect = 20, 190, 481, 31 +Title = 16, 9, 491, 51 +labelName = 20, 80, 191, 31 +lineName = 20, 120, 481, 31 +labelConnect = 20, 160, 241, 31 +lineConnect = 20, 200, 481, 31 addButton = 410, 262, 101, 31 closeButton = 10, 260, 101, 31 diff --git "a/Emook_code/Resourses/styles/\320\223\320\276\320\273\321\203\320\261\320\260\321\217 \321\201\320\262\320\265\321\202\320\273\320\260\321\217.ini" "b/Emook_code/Resourses/styles/\320\223\320\276\320\273\321\203\320\261\320\260\321\217 \321\201\320\262\320\265\321\202\320\273\320\260\321\217.ini" index 765ce12..24619fa 100644 --- "a/Emook_code/Resourses/styles/\320\223\320\276\320\273\321\203\320\261\320\260\321\217 \321\201\320\262\320\265\321\202\320\273\320\260\321\217.ini" +++ "b/Emook_code/Resourses/styles/\320\223\320\276\320\273\321\203\320\261\320\260\321\217 \321\201\320\262\320\265\321\202\320\273\320\260\321\217.ini" @@ -18,11 +18,13 @@ settingsbutton = [Fond] title = listwidget = -comboboxsearch = +search_name_button = +search_name_line = +search_num_button = +search_num_line = labelsearch = backbutton = labelsearch_2 = -comboboxsearch_2 = refreshbutton = exporthbutton = importbutton = diff --git "a/Emook_code/Resourses/styles/\320\223\320\276\320\273\321\203\320\261\320\260\321\217 \321\202\321\221\320\274\320\275\320\260\321\217.ini" "b/Emook_code/Resourses/styles/\320\223\320\276\320\273\321\203\320\261\320\260\321\217 \321\202\321\221\320\274\320\275\320\260\321\217.ini" index 1c1704e..f94e37f 100644 --- "a/Emook_code/Resourses/styles/\320\223\320\276\320\273\321\203\320\261\320\260\321\217 \321\202\321\221\320\274\320\275\320\260\321\217.ini" +++ "b/Emook_code/Resourses/styles/\320\223\320\276\320\273\321\203\320\261\320\260\321\217 \321\202\321\221\320\274\320\275\320\260\321\217.ini" @@ -18,11 +18,13 @@ settingsbutton = [Fond] title = listwidget = -comboboxsearch = +search_name_button = +search_name_line = +search_num_button = +search_num_line = labelsearch = backbutton = labelsearch_2 = -comboboxsearch_2 = refreshbutton = exporthbutton = importbutton = diff --git "a/Emook_code/Resourses/styles/\320\244\320\270\320\276\320\273\320\265\321\202\320\276\320\262\320\260\321\217 \321\201\320\262\320\265\321\202\320\273\320\260\321\217.ini" "b/Emook_code/Resourses/styles/\320\244\320\270\320\276\320\273\320\265\321\202\320\276\320\262\320\260\321\217 \321\201\320\262\320\265\321\202\320\273\320\260\321\217.ini" index 344fd6d..5f6ae9e 100644 --- "a/Emook_code/Resourses/styles/\320\244\320\270\320\276\320\273\320\265\321\202\320\276\320\262\320\260\321\217 \321\201\320\262\320\265\321\202\320\273\320\260\321\217.ini" +++ "b/Emook_code/Resourses/styles/\320\244\320\270\320\276\320\273\320\265\321\202\320\276\320\262\320\260\321\217 \321\201\320\262\320\265\321\202\320\273\320\260\321\217.ini" @@ -18,11 +18,13 @@ settingsbutton = [Fond] title = listwidget = -comboboxsearch = +search_name_button = +search_name_line = +search_num_button = +search_num_line = labelsearch = backbutton = labelsearch_2 = -comboboxsearch_2 = refreshbutton = exporthbutton = importbutton = diff --git "a/Emook_code/Resourses/styles/\320\244\320\270\320\276\320\273\320\265\321\202\320\276\320\262\320\260\321\217 \321\202\321\221\320\274\320\275\320\260\321\217.ini" "b/Emook_code/Resourses/styles/\320\244\320\270\320\276\320\273\320\265\321\202\320\276\320\262\320\260\321\217 \321\202\321\221\320\274\320\275\320\260\321\217.ini" index 0c66271..bb2ed5d 100644 --- "a/Emook_code/Resourses/styles/\320\244\320\270\320\276\320\273\320\265\321\202\320\276\320\262\320\260\321\217 \321\202\321\221\320\274\320\275\320\260\321\217.ini" +++ "b/Emook_code/Resourses/styles/\320\244\320\270\320\276\320\273\320\265\321\202\320\276\320\262\320\260\321\217 \321\202\321\221\320\274\320\275\320\260\321\217.ini" @@ -18,11 +18,13 @@ settingsbutton = [Fond] title = listwidget = -comboboxsearch = +search_name_button = +search_name_line = +search_num_button = +search_num_line = labelsearch = backbutton = labelsearch_2 = -comboboxsearch_2 = refreshbutton = exporthbutton = importbutton = diff --git "a/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/OriginUI/Fond.ui" "b/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/OriginUI/Fond.ui" index 1d38319..51e7a18 100644 --- "a/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/OriginUI/Fond.ui" +++ "b/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/OriginUI/Fond.ui" @@ -7,7 +7,7 @@ 0 0 606 - 569 + 579 @@ -41,7 +41,7 @@ 15 - 195 + 205 571 311 @@ -52,34 +52,13 @@ - - - - 20 - 100 - 561 - 22 - - - - - 11 - - - - true - - - - - 20 - 71 - 181 - 16 + 70 + 211 + 21 @@ -95,7 +74,7 @@ 15 - 520 + 530 131 31 @@ -113,9 +92,9 @@ 20 - 131 - 311 - 21 + 130 + 361 + 31 @@ -127,13 +106,13 @@ Поиск по номеру учётной записи - + - 20 - 160 - 561 - 22 + 460 + 530 + 131 + 31 @@ -141,19 +120,34 @@ 11 - - true + + Обновить - - + + + + + 310 + 530 + 141 + 31 + + + + + 11 + + + + Экспортировать - + - 460 - 520 - 131 + 160 + 530 + 141 31 @@ -163,15 +157,15 @@ - Обновить + Импортировать - + - 320 - 520 - 131 + 490 + 95 + 93 31 @@ -181,15 +175,28 @@ - Экспортировать + Поиск - + - 180 - 520 - 131 + 20 + 100 + 461 + 22 + + + + + + + + + + 490 + 165 + 93 31 @@ -199,7 +206,20 @@ - Импортировать + Поиск + + + + + + 20 + 170 + 461 + 22 + + + + diff --git "a/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/Fond.ui" "b/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/Fond.ui" index 1d38319..cefdbd7 100644 --- "a/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/Fond.ui" +++ "b/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/Fond.ui" @@ -7,7 +7,7 @@ 0 0 606 - 569 + 604 @@ -20,9 +20,9 @@ 6 - 20 + 10 591 - 31 + 41 @@ -41,7 +41,7 @@ 15 - 195 + 235 571 311 @@ -52,34 +52,49 @@ - + 20 - 100 - 561 - 22 + 70 + 211 + 21 - 11 + 14 - - true + + Поиск на названию + + + + + + 15 + 560 + 131 + 31 + + + + + 11 + - - + + Назад - + 20 - 71 - 181 - 16 + 140 + 361 + 31 @@ -88,14 +103,14 @@ - Поиск на названию + Поиск по номеру учётной записи - + - 15 - 520 + 460 + 560 131 31 @@ -106,34 +121,34 @@ - Назад + Обновить - + - 20 - 131 - 311 - 21 + 310 + 560 + 141 + 31 - 14 + 11 - Поиск по номеру учётной записи + Экспортировать - + - 20 - 160 - 561 - 22 + 160 + 560 + 141 + 31 @@ -141,19 +156,16 @@ 11 - - true - - - + + Импортировать - + - 460 - 520 - 131 + 490 + 100 + 93 31 @@ -163,33 +175,33 @@ - Обновить + Поиск - + - 320 - 520 - 131 + 20 + 100 + 461 31 - 11 + 12 - Экспортировать + - + - 180 - 520 - 131 + 490 + 180 + 93 31 @@ -199,7 +211,25 @@ - Импортировать + Поиск + + + + + + 20 + 180 + 461 + 31 + + + + + 12 + + + + diff --git "a/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/Main.ui" "b/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/Main.ui" index b91be1c..3047021 100644 --- "a/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/Main.ui" +++ "b/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/Main.ui" @@ -7,7 +7,7 @@ 0 0 625 - 437 + 455 @@ -20,9 +20,9 @@ 10 - 20 + 10 591 - 81 + 91 @@ -42,8 +42,8 @@ 20 120 - 281 - 21 + 561 + 31 @@ -62,7 +62,7 @@ 460 - 345 + 355 141 31 @@ -80,7 +80,7 @@ 410 - 395 + 405 201 31 @@ -98,7 +98,7 @@ 10 - 400 + 410 101 31 @@ -116,7 +116,7 @@ 20 - 150 + 160 281 31 @@ -134,7 +134,7 @@ 310 - 150 + 160 281 31 @@ -152,7 +152,7 @@ 20 - 190 + 200 281 31 @@ -170,7 +170,7 @@ 310 - 190 + 200 281 31 @@ -188,7 +188,7 @@ 20 - 230 + 240 281 31 @@ -206,7 +206,7 @@ 310 - 230 + 240 281 31 @@ -224,7 +224,7 @@ 20 - 270 + 280 281 31 @@ -242,7 +242,7 @@ 310 - 270 + 280 281 31 @@ -260,7 +260,7 @@ 130 - 400 + 410 111 31 @@ -278,7 +278,7 @@ 20 - 310 + 320 111 31 diff --git "a/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/Settings.ui" "b/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/Settings.ui" index c2ac50e..9051fa6 100644 --- "a/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/Settings.ui" +++ "b/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/Settings.ui" @@ -35,7 +35,7 @@ 20 - 80 + 90 121 21 @@ -53,7 +53,7 @@ 20 - 110 + 120 261 22 @@ -70,7 +70,7 @@ 10 20 381 - 31 + 51 @@ -89,7 +89,7 @@ 20 - 190 + 200 261 22 @@ -104,8 +104,8 @@ 20 - 160 - 151 + 170 + 191 21 diff --git "a/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/Subselection.ui" "b/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/Subselection.ui" index 77ea0a9..671dd43 100644 --- "a/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/Subselection.ui" +++ "b/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/Subselection.ui" @@ -42,8 +42,8 @@ 20 120 - 321 - 21 + 411 + 31 @@ -80,7 +80,7 @@ 20 - 150 + 170 281 31 @@ -98,7 +98,7 @@ 310 - 150 + 170 281 31 @@ -116,7 +116,7 @@ 20 - 190 + 210 281 31 @@ -137,7 +137,7 @@ 310 - 190 + 210 281 31 diff --git "a/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/addDB.ui" "b/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/addDB.ui" index 25402e7..42690f1 100644 --- "a/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/addDB.ui" +++ "b/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/addDB.ui" @@ -55,7 +55,7 @@ 16 9 491 - 41 + 51 @@ -74,7 +74,7 @@ 20 - 110 + 120 481 31 @@ -94,7 +94,7 @@ 20 80 191 - 21 + 31 @@ -110,7 +110,7 @@ 20 - 190 + 200 481 31 @@ -130,7 +130,7 @@ 20 160 241 - 21 + 31 diff --git "a/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/addForm.ui" "b/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/addForm.ui" index 40f6895..d4feab0 100644 --- "a/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/addForm.ui" +++ "b/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/addForm.ui" @@ -7,7 +7,7 @@ 0 0 502 - 478 + 563 @@ -22,7 +22,7 @@ 10 15 481 - 31 + 41 @@ -41,9 +41,9 @@ 20 - 60 - 231 - 21 + 70 + 471 + 31 @@ -59,7 +59,7 @@ 20 - 90 + 120 471 31 @@ -94,9 +94,9 @@ 20 - 140 - 231 - 21 + 170 + 461 + 31 @@ -115,7 +115,7 @@ 20 - 170 + 210 471 31 @@ -147,9 +147,9 @@ 20 - 220 - 141 - 17 + 260 + 471 + 31 @@ -168,9 +168,9 @@ 20 - 250 - 271 - 17 + 300 + 471 + 31 @@ -192,7 +192,7 @@ 360 - 440 + 510 131 31 @@ -210,7 +210,7 @@ 10 - 440 + 510 131 31 @@ -228,7 +228,7 @@ 20 - 310 + 380 471 31 @@ -246,9 +246,9 @@ 20 - 280 - 291 - 21 + 340 + 471 + 31 @@ -264,9 +264,9 @@ 20 - 350 - 291 - 21 + 420 + 461 + 31 @@ -282,7 +282,7 @@ 20 - 380 + 460 471 31 diff --git "a/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/addFormPartTwo.ui" "b/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/addFormPartTwo.ui" index f8edeac..189c9ae 100644 --- "a/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/addFormPartTwo.ui" +++ "b/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/addFormPartTwo.ui" @@ -7,7 +7,7 @@ 0 0 502 - 479 + 499 @@ -43,7 +43,7 @@ 20 60 311 - 21 + 31 @@ -59,7 +59,7 @@ 20 - 90 + 100 471 31 @@ -77,9 +77,9 @@ 20 - 210 + 220 311 - 21 + 31 @@ -95,7 +95,7 @@ 20 - 240 + 260 471 171 @@ -110,9 +110,9 @@ 20 - 130 + 140 311 - 21 + 31 @@ -128,7 +128,7 @@ 20 - 160 + 180 471 31 @@ -146,7 +146,7 @@ 360 - 430 + 450 131 31 @@ -164,7 +164,7 @@ 10 - 430 + 450 131 31 diff --git "a/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/readFond.ui" "b/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/readFond.ui" index 6bed768..c63400b 100644 --- "a/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/readFond.ui" +++ "b/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/Workspace/readFond.ui" @@ -6,8 +6,8 @@ 0 0 - 502 - 658 + 1018 + 547 @@ -21,7 +21,7 @@ 10 15 - 481 + 991 31 @@ -31,7 +31,7 @@ - Добавить экспонат + Название Qt::AlignCenter @@ -42,7 +42,7 @@ 20 60 - 121 + 131 31 @@ -63,7 +63,7 @@ 20 90 - 231 + 271 31 @@ -80,8 +80,8 @@ 20 - 180 - 211 + 220 + 261 31 @@ -98,9 +98,9 @@ 20 - 230 + 300 311 - 21 + 31 @@ -115,10 +115,10 @@ - 20 - 370 - 311 - 21 + 510 + 70 + 321 + 31 @@ -134,7 +134,7 @@ 20 - 300 + 380 311 21 @@ -151,7 +151,7 @@ - 140 + 160 60 341 31 @@ -172,9 +172,9 @@ - 250 - 90 - 241 + 20 + 130 + 381 31 @@ -191,7 +191,7 @@ 20 - 140 + 180 471 21 @@ -208,8 +208,8 @@ - 240 - 180 + 20 + 260 251 31 @@ -227,7 +227,7 @@ 20 - 260 + 340 471 21 @@ -245,7 +245,7 @@ 20 - 330 + 410 471 21 @@ -262,10 +262,10 @@ - 20 - 400 - 461 - 192 + 510 + 110 + 491 + 331 @@ -284,8 +284,8 @@ p, li { white-space: pre-wrap; } - 370 - 610 + 890 + 500 111 31 @@ -302,8 +302,8 @@ p, li { white-space: pre-wrap; } - 20 - 610 + 10 + 500 111 31 @@ -320,8 +320,8 @@ p, li { white-space: pre-wrap; } - 250 - 610 + 770 + 500 111 31 diff --git "a/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/start.py" "b/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/start.py" index 7a43ac2..36917d7 100644 --- "a/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/start.py" +++ "b/Emook_code/Resourses/\320\224\320\276\320\277 \320\277\321\200\320\276\320\263\320\260/start.py" @@ -86,11 +86,13 @@ def __init__(self): gg(self, gFont, 2) gg(self.Title, gFont) gg(self.listWidget, gFont) - gg(self.comboBoxSearch, gFont) + gg(self.search_name_button, gFont) + gg(self.search_name_line, gFont) gg(self.labelSearch, gFont) gg(self.backButton, gFont) gg(self.labelSearch_2, gFont) - gg(self.comboBoxSearch_2, gFont) + gg(self.search_num_button, gFont) + gg(self.search_num_line, gFont) gg(self.refreshButton, gFont) gg(self.exporthButton, gFont) gg(self.importButton, gFont) @@ -99,18 +101,19 @@ def __init__(self): gFont.append(str(self.labelSearch.font().pointSize())) gFont.append(str(self.labelSearch_2.font().pointSize())) gFont.append(str(self.listWidget.font().pointSize())) - gFont.append(str(self.comboBoxSearch.font().pointSize())) - gFont.append(str(self.comboBoxSearch_2.font().pointSize())) - + gFont.append(str(self.search_name_line.font().pointSize())) + gFont.append(str(self.search_num_line.font().pointSize())) styleSheets['Fond'] = { 'Title': self.Title.styleSheet(), 'listWidget': self.listWidget.styleSheet(), - 'comboBoxSearch': self.comboBoxSearch.styleSheet(), + 'search_name_button': self.search_name_button.styleSheet(), + 'search_name_line': self.search_name_line.styleSheet(), + 'search_num_button': self.search_name_button.styleSheet(), + 'search_num_line': self.search_name_line.styleSheet(), 'labelSearch': self.labelSearch.styleSheet(), 'backButton': self.backButton.styleSheet(), 'labelSearch_2': self.labelSearch_2.styleSheet(), - 'comboBoxSearch_2': self.comboBoxSearch_2.styleSheet(), 'refreshButton': self.refreshButton.styleSheet(), 'exporthButton': self.exporthButton.styleSheet(), 'importButton': self.importButton.styleSheet() @@ -462,198 +465,190 @@ def __init__(self): f = open('' + name + '_Geometry.ini', 'w', encoding ="utf8") - f.write('''[Main] -Window = {} -Title = {} -labelSelection = {} -allButton = {} -addButton = {} -exitButton = {} -pushButton_1 = {} -pushButton_2 = {} -pushButton_3 = {} -pushButton_4 = {} -pushButton_5 = {} -pushButton_6 = {} -pushButton_7 = {} -pushButton_8 = {} -pushButton_9 = {} -settingsButton = {} - -FontTitle = {} -FontlabelSelection = {} + f.write(f'''[Main] +Window = {gMain[0]} +Title = {gMain[1]} +labelSelection = {gMain[2]} +allButton = {gMain[3]} +addButton = {gMain[4]} +exitButton = {gMain[5]} +pushButton_1 = {gMain[6]} +pushButton_2 = {gMain[7]} +pushButton_3 = {gMain[8]} +pushButton_4 = {gMain[9]} +pushButton_5 = {gMain[10]} +pushButton_6 = {gMain[11]} +pushButton_7 = {gMain[12]} +pushButton_8 = {gMain[13]} +pushButton_9 = {gMain[14]} +settingsButton = {gMain[15]} + +FontTitle = {gMain[16]} +FontlabelSelection = {gMain[17]} [Fond] -Window = {} -Title = {} -listWidget = {} -comboBoxSearch = {} -labelSearch = {} -backButton = {} -labelSearch_2 = {} -comboBoxSearch_2 = {} -refreshButton = {} -exporthButton = {} -importButton = {} - -FontTitle = {} -FontlabelSearch = {} -FontlabelSearch_2 = {} -FontlistWidget = {} -FontcomboBoxSearch = {} -FontcomboBoxSearch_2 = {} +Window = {gFont[0]} +Title = {gFont[1]} +listWidget = {gFont[2]} +search_name_button = {gFont[3]} +search_name_line = {gFont[4]} +labelSearch = {gFont[5]} +backButton = {gFont[6]} +labelSearch_2 = {gFont[7]} +search_num_button = {gFont[8]} +search_num_line = {gFont[9]} +refreshButton = {gFont[10]} +exporthButton = {gFont[11]} +importButton = {gFont[12]} + +FontTitle = {gFont[13]} +FontlabelSearch = {gFont[14]} +FontlabelSearch_2 = {gFont[15]} +FontlistWidget = {gFont[16]} +Fontsearch_name_line = {gFont[17]} +Fontsearch_num_line = {gFont[18]} [addForm] -Window = {} -Title = {} -labelSelection = {} -Section = {} -labelSubselection = {} -Subselection = {} -radioButtonFond_1 = {} -radioButtonFond_2 = {} -nextButton = {} -backButton = {} -lineEditName = {} -labelName = {} -labelNumber = {} -lineEditNumber = {} - -FontTitle = {} -FontlabelSelection = {} -FontSection = {} -FontlabelSubselection = {} -FontSubselection = {} -FontradioButtonFond_1 = {} -FontradioButtonFond_2 = {} -FontlineEditName = {} -FontlabelName = {} -FontlabelNumber = {} -FontlineEditNumber = {} +Window = {gaddForm[0]} +Title = {gaddForm[1]} +labelSelection = {gaddForm[2]} +Section = {gaddForm[3]} +labelSubselection = {gaddForm[4]} +Subselection = {gaddForm[5]} +radioButtonFond_1 = {gaddForm[6]} +radioButtonFond_2 = {gaddForm[7]} +nextButton = {gaddForm[8]} +backButton = {gaddForm[9]} +lineEditName = {gaddForm[10]} +labelName = {gaddForm[11]} +labelNumber = {gaddForm[12]} +lineEditNumber = {gaddForm[13]} + +FontTitle = {gaddForm[14]} +FontlabelSelection = {gaddForm[15]} +FontSection = {gaddForm[16]} +FontlabelSubselection = {gaddForm[17]} +FontSubselection = {gaddForm[18]} +FontradioButtonFond_1 = {gaddForm[19]} +FontradioButtonFond_2 = {gaddForm[20]} +FontlineEditName = {gaddForm[21]} +FontlabelName = {gaddForm[22]} +FontlabelNumber = {gaddForm[23]} +FontlineEditNumber = {gaddForm[24]} [addFormPartTwo] -Window = {} -Title = {} -labelGifter = {} -lineEditGifter = {} -labelDescription = {} -textEditDescription = {} -labelPoint = {} -lineEditPoint = {} -saveButton = {} -backButton = {} - -FontTitle = {} -FontlabelGifter = {} -FontlineEditGifter = {} -FontlabelDescription = {} -FonttextEditDescription = {} -FontlabelPoint = {} -FontlineEditPoint = {} +Window = {gAFT[0]} +Title = {gAFT[1]} +labelGifter = {gAFT[2]} +lineEditGifter = {gAFT[3]} +labelDescription = {gAFT[4]} +textEditDescription = {gAFT[5]} +labelPoint = {gAFT[6]} +lineEditPoint = {gAFT[7]} +saveButton = {gAFT[8]} +backButton = {gAFT[9]} + +FontTitle = {gAFT[10]} +FontlabelGifter = {gAFT[11]} +FontlineEditGifter = {gAFT[12]} +FontlabelDescription = {gAFT[13]} +FonttextEditDescription = {gAFT[14]} +FontlabelPoint = {gAFT[15]} +FontlineEditPoint = {gAFT[16]} [UiSubselection] -Window = {} -Title = {} -labelSubselection = {} -backButton = {} -pushButton_1 = {} -pushButton_2 = {} -pushButton_3 = {} -pushButton_4 = {} - -FontTitle = {} -FontlabelSubselection = {} +Window = {gSS[0]} +Title = {gSS[1]} +labelSubselection = {gSS[2]} +backButton = {gSS[3]} +pushButton_1 = {gSS[4]} +pushButton_2 = {gSS[5]} +pushButton_3 = {gSS[6]} +pushButton_4 = {gSS[7]} + +FontTitle = {gSS[8]} +FontlabelSubselection = {gSS[9]} [UiReadForm] -Window = {} -Title = {} -titleSelection = {} -titleSubselection = {} -labelNumber = {} -labelGifter = {} -labelDescription = {} -labelPoint = {} -labelSelection = {} -labelSubselection = {} -labelTypeFond = {} -lableNumber = {} -lableGifter = {} -lablePoint = {} -textBrowserDescription = {} -pushButtonDelite = {} -pushButtonClose = {} -pushButtonEdit = {} - -FontTitle = {} -FonttitleSelection = {} -FonttitleSubselection = {} -FontlabelNumber = {} -FontlabelGifter = {} -FontlabelDescription = {} -FontlabelPoint = {} -FontlabelSelection = {} -FontlabelSubselection = {} -FontlabelTypeFond = {} -FontlableNumber = {} -FontlableGifter = {} -FontlablePoint = {} -FonttextBrowserDescription = {} +Window = {gRF[0]} +Title = {gRF[1]} +titleSelection = {gRF[2]} +titleSubselection = {gRF[3]} +labelNumber = {gRF[4]} +labelGifter = {gRF[5]} +labelDescription = {gRF[6]} +labelPoint = {gRF[7]} +labelSelection = {gRF[8]} +labelSubselection = {gRF[9]} +labelTypeFond = {gRF[10]} +lableNumber = {gRF[11]} +lableGifter = {gRF[12]} +lablePoint = {gRF[13]} +textBrowserDescription = {gRF[14]} +pushButtonDelite = {gRF[15]} +pushButtonClose = {gRF[16]} +pushButtonEdit = {gRF[17]} + +FontTitle = {gRF[18]} +FonttitleSelection = {gRF[19]} +FonttitleSubselection = {gRF[20]} +FontlabelNumber = {gRF[21]} +FontlabelGifter = {gRF[22]} +FontlabelDescription = {gRF[23]} +FontlabelPoint = {gRF[24]} +FontlabelSelection = {gRF[25]} +FontlabelSubselection = {gRF[26]} +FontlabelTypeFond = {gRF[27]} +FontlableNumber = {gRF[28]} +FontlableGifter = {gRF[29]} +FontlablePoint = {gRF[30]} +FonttextBrowserDescription = {gRF[31]} [UiSettings] -Window = {} -Title = {} -appyButton = {} -themeLabel = {} -themeComboBox = {} -geometryComboBox = {} -geometryLabel = {} - -FontTitle = {} -FontthemeLabel = {} -FontthemeComboBox = {} -FontgeometryLabel = {} -FontgeometryComboBox = {} +Window = {gSettings[0]} +Title = {gSettings[1]} +appyButton = {gSettings[2]} +themeLabel = {gSettings[3]} +themeComboBox = {gSettings[4]} +geometryComboBox = {gSettings[5]} +geometryLabel = {gSettings[6]} + +FontTitle = {gSettings[7]} +FontthemeLabel = {gSettings[8]} +FontthemeComboBox = {gSettings[9]} +FontgeometryLabel = {gSettings[10]} +FontgeometryComboBox = {gSettings[11]} [wSingIn] -Window = {} -Title = {} -listWidget = {} -editButton = {} -addButton = {} -removeButton = {} -exitButton = {} +Window = {gSI[0]} +Title = {gSI[1]} +listWidget = {gSI[2]} +editButton = {gSI[3]} +addButton = {gSI[4]} +removeButton = {gSI[5]} +exitButton = {gSI[6]} -FontTitle = {} -FontlistWidget = {} +FontTitle = {gSI[7]} +FontlistWidget = {gSI[8]} [wAddDB] -Window = {} -Title = {} -labelName = {} -lineName = {} -labelConnect = {} -lineConnect = {} -addButton = {} -closeButton = {} - -FontTitle = {} -FontlabelName = {} -FontlineName = {} -FontlabelConnect = {} -FontlineConnect = {} +Window = {gADB[0]} +Title = {gADB[1]} +labelName = {gADB[2]} +lineName = {gADB[3]} +labelConnect = {gADB[4]} +lineConnect = {gADB[5]} +addButton = {gADB[6]} +closeButton = {gADB[7]} + +FontTitle = {gADB[8]} +FontlabelName = {gADB[9]} +FontlineName = {gADB[10]} +FontlabelConnect = {gADB[11]} +FontlineConnect = {gADB[12]} [Additions] -ButtonFontPointSize = {}'''.format\ -(gMain[0], gMain[1], gMain[2], gMain[3], gMain[4], gMain[5], gMain[6], gMain[7], gMain[8], gMain[9], gMain[10], gMain[11], gMain[12], gMain[13], gMain[14], gMain[15], gMain[16], gMain[17],\ - gFont[0], gFont[1], gFont[2], gFont[3], gFont[4], gFont[5], gFont[6], gFont[7], gFont[8], gFont[9], gFont[10], gFont[11], gFont[12], gFont[13], gFont[14],gFont[15], gFont[16],\ - gaddForm[0], gaddForm[1], gaddForm[2], gaddForm[3], gaddForm[4], gaddForm[5], gaddForm[6], gaddForm[7], gaddForm[8], gaddForm[9], gaddForm[10], gaddForm[11], gaddForm[12], gaddForm[13], gaddForm[14], gaddForm[15], gaddForm[16], gaddForm[17], gaddForm[18], gaddForm[19], gaddForm[20], gaddForm[21], gaddForm[22], gaddForm[23], gaddForm[24],\ - gAFT[0], gAFT[1], gAFT[2], gAFT[3], gAFT[4], gAFT[5], gAFT[6], gAFT[7], gAFT[8], gAFT[9], gAFT[10], gAFT[11], gAFT[12], gAFT[13], gAFT[14], gAFT[15], gAFT[16],\ - gSS[0], gSS[1], gSS[2], gSS[3], gSS[4], gSS[5], gSS[6], gSS[7], gSS[8], gSS[9],\ - gRF[0], gRF[1], gRF[2], gRF[3], gRF[4], gRF[5], gRF[6], gRF[7], gRF[8], gRF[9], gRF[10], gRF[11], gRF[12], gRF[13], gRF[14], gRF[15], gRF[16], gRF[17], gRF[18], gRF[19], gRF[20], gRF[21], gRF[22], gRF[23], gRF[24], gRF[25], gRF[26], gRF[27], gRF[28], gRF[29], gRF[30], gRF[31],\ - gSettings[0], gSettings[1], gSettings[2], gSettings[3], gSettings[4], gSettings[5], gSettings[6], gSettings[7], gSettings[8], gSettings[9], gSettings[10], gSettings[11],\ - gSI[0],gSI[1],gSI[2],gSI[3],gSI[4],gSI[5],gSI[6],gSI[7],gSI[8],\ - gADB[0],gADB[1],gADB[2],gADB[3],gADB[4],gADB[5],gADB[6],gADB[7],gADB[8],gADB[9],gADB[10],gADB[11],gADB[12],\ - buttonPointSize)) +ButtonFontPointSize = {buttonPointSize}''') f.close() styleSheets['WindowStyles'] = { diff --git a/Emook_code/main.py b/Emook_code/main.py index 906a4cb..2aac289 100644 --- a/Emook_code/main.py +++ b/Emook_code/main.py @@ -2,6 +2,9 @@ import os import os.path import sys +import logging +from logging.handlers import RotatingFileHandler +import traceback from PyQt5 import QtCore, QtGui, QtWidgets # Сторонние from PyQt5.QtWidgets import QMessageBox @@ -21,6 +24,8 @@ from Settings import Ui_Settings from singin import Ui_SingIn from addDB import Ui_addDB +from search import thefuzz_search +from search import thefuzz_search_id def themeSelect(i=1): global config @@ -48,7 +53,8 @@ def themeSelect(i=1): ButtonFontPointSize = QtGui.QFont() # Получение размера шрифта для всех кнопок ButtonFontPointSize.setPointSize(int(geometry['Additions']['ButtonFontPointSize'])) - except: + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) ButtonFontPointSize.setPointSize(11) geometry = None config['Settings']['geometry'] = 'Стандарт' @@ -61,12 +67,34 @@ def themeSelect(i=1): try: # Добавляю css styleSheets = configparser.ConfigParser() # Открытие файла с стилями объектов styleSheets.read('Resourses\\styles\\' + config['Settings']['theme'] + '.ini', encoding ="utf8") - except: - pass + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) logo = 'Resourses\\logo.png' -themeSelect() +log_file_name = 'Resourses\\log_records.csv' + +if not(os.path.isdir("./Resourses")): + os.makedirs('Resourses') + os.makedirs('Resourses\\Geometry') + os.makedirs('Resourses\\styles') + +if not(os.path.exists(log_file_name)): + with open(log_file_name, 'a+', encoding='utf-8') as f: + f.write('timestamp,status,"text"\n') + +logging.basicConfig(handlers=[RotatingFileHandler( # Делаю настройки log файла + filename=log_file_name, encoding='utf-8', mode='a+', maxBytes=1100000, backupCount=2)], + format=f'%(asctime)s,%(levelname)s,"%(message)s"', + datefmt="%F %T", + level=logging.DEBUG) + +logging.info('Starting...') + +try: + themeSelect() +except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def cgs(select, subselect, num): # Передача геометрии объектов сразу в переменные geoList = list(map(int, geometry[select][subselect].split(', '))) @@ -85,8 +113,8 @@ def messageBox(title, text, icon=None): # Окно ошибки icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) msgBox.setWindowIcon(icon) - except: - pass + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec() @@ -96,358 +124,417 @@ def restart(): class main(Ui_Main): def setupUi(self, main): - Ui_Main.setupUi(self, main) try: - main.setStyleSheet(styleSheets['WindowStyles']['Main']) - except: - pass + logging.info(f'{self.__class__.__name__} - setupUI') + Ui_Main.setupUi(self, main) + try: + main.setStyleSheet(styleSheets['WindowStyles']['Main']) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: # Добавляю иконку - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) - main.setWindowIcon(icon) - except: - pass + try: # Добавляю иконку + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) + main.setWindowIcon(icon) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - w, h = cgs('Main', 'Window', 2) # Установка геометрии для окна - main.resize(w, h) - main.setMaximumSize(w, h) - - x, y, w, h = cgs('Main', 'Title', 4) # Установка геометрии для разных объектов (кнопки и т.д.) - self.Title.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Main', 'labelSelection', 4) - self.labelSelection.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Main', 'allButton', 4) - self.allButton.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Main', 'addButton', 4) - self.addButton.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Main', 'exitButton', 4) - self.exitButton.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Main', 'pushButton_1', 4) - self.pushButton_1.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Main', 'pushButton_2', 4) - self.pushButton_2.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Main', 'pushButton_3', 4) - self.pushButton_3.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Main', 'pushButton_4', 4) - self.pushButton_4.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Main', 'pushButton_5', 4) - self.pushButton_5.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Main', 'pushButton_6', 4) - self.pushButton_6.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Main', 'pushButton_7', 4) - self.pushButton_7.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Main', 'pushButton_8', 4) - self.pushButton_8.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Main', 'pushButton_9', 4) - self.pushButton_9.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Main', 'settingsButton', 4) - self.settingsButton.setGeometry(QtCore.QRect(x, y, w, h)) - - self.allButton.setFont(ButtonFontPointSize) # Устанавливаю размер шрифта на объекты - self.addButton.setFont(ButtonFontPointSize) - self.exitButton.setFont(ButtonFontPointSize) - self.settingsButton.setFont(ButtonFontPointSize) - self.pushButton_1.setFont(ButtonFontPointSize) - self.pushButton_2.setFont(ButtonFontPointSize) - self.pushButton_3.setFont(ButtonFontPointSize) - self.pushButton_4.setFont(ButtonFontPointSize) - self.pushButton_5.setFont(ButtonFontPointSize) - self.pushButton_6.setFont(ButtonFontPointSize) - self.pushButton_7.setFont(ButtonFontPointSize) - self.pushButton_8.setFont(ButtonFontPointSize) - self.pushButton_9.setFont(ButtonFontPointSize) - - font = QtGui.QFont() - font.setPointSize(int(geometry['Main']['FontTitle'])) - self.Title.setFont(font) - font.setPointSize(int(geometry['Main']['FontlabelSelection'])) - self.labelSelection.setFont(font) - except: - pass + try: + w, h = cgs('Main', 'Window', 2) # Установка геометрии для окна + main.resize(w, h) + main.setMaximumSize(w, h) + + x, y, w, h = cgs('Main', 'Title', 4) # Установка геометрии для разных объектов (кнопки и т.д.) + self.Title.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Main', 'labelSelection', 4) + self.labelSelection.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Main', 'allButton', 4) + self.allButton.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Main', 'addButton', 4) + self.addButton.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Main', 'exitButton', 4) + self.exitButton.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Main', 'pushButton_1', 4) + self.pushButton_1.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Main', 'pushButton_2', 4) + self.pushButton_2.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Main', 'pushButton_3', 4) + self.pushButton_3.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Main', 'pushButton_4', 4) + self.pushButton_4.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Main', 'pushButton_5', 4) + self.pushButton_5.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Main', 'pushButton_6', 4) + self.pushButton_6.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Main', 'pushButton_7', 4) + self.pushButton_7.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Main', 'pushButton_8', 4) + self.pushButton_8.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Main', 'pushButton_9', 4) + self.pushButton_9.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Main', 'settingsButton', 4) + self.settingsButton.setGeometry(QtCore.QRect(x, y, w, h)) + + self.allButton.setFont(ButtonFontPointSize) # Устанавливаю размер шрифта на объекты + self.addButton.setFont(ButtonFontPointSize) + self.exitButton.setFont(ButtonFontPointSize) + self.settingsButton.setFont(ButtonFontPointSize) + self.pushButton_1.setFont(ButtonFontPointSize) + self.pushButton_2.setFont(ButtonFontPointSize) + self.pushButton_3.setFont(ButtonFontPointSize) + self.pushButton_4.setFont(ButtonFontPointSize) + self.pushButton_5.setFont(ButtonFontPointSize) + self.pushButton_6.setFont(ButtonFontPointSize) + self.pushButton_7.setFont(ButtonFontPointSize) + self.pushButton_8.setFont(ButtonFontPointSize) + self.pushButton_9.setFont(ButtonFontPointSize) + + font = QtGui.QFont() + font.setPointSize(int(geometry['Main']['FontTitle'])) + self.Title.setFont(font) + font.setPointSize(int(geometry['Main']['FontlabelSelection'])) + self.labelSelection.setFont(font) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - self.Title.setStyleSheet(str(styleSheets['Main']['Title'])) - self.labelSelection.setStyleSheet(str(styleSheets['Main']['labelSelection'])) - self.allButton.setStyleSheet(str(styleSheets['Main']['allButton'])) - self.addButton.setStyleSheet(str(styleSheets['Main']['addButton'])) - self.exitButton.setStyleSheet(str(styleSheets['Main']['exitButton'])) - self.settingsButton.setStyleSheet(str(styleSheets['Main']['settingsButton'])) - self.pushButton_1.setStyleSheet(str(styleSheets['Main']['pushButton_1'])) - self.pushButton_2.setStyleSheet(str(styleSheets['Main']['pushButton_2'])) - self.pushButton_3.setStyleSheet(str(styleSheets['Main']['pushButton_3'])) - self.pushButton_4.setStyleSheet(str(styleSheets['Main']['pushButton_4'])) - self.pushButton_5.setStyleSheet(str(styleSheets['Main']['pushButton_5'])) - self.pushButton_6.setStyleSheet(str(styleSheets['Main']['pushButton_6'])) - self.pushButton_7.setStyleSheet(str(styleSheets['Main']['pushButton_7'])) - self.pushButton_8.setStyleSheet(str(styleSheets['Main']['pushButton_8'])) - self.pushButton_9.setStyleSheet(str(styleSheets['Main']['pushButton_9'])) - except: - pass - - self.addButton.clicked.connect(lambda: self.addFormOpen()) #Добаляю функции к кнопкам - self.pushButton_1.clicked.connect(lambda: self.selectionClicked(self.pushButton_1.text())) - self.pushButton_2.clicked.connect(lambda: self.selectionClicked(self.pushButton_2.text())) - self.pushButton_3.clicked.connect(lambda: self.selectionClicked(self.pushButton_3.text())) - self.pushButton_4.clicked.connect(lambda: self.selectionClicked(self.pushButton_4.text())) - self.pushButton_5.clicked.connect(lambda: self.selectionClicked(self.pushButton_5.text())) - self.pushButton_6.clicked.connect(lambda: self.selectionClicked(self.pushButton_6.text())) - self.pushButton_7.clicked.connect(lambda: self.selectionClicked(self.pushButton_7.text())) - self.pushButton_8.clicked.connect(lambda: self.selectionClicked(self.pushButton_8.text())) - self.pushButton_9.clicked.connect(lambda: self.selectionClicked(self.pushButton_9.text())) - self.allButton.clicked.connect(lambda: self.selectionClicked(self.allButton.text())) - self.settingsButton.clicked.connect(lambda: self.settingsOpen()) - self.exitButton.clicked.connect(lambda: self.back()) + try: + self.Title.setStyleSheet(str(styleSheets['Main']['Title'])) + self.labelSelection.setStyleSheet(str(styleSheets['Main']['labelSelection'])) + self.allButton.setStyleSheet(str(styleSheets['Main']['allButton'])) + self.addButton.setStyleSheet(str(styleSheets['Main']['addButton'])) + self.exitButton.setStyleSheet(str(styleSheets['Main']['exitButton'])) + self.settingsButton.setStyleSheet(str(styleSheets['Main']['settingsButton'])) + self.pushButton_1.setStyleSheet(str(styleSheets['Main']['pushButton_1'])) + self.pushButton_2.setStyleSheet(str(styleSheets['Main']['pushButton_2'])) + self.pushButton_3.setStyleSheet(str(styleSheets['Main']['pushButton_3'])) + self.pushButton_4.setStyleSheet(str(styleSheets['Main']['pushButton_4'])) + self.pushButton_5.setStyleSheet(str(styleSheets['Main']['pushButton_5'])) + self.pushButton_6.setStyleSheet(str(styleSheets['Main']['pushButton_6'])) + self.pushButton_7.setStyleSheet(str(styleSheets['Main']['pushButton_7'])) + self.pushButton_8.setStyleSheet(str(styleSheets['Main']['pushButton_8'])) + self.pushButton_9.setStyleSheet(str(styleSheets['Main']['pushButton_9'])) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) + + self.addButton.clicked.connect(lambda: self.addFormOpen()) #Добаляю функции к кнопкам + self.pushButton_1.clicked.connect(lambda: self.selectionClicked(self.pushButton_1.text())) + self.pushButton_2.clicked.connect(lambda: self.selectionClicked(self.pushButton_2.text())) + self.pushButton_3.clicked.connect(lambda: self.selectionClicked(self.pushButton_3.text())) + self.pushButton_4.clicked.connect(lambda: self.selectionClicked(self.pushButton_4.text())) + self.pushButton_5.clicked.connect(lambda: self.selectionClicked(self.pushButton_5.text())) + self.pushButton_6.clicked.connect(lambda: self.selectionClicked(self.pushButton_6.text())) + self.pushButton_7.clicked.connect(lambda: self.selectionClicked(self.pushButton_7.text())) + self.pushButton_8.clicked.connect(lambda: self.selectionClicked(self.pushButton_8.text())) + self.pushButton_9.clicked.connect(lambda: self.selectionClicked(self.pushButton_9.text())) + self.allButton.clicked.connect(lambda: self.selectionClicked(self.allButton.text())) + self.settingsButton.clicked.connect(lambda: self.settingsOpen()) + self.exitButton.clicked.connect(lambda: self.back()) + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def retranslateUi(self, main): - _translate = QtCore.QCoreApplication.translate - Ui_Main.retranslateUi(self, main) - Main.setWindowTitle("Учёт музейных фондов") - self.exitButton.setText("Назад") + logging.info(f'{self.__class__.__name__} - retranslateUi') + try: + Ui_Main.retranslateUi(self, main) + Main.setWindowTitle("Учёт музейных фондов") + self.exitButton.setText("Назад") + self.Title.setText('Учёт музейных фондов') - self.Title.setText('Учёт музейных фондов') + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def setTitle(self, main, name): + logging.info(f'{self.__class__.__name__} - setTitle') Main.setWindowTitle("Учёт музейных фондов - " + name) def back(self): - Main.close() - winEditDB.close() - winAddDB.close() - wineditFormTwo.close() - wineditForm.close() - winaddFormTwo.close() - winForm.close() - try: - winSubselection.close() - except: - pass + logging.info(f'{self.__class__.__name__} - back') try: - readForm.close() - except: - pass + Main.close() + winEditDB.close() + winAddDB.close() + wineditFormTwo.close() + wineditForm.close() + winaddFormTwo.close() + winForm.close() + try: + winSubselection.close() + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) + try: + readForm.close() + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - winSingIn.show() + winSingIn.show() + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def selectionClicked(self, selection): ''' Открытие нужного окна (если это раздел имеет подраздел, то открывается окно выбора подраздела) ''' - global selectionMain - global subselectionMain - global winFond - global winSubselection - - selectionMain = selection - subselectionMain = '' - - Main.hide() - - if selection == 'Изобразительные памятники' or selection == 'Нумизматика' or selection == 'Предметы этнографии' or selection == 'Предметы печатной продукции': - winSubselection = QtWidgets.QWidget() - uiSubselection = UiSubselection() - uiSubselection.setupUi(winSubselection) - winSubselection.show() - - elif selection == 'Археология' or selection == 'Оружие' or selection == 'Документы, фотографии' or selection == 'Предметы исторической техники' or selection == 'Все' or 'Прочее': - winFond = QtWidgets.QWidget() - uiFond = Fond() - uiFond.setupUi(winFond) + try: + logging.info(f'{self.__class__.__name__} - selectionClicked') + global selectionMain + global subselectionMain + global winFond + global winSubselection + + selectionMain = selection + subselectionMain = '' + + Main.hide() + + if selection == 'Изобразительные памятники' or selection == 'Нумизматика' or selection == 'Предметы этнографии' or selection == 'Предметы печатной продукции': + winSubselection = QtWidgets.QWidget() + uiSubselection = UiSubselection() + uiSubselection.setupUi(winSubselection) + winSubselection.show() + + elif selection == 'Археология' or selection == 'Оружие' or selection == 'Документы, фотографии' or selection == 'Предметы исторической техники' or selection == 'Все' or 'Прочее': + winFond = QtWidgets.QWidget() + uiFond = Fond() + uiFond.setupUi(winFond) + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def addFormOpen(self): - Main.hide() + try: + logging.info(f'{self.__class__.__name__} - addFormOpen') + Main.hide() - addForm.setupUi(salf, salfmain) - addFormPartTwo.setupUi(salk, salkmain) - winForm.show() + addForm.setupUi(salf, salfmain) + addFormPartTwo.setupUi(salk, salkmain) + winForm.show() + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def settingsOpen(self): - global Settings - Settings = QtWidgets.QWidget() - winSettings = UiSettings() - winSettings.setupUi(Settings) - Settings.show() + try: + logging.info(f'{self.__class__.__name__} - settingsOpen') + global Settings + Settings = QtWidgets.QWidget() + winSettings = UiSettings() + winSettings.setupUi(Settings) + Settings.show() + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл class Fond(Ui_Fond): def setupUi(self, main): - Ui_Fond.setupUi(self, main) try: - main.setStyleSheet(styleSheets['WindowStyles']['Fond']) - except: - pass - - try: # Установка иконки - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) - main.setWindowIcon(icon) - except: - pass + logging.info(f'{self.__class__.__name__} - setupUi') + Ui_Fond.setupUi(self, main) + try: + main.setStyleSheet(styleSheets['WindowStyles']['Fond']) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - w, h = cgs('Fond', 'Window', 2) # Установка геометрии объектам - main.resize(w, h) - main.setMaximumSize(w, h) - - x, y, w, h = cgs('Fond', 'Title', 4) - self.Title.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Fond', 'listWidget', 4) - self.listWidget.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Fond', 'comboBoxSearch', 4) - self.comboBoxSearch.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Fond', 'labelSearch', 4) - self.labelSearch.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Fond', 'backButton', 4) - self.backButton.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Fond', 'labelSearch_2', 4) - self.labelSearch_2.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Fond', 'comboBoxSearch_2', 4) - self.comboBoxSearch_2.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Fond', 'refreshButton', 4) - self.refreshButton.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Fond', 'exporthButton', 4) - self.exporthButton.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('Fond', 'importButton', 4) - self.importButton.setGeometry(QtCore.QRect(x, y, w, h)) - - font = QtGui.QFont() # Установка размера шрифта - font.setPointSize(int(geometry['Fond']['FontTitle'])) - self.Title.setFont(font) - font.setPointSize(int(geometry['Fond']['FontlabelSearch'])) - self.labelSearch.setFont(font) - font.setPointSize(int(geometry['Fond']['FontlabelSearch_2'])) - self.labelSearch_2.setFont(font) - font.setPointSize(int(geometry['Fond']['FontlistWidget'])) - self.listWidget.setFont(font) - - font.setPointSize(int(geometry['Fond']['FontcomboBoxSearch'])) - self.comboBoxSearch.setFont(font) - font.setPointSize(int(geometry['Fond']['FontcomboBoxSearch_2'])) - self.comboBoxSearch_2.setFont(font) - - self.backButton.setFont(ButtonFontPointSize) - self.refreshButton.setFont(ButtonFontPointSize) - self.exporthButton.setFont(ButtonFontPointSize) - self.importButton.setFont(ButtonFontPointSize) - except: - pass + try: # Установка иконки + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) + main.setWindowIcon(icon) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - self.Title.setStyleSheet(str(styleSheets['Fond']['Title'])) - self.listWidget.setStyleSheet(str(styleSheets['Fond']['listWidget'])) - self.comboBoxSearch.setStyleSheet(str(styleSheets['Fond']['comboBoxSearch'])) - self.labelSearch.setStyleSheet(str(styleSheets['Fond']['labelSearch'])) - self.backButton.setStyleSheet(str(styleSheets['Fond']['backButton'])) - self.labelSearch_2.setStyleSheet(str(styleSheets['Fond']['labelSearch_2'])) - self.comboBoxSearch_2.setStyleSheet(str(styleSheets['Fond']['comboBoxSearch_2'])) - self.refreshButton.setStyleSheet(str(styleSheets['Fond']['refreshButton'])) - self.exporthButton.setStyleSheet(str(styleSheets['Fond']['exporthButton'])) - self.importButton.setStyleSheet(str(styleSheets['Fond']['importButton'])) - except: - pass - - # Добавление функций к объектам - self.comboBoxSearch.activated.connect(lambda: self.openInBox(self.comboBoxSearch.currentText())) - self.comboBoxSearch_2.activated.connect(lambda: self.openInBoxId(self.comboBoxSearch_2.currentText())) - self.listWidget.itemDoubleClicked.connect(self.openInList) - self.backButton.clicked.connect(lambda: self.mainOpen()) - self.refreshButton.clicked.connect(lambda: self.refresh()) - self.exporthButton.clicked.connect(lambda: self.save()) - self.importButton.clicked.connect(lambda: self.selectExel()) - - if subselectionMain != '': - self.Title.setText(selectionMain + ': ' + subselectionMain) - elif selectionMain == 'Все': - self.Title.setText('Все фонды') - else: - self.Title.setText(selectionMain) + try: + w, h = cgs('Fond', 'Window', 2) # Установка геометрии объектам + main.resize(w, h) + main.setMaximumSize(w, h) + + x, y, w, h = cgs('Fond', 'Title', 4) + self.Title.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Fond', 'listWidget', 4) + self.listWidget.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Fond', 'search_name_button', 4) + self.search_name_button.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Fond', 'search_name_line', 4) + self.search_name_line.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Fond', 'labelSearch', 4) + self.labelSearch.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Fond', 'backButton', 4) + self.backButton.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Fond', 'labelSearch_2', 4) + self.labelSearch_2.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Fond', 'search_num_button', 4) + self.search_num_button.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Fond', 'search_num_line', 4) + self.search_num_line.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Fond', 'refreshButton', 4) + self.refreshButton.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Fond', 'exporthButton', 4) + self.exporthButton.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('Fond', 'importButton', 4) + self.importButton.setGeometry(QtCore.QRect(x, y, w, h)) + + font = QtGui.QFont() # Установка размера шрифта + font.setPointSize(int(geometry['Fond']['FontTitle'])) + self.Title.setFont(font) + font.setPointSize(int(geometry['Fond']['FontlabelSearch'])) + self.labelSearch.setFont(font) + font.setPointSize(int(geometry['Fond']['FontlabelSearch_2'])) + self.labelSearch_2.setFont(font) + font.setPointSize(int(geometry['Fond']['FontlistWidget'])) + self.listWidget.setFont(font) + font.setPointSize(int(geometry['Fond']['Fontsearch_name_line'])) + self.search_name_line.setFont(font) + font.setPointSize(int(geometry['Fond']['Fontsearch_num_line'])) + self.search_num_line.setFont(font) + + self.backButton.setFont(ButtonFontPointSize) + self.refreshButton.setFont(ButtonFontPointSize) + self.exporthButton.setFont(ButtonFontPointSize) + self.importButton.setFont(ButtonFontPointSize) + self.search_name_button.setFont(ButtonFontPointSize) + self.search_num_button.setFont(ButtonFontPointSize) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) + + try: # Установка тем + self.Title.setStyleSheet(str(styleSheets['Fond']['Title'])) + self.listWidget.setStyleSheet(str(styleSheets['Fond']['listWidget'])) + self.search_name_button.setStyleSheet(str(styleSheets['Fond']['search_name_button'])) + self.search_name_line.setStyleSheet(str(styleSheets['Fond']['search_name_line'])) + self.search_num_button.setStyleSheet(str(styleSheets['Fond']['search_num_button'])) + self.search_num_line.setStyleSheet(str(styleSheets['Fond']['search_num_line'])) + self.labelSearch.setStyleSheet(str(styleSheets['Fond']['labelSearch'])) + self.backButton.setStyleSheet(str(styleSheets['Fond']['backButton'])) + self.labelSearch_2.setStyleSheet(str(styleSheets['Fond']['labelSearch_2'])) + self.refreshButton.setStyleSheet(str(styleSheets['Fond']['refreshButton'])) + self.exporthButton.setStyleSheet(str(styleSheets['Fond']['exporthButton'])) + self.importButton.setStyleSheet(str(styleSheets['Fond']['importButton'])) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) + + # Добавление функций к объектам + self.listWidget.itemDoubleClicked.connect(self.openInList) + self.search_name_button.clicked.connect(lambda: self.search_name(self.search_name_line.text())) + self.search_num_button.clicked.connect(lambda: self.search_num(self.search_num_line.text())) + self.backButton.clicked.connect(lambda: self.mainOpen()) + self.refreshButton.clicked.connect(lambda: self.refresh()) + self.exporthButton.clicked.connect(lambda: self.save()) + self.importButton.clicked.connect(lambda: self.selectExel()) + + if subselectionMain != '': + self.Title.setText(selectionMain + ': ' + subselectionMain) + elif selectionMain == 'Все': + self.Title.setText('Все фонды') + else: + self.Title.setText(selectionMain) - global collection - global select - global subselect - select = selectionMain - subselect = subselectionMain + global collection + global select + global subselect + select = selectionMain + subselect = subselectionMain - db = cluster['Все'] - collection = db['none'] + db = cluster['Все'] + collection = db['none'] - self.refresh(2) + self.refresh(2) - global fondSelf - fondSelf = self + global fondSelf + fondSelf = self + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def retranslateUi(self, main): + logging.info(f'{self.__class__.__name__} - retranslateUi') Ui_Fond.retranslateUi(self, main) main.setWindowTitle("Список экспонатов") def refresh(self, test='1'): # Обновление списка экспонатов - s = [] - if select == 'Все': - nameid = collection.find() - else: - nameid = collection.find({'select': select, 'subselect': subselect}) - - if test != '1': - winFond.show() - - global listItems - listItems = [] - listid = [] try: - for b in nameid: - s.append(b) - listItems.append(str(b['Name'])) - listid.append(str(b['number'])) + logging.info(f'{self.__class__.__name__} - refresh') + s = [] + if select == 'Все': + nameid = collection.find() + else: + nameid = collection.find({'select': select, 'subselect': subselect}) - self.listWidget.clear() - self.comboBoxSearch.clear() - self.comboBoxSearch_2.clear() - for i in range(len(listItems)): - if listid[i] != '': - self.listWidget.addItem(listItems[i] + ' №' + listid[i]) - self.comboBoxSearch.addItem(listItems[i]) - self.comboBoxSearch_2.addItem(listid[i]) - else: - self.listWidget.addItem(listItems[i]) - self.comboBoxSearch.addItem(listItems[i]) - - self.comboBoxSearch.setCurrentText("") - self.comboBoxSearch_2.setCurrentText("") - except: - winFond.close() - messageBox('Ошибка подключения', 'Не удалось открыть базу данных.') - Main.show() + if test != '1': + winFond.show() + + self.dic_Items = {} + self.listItems = [] + self.listid = [] + try: + for b in nameid: + s.append(b) + self.listItems.append(str(b['Name'])) + self.listid.append(str(b['number'])) + + self.listWidget.clear() + for i in range(len(self.listItems)): + if self.listid[i] != '': + self.listWidget.addItem(self.listItems[i] + ' №' + self.listid[i]) + self.dic_Items[self.listItems[i] + ' №' + self.listid[i]] = self.listItems[i] + else: + self.listWidget.addItem(self.listItems[i]) + self.dic_Items[self.listItems[i]] = self.listItems[i] + + except Exception: + winFond.close() + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл + messageBox('Ошибка подключения', 'Не удалось открыть базу данных.') + Main.show() + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def mainOpen(self): + logging.info(f'{self.__class__.__name__} - mainOpen') winFond.hide() Main.show() - - def openInBox(self, name): # Открытие по номеру учётной записи - self.comboBoxSearch.setCurrentText("") - self.open(name) + + def search_name(self, text): + try: + logging.info(f'{self.__class__.__name__} - search_name') + self.listWidget.clear() + sorted_items = thefuzz_search(self.listItems, text) + for item in range(len(sorted_items)): + for b in collection.find({'Name': sorted_items[item]}): + num = str(b['number']) + if num != '': + self.listWidget.addItem(sorted_items[item] + ' №' + num) + else: + self.listWidget.addItem(sorted_items[item]) + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл - def openInBoxId(self, id): # Открытие через поиск по названию + def search_num(self, id): # Открытие через поиск по номеру учю записи try: - self.comboBoxSearch_2.setCurrentText("") - nameid = collection.find() - for b in nameid: - if b['number'] == id: - name = b['Name'] - self.open(name) - except: - pass + logging.info(f'{self.__class__.__name__} - search_num') + self.listWidget.clear() + sorted_items = thefuzz_search_id(self.listid, id) + for item in range(len(sorted_items)): + for b in collection.find({'number': sorted_items[item]}): + Name = str(b['Name']) + self.listWidget.addItem(Name + ' №' + sorted_items[item]) + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл - def openInList(self): # Открытие со списка + def openInList(self, item): # Открытие со списка try: + logging.info(f'{self.__class__.__name__} - openInList') id = int(self.listWidget.currentRow()) - name = listItems[id] + name = self.dic_Items[item.text()] self.open(name) - except: - pass + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def open(self, name): # Открытие окнв с информацией о экспонате try: + logging.info(f'{self.__class__.__name__} - open') wineditFormTwo.hide() wineditForm.hide() global forread @@ -471,1099 +558,1232 @@ def open(self, name): # Открытие окнв с информацией о uiRead = UiReadForm() uiRead.setupUi(readForm) readForm.show() - except: - pass + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def getList(self, way): # Получает таблицу exel с базы данных - exlName = [] - exlFond = [] - exlSelect = [] - exlSubselect = [] - exlNumber = [] - exlGifter = [] - exlPoint = [] - exlDesc = [] - - if select == 'Все': - nameid = collection.find() - else: - nameid = collection.find({'select': select, 'subselect': subselect}) - for b in nameid: - exlName.append(b['Name']) - exlFond.append(b['fonds']) - exlSelect.append(b['select']) - exlSubselect.append(b['subselect']) - exlNumber.append(b['number']) - exlGifter.append(b['gifter']) - exlPoint.append(b['point']) - exlDesc.append(b['description']) - - df = pd.DataFrame({ - 'Название': exlName, - 'Номер': exlNumber, - 'Фонд': exlFond, - 'Раздел': exlSelect, - 'Подраздел': exlSubselect, - 'Даритель': exlGifter, - 'Место хранения': exlPoint, - 'Описание': exlDesc - }) - df.to_excel(way, sheet_name='Данные экспонатов', index=False) + try: + logging.info(f'{self.__class__.__name__} - getList') + exlName = [] + exlFond = [] + exlSelect = [] + exlSubselect = [] + exlNumber = [] + exlGifter = [] + exlPoint = [] + exlDesc = [] + + if select == 'Все': + nameid = collection.find() + else: + nameid = collection.find({'select': select, 'subselect': subselect}) + for b in nameid: + exlName.append(b['Name']) + exlFond.append(b['fonds']) + exlSelect.append(b['select']) + exlSubselect.append(b['subselect']) + exlNumber.append(b['number']) + exlGifter.append(b['gifter']) + exlPoint.append(b['point']) + exlDesc.append(b['description']) + + df = pd.DataFrame({ + 'Название': exlName, + 'Номер': exlNumber, + 'Фонд': exlFond, + 'Раздел': exlSelect, + 'Подраздел': exlSubselect, + 'Даритель': exlGifter, + 'Место хранения': exlPoint, + 'Описание': exlDesc + }) + df.to_excel(way, sheet_name='Данные экспонатов', index=False) + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def setList(self, way): # Загружает экспонату с таблицы exel в базу данных - exl = openpyxl.open(r''+ way, read_only=True) - sheet = exl.active - - post = [] - for row in range(2, int(sheet.max_row)+1): - Name = str(sheet[row][0].value) - number = str(sheet[row][1].value) - if number == 'None': - number = '' - fonds = str(sheet[row][2].value) - selection = str(sheet[row][3].value) - - subselection = str(sheet[row][4].value) - if subselection == 'None': - subselection = '' - - gifter = str(sheet[row][5].value) - if gifter == 'None': - gifter = '' - point = str(sheet[row][6].value) - if str(point) == 'None': - point = '' - description = str(sheet[row][7].value) - if str(description) == 'None': - description = '' + try: + logging.info(f'{self.__class__.__name__} - setList') + exl = openpyxl.open(r''+ way, read_only=True) + sheet = exl.active + + post = [] + for row in range(2, int(sheet.max_row)+1): + Name = str(sheet[row][0].value) + number = str(sheet[row][1].value) + if number == 'None': + number = '' + fonds = str(sheet[row][2].value) + selection = str(sheet[row][3].value) + + subselection = str(sheet[row][4].value) + if subselection == 'None': + subselection = '' + + gifter = str(sheet[row][5].value) + if gifter == 'None': + gifter = '' + point = str(sheet[row][6].value) + if str(point) == 'None': + point = '' + description = str(sheet[row][7].value) + if str(description) == 'None': + description = '' - post = {'fonds': fonds, 'select': selection, 'subselect': subselection , 'Name': Name, 'number': number, 'gifter': gifter, 'point': point, 'description': description} + post = {'fonds': fonds, 'select': selection, 'subselect': subselection , 'Name': Name, 'number': number, 'gifter': gifter, 'point': point, 'description': description} - db = cluster['Все'] - collection = db['none'] - collection.delete_one({'Name': Name}) - collection.insert_one(post) + db = cluster['Все'] + collection = db['none'] + collection.delete_one({'Name': Name}) + collection.insert_one(post) - exl._archive.close() - messageBox('Готово', 'Таблица загружена в базу данных') - self.refresh() + exl._archive.close() + messageBox('Готово', 'Таблица загружена в базу данных') + self.refresh() + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def selectExel(self): # Выбор файла таблицы exel - way, _ = QFileDialog.getOpenFileName(None, 'Выбрать файл', './', "Exel таблица (*.xlsx)") - if way != '': - thread = threading.Thread(target=self.setList(way)) - thread.start() + try: + logging.info(f'{self.__class__.__name__} - selectExel') + way, _ = QFileDialog.getOpenFileName(None, 'Выбрать файл', './', "Exel таблица (*.xlsx)") + if way != '': + thread = threading.Thread(target=self.setList(way)) + thread.start() + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def save(self): # Выбор места сохранения таблицы exel - way, _ = QtWidgets.QFileDialog.getSaveFileName(None, 'Save File',"Данные экспонатов.xlsx", 'Exel таблица (*.xlsx)') - if way != '': - thread = threading.Thread(target=self.getList(way)) - thread.start() + try: + logging.info(f'{self.__class__.__name__} - save') + way, _ = QtWidgets.QFileDialog.getSaveFileName(None, 'Save File',"Данные экспонатов.xlsx", 'Exel таблица (*.xlsx)') + if way != '': + thread = threading.Thread(target=self.getList(way)) + thread.start() + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл class addForm(Ui_addForm): def setupUi(self, main): - Ui_addForm.setupUi(self, main) try: - main.setStyleSheet(styleSheets['WindowStyles']['addForm']) - except: - pass + logging.info(f'{self.__class__.__name__} - setupUi') + Ui_addForm.setupUi(self, main) + try: + main.setStyleSheet(styleSheets['WindowStyles']['addForm']) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: # Установка иконки - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) - main.setWindowIcon(icon) - except: - pass + try: # Установка иконки + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) + main.setWindowIcon(icon) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - w, h = cgs('addForm', 'Window', 2) # Установка геометрии объектам - main.resize(w, h) - main.setMaximumSize(w, h) - - x, y, w, h = cgs('addForm', 'Title', 4) - self.Title.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'labelSelection', 4) - self.labelSelection.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'Section', 4) - self.Section.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'labelSubselection', 4) - self.labelSubselection.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'Subselection', 4) - self.Subselection.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'radioButtonFond_1', 4) - self.radioButtonFond_1.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'radioButtonFond_2', 4) - self.radioButtonFond_2.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'nextButton', 4) - self.nextButton.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'backButton', 4) - self.backButton.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'lineEditName', 4) - self.lineEditName.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'labelName', 4) - self.labelName.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'labelNumber', 4) - self.labelNumber.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'lineEditNumber', 4) - self.lineEditNumber.setGeometry(QtCore.QRect(x, y, w, h)) - - font = QtGui.QFont() # Установка размера шрифта - font.setPointSize(int(geometry['addForm']['FontTitle'])) - self.Title.setFont(font) - font.setPointSize(int(geometry['addForm']['FontlabelSelection'])) - self.labelSelection.setFont(font) - font.setPointSize(int(geometry['addForm']['FontSection'])) - self.Section.setFont(font) - font.setPointSize(int(geometry['addForm']['FontlabelSubselection'])) - self.labelSubselection.setFont(font) - font.setPointSize(int(geometry['addForm']['FontSubselection'])) - self.Subselection.setFont(font) - font.setPointSize(int(geometry['addForm']['FontradioButtonFond_1'])) - self.radioButtonFond_1.setFont(font) - font.setPointSize(int(geometry['addForm']['FontradioButtonFond_2'])) - self.radioButtonFond_2.setFont(font) - font.setPointSize(int(geometry['addForm']['FontlineEditName'])) - self.lineEditName.setFont(font) - font.setPointSize(int(geometry['addForm']['FontlabelName'])) - self.labelName.setFont(font) - font.setPointSize(int(geometry['addForm']['FontlabelNumber'])) - self.labelNumber.setFont(font) - font.setPointSize(int(geometry['addForm']['FontlineEditNumber'])) - self.lineEditNumber.setFont(font) - - self.nextButton.setFont(ButtonFontPointSize) - self.backButton.setFont(ButtonFontPointSize) - except: - pass + try: + w, h = cgs('addForm', 'Window', 2) # Установка геометрии объектам + main.resize(w, h) + main.setMaximumSize(w, h) + + x, y, w, h = cgs('addForm', 'Title', 4) + self.Title.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'labelSelection', 4) + self.labelSelection.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'Section', 4) + self.Section.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'labelSubselection', 4) + self.labelSubselection.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'Subselection', 4) + self.Subselection.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'radioButtonFond_1', 4) + self.radioButtonFond_1.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'radioButtonFond_2', 4) + self.radioButtonFond_2.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'nextButton', 4) + self.nextButton.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'backButton', 4) + self.backButton.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'lineEditName', 4) + self.lineEditName.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'labelName', 4) + self.labelName.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'labelNumber', 4) + self.labelNumber.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'lineEditNumber', 4) + self.lineEditNumber.setGeometry(QtCore.QRect(x, y, w, h)) + + font = QtGui.QFont() # Установка размера шрифта + font.setPointSize(int(geometry['addForm']['FontTitle'])) + self.Title.setFont(font) + font.setPointSize(int(geometry['addForm']['FontlabelSelection'])) + self.labelSelection.setFont(font) + font.setPointSize(int(geometry['addForm']['FontSection'])) + self.Section.setFont(font) + font.setPointSize(int(geometry['addForm']['FontlabelSubselection'])) + self.labelSubselection.setFont(font) + font.setPointSize(int(geometry['addForm']['FontSubselection'])) + self.Subselection.setFont(font) + font.setPointSize(int(geometry['addForm']['FontradioButtonFond_1'])) + self.radioButtonFond_1.setFont(font) + font.setPointSize(int(geometry['addForm']['FontradioButtonFond_2'])) + self.radioButtonFond_2.setFont(font) + font.setPointSize(int(geometry['addForm']['FontlineEditName'])) + self.lineEditName.setFont(font) + font.setPointSize(int(geometry['addForm']['FontlabelName'])) + self.labelName.setFont(font) + font.setPointSize(int(geometry['addForm']['FontlabelNumber'])) + self.labelNumber.setFont(font) + font.setPointSize(int(geometry['addForm']['FontlineEditNumber'])) + self.lineEditNumber.setFont(font) + + self.nextButton.setFont(ButtonFontPointSize) + self.backButton.setFont(ButtonFontPointSize) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - self.Title.setStyleSheet(str(styleSheets['addForm']['Title'])) - self.labelSelection.setStyleSheet(str(styleSheets['addForm']['labelSelection'])) - self.Section.setStyleSheet(str(styleSheets['addForm']['Section'])) - self.labelSubselection.setStyleSheet(str(styleSheets['addForm']['labelSubselection'])) - self.Subselection.setStyleSheet(str(styleSheets['addForm']['Subselection'])) - self.radioButtonFond_1.setStyleSheet(str(styleSheets['addForm']['radioButtonFond_1'])) - self.radioButtonFond_2.setStyleSheet(str(styleSheets['addForm']['radioButtonFond_2'])) - self.nextButton.setStyleSheet(str(styleSheets['addForm']['nextButton'])) - self.backButton.setStyleSheet(str(styleSheets['addForm']['backButton'])) - self.lineEditName.setStyleSheet(str(styleSheets['addForm']['lineEditName'])) - self.labelName.setStyleSheet(str(styleSheets['addForm']['labelName'])) - self.labelNumber.setStyleSheet(str(styleSheets['addForm']['labelNumber'])) - self.lineEditNumber.setStyleSheet(str(styleSheets['addForm']['lineEditNumber'])) - except: - pass - - # Добавление функций к объектам - self.Section.activated.connect(lambda: self.selectionClicked(self.Section.currentText())) - self.backButton.clicked.connect(lambda: self.mainOpen()) - self.nextButton.clicked.connect(lambda: self.next()) - - self.Section.addItem("Изобразительные памятники") - self.Section.addItem("Нумизматика") - self.Section.addItem("Археология") - self.Section.addItem("Предметы этнографии") - self.Section.addItem("Оружие") - self.Section.addItem("Документы, фотографии") - self.Section.addItem("Предметы исторической техники") - self.Section.addItem("Предметы печатной продукции") - self.Section.addItem("Прочее") - - self.selectionClicked(self.Section.currentText()) - - global salf - global salfmain - salf = self - salfmain = main + try: + self.Title.setStyleSheet(str(styleSheets['addForm']['Title'])) + self.labelSelection.setStyleSheet(str(styleSheets['addForm']['labelSelection'])) + self.Section.setStyleSheet(str(styleSheets['addForm']['Section'])) + self.labelSubselection.setStyleSheet(str(styleSheets['addForm']['labelSubselection'])) + self.Subselection.setStyleSheet(str(styleSheets['addForm']['Subselection'])) + self.radioButtonFond_1.setStyleSheet(str(styleSheets['addForm']['radioButtonFond_1'])) + self.radioButtonFond_2.setStyleSheet(str(styleSheets['addForm']['radioButtonFond_2'])) + self.nextButton.setStyleSheet(str(styleSheets['addForm']['nextButton'])) + self.backButton.setStyleSheet(str(styleSheets['addForm']['backButton'])) + self.lineEditName.setStyleSheet(str(styleSheets['addForm']['lineEditName'])) + self.labelName.setStyleSheet(str(styleSheets['addForm']['labelName'])) + self.labelNumber.setStyleSheet(str(styleSheets['addForm']['labelNumber'])) + self.lineEditNumber.setStyleSheet(str(styleSheets['addForm']['lineEditNumber'])) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) + + # Добавление функций к объектам + self.Section.activated.connect(lambda: self.selectionClicked(self.Section.currentText())) + self.backButton.clicked.connect(lambda: self.mainOpen()) + self.nextButton.clicked.connect(lambda: self.next()) + + self.Section.addItem("Изобразительные памятники") + self.Section.addItem("Нумизматика") + self.Section.addItem("Археология") + self.Section.addItem("Предметы этнографии") + self.Section.addItem("Оружие") + self.Section.addItem("Документы, фотографии") + self.Section.addItem("Предметы исторической техники") + self.Section.addItem("Предметы печатной продукции") + self.Section.addItem("Прочее") + + self.selectionClicked(self.Section.currentText()) + + global salf + global salfmain + salf = self + salfmain = main + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def retranslateUi(self, main): + logging.info(f'{self.__class__.__name__} - retranslateUi') Ui_addForm.retranslateUi(self, main) main.setWindowTitle("Добавление экспоната") def selectionClicked(self, selection): # Установка подразделов в выпадающий список, в зависимости от выбранного раздела - self.Subselection.clear() + try: + logging.info(f'{self.__class__.__name__} - selectionClicked') + self.Subselection.clear() - if selection == 'Изобразительные памятники': - self.labelSubselection.setEnabled(True) - self.Subselection.setEnabled(True) + if selection == 'Изобразительные памятники': + self.labelSubselection.setEnabled(True) + self.Subselection.setEnabled(True) - self.Subselection.addItem("Живопись") - self.Subselection.addItem("Графика") - self.Subselection.addItem("Скульптуры") - self.Subselection.addItem('Другое') + self.Subselection.addItem("Живопись") + self.Subselection.addItem("Графика") + self.Subselection.addItem("Скульптуры") + self.Subselection.addItem('Другое') - elif selection == 'Нумизматика': - self.labelSubselection.setEnabled(True) - self.Subselection.setEnabled(True) + elif selection == 'Нумизматика': + self.labelSubselection.setEnabled(True) + self.Subselection.setEnabled(True) - self.Subselection.addItem("Монеты") - self.Subselection.addItem("Медали") - self.Subselection.addItem("Значки") + self.Subselection.addItem("Монеты") + self.Subselection.addItem("Медали") + self.Subselection.addItem("Значки") - elif selection == 'Предметы этнографии': - self.labelSubselection.setEnabled(True) - self.Subselection.setEnabled(True) + elif selection == 'Предметы этнографии': + self.labelSubselection.setEnabled(True) + self.Subselection.setEnabled(True) - self.Subselection.addItem('Предметы быта') - self.Subselection.addItem('Орудия труда') + self.Subselection.addItem('Предметы быта') + self.Subselection.addItem('Орудия труда') - elif selection == 'Предметы печатной продукции': - self.labelSubselection.setEnabled(True) - self.Subselection.setEnabled(True) + elif selection == 'Предметы печатной продукции': + self.labelSubselection.setEnabled(True) + self.Subselection.setEnabled(True) - self.Subselection.addItem('Книги') - self.Subselection.addItem('Брошуры, открытки') - self.Subselection.addItem('Плакаты') - self.Subselection.addItem('Другое') + self.Subselection.addItem('Книги') + self.Subselection.addItem('Брошуры, открытки') + self.Subselection.addItem('Плакаты') + self.Subselection.addItem('Другое') - else: - self.labelSubselection.setEnabled(False) - self.Subselection.setEnabled(False) + else: + self.labelSubselection.setEnabled(False) + self.Subselection.setEnabled(False) - self.nextButton.setEnabled(True) + self.nextButton.setEnabled(True) + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def next(self): # Переход на следующюю страницу и сохранение текущих характеристик - global selectionAdd - global subselectionAdd - global fondsAdd - global nameAdd - global numberAdd + try: + logging.info(f'{self.__class__.__name__} - next') + global selectionAdd + global subselectionAdd + global fondsAdd + global nameAdd + global numberAdd - selectionAdd = self.Section.currentText() - subselectionAdd = self.Subselection.currentText() + selectionAdd = self.Section.currentText() + subselectionAdd = self.Subselection.currentText() - if self.radioButtonFond_1.isChecked() == True: - fondsAdd = 'Основной фонд' - elif self.radioButtonFond_2.isChecked() == True: - fondsAdd = 'Научно-вспомогательный фонд' + if self.radioButtonFond_1.isChecked() == True: + fondsAdd = 'Основной фонд' + elif self.radioButtonFond_2.isChecked() == True: + fondsAdd = 'Научно-вспомогательный фонд' - nameAdd = self.lineEditName.text() - numberAdd = self.lineEditNumber.text() + nameAdd = self.lineEditName.text() + numberAdd = self.lineEditNumber.text() - winForm.hide() - winaddFormTwo.show() + winForm.hide() + winaddFormTwo.show() + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def mainOpen(self): + logging.info(f'{self.__class__.__name__} - mainOpen') winForm.hide() Main.show() class addFormPartTwo(Ui_addFormTwo): def setupUi(self, main): - Ui_addFormTwo.setupUi(self, main) try: - main.setStyleSheet(styleSheets['WindowStyles']['addFormPartTwo']) - except: - pass + logging.info(f'{self.__class__.__name__} - setupUi') + Ui_addFormTwo.setupUi(self, main) + try: + main.setStyleSheet(styleSheets['WindowStyles']['addFormPartTwo']) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: # Установка иконки - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) - main.setWindowIcon(icon) - except: - pass + try: # Установка иконки + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) + main.setWindowIcon(icon) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - w, h = cgs('addFormPartTwo', 'Window', 2) # Установка геометрии объектов - main.resize(w, h) - main.setMaximumSize(w, h) - - x, y, w, h = cgs('addFormPartTwo', 'Title', 4) - self.Title.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addFormPartTwo', 'labelGifter', 4) - self.labelGifter.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addFormPartTwo', 'lineEditGifter', 4) - self.lineEditGifter.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addFormPartTwo', 'labelDescription', 4) - self.labelDescription.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addFormPartTwo', 'textEditDescription', 4) - self.textEditDescription.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addFormPartTwo', 'labelPoint', 4) - self.labelPoint.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addFormPartTwo', 'lineEditPoint', 4) - self.lineEditPoint.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addFormPartTwo', 'saveButton', 4) - self.saveButton.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addFormPartTwo', 'backButton', 4) - self.backButton.setGeometry(QtCore.QRect(x, y, w, h)) - - font = QtGui.QFont() # Установка размера шрифта - font.setPointSize(int(geometry['addFormPartTwo']['FontTitle'])) - self.Title.setFont(font) - font.setPointSize(int(geometry['addFormPartTwo']['FontlabelGifter'])) - self.labelGifter.setFont(font) - font.setPointSize(int(geometry['addFormPartTwo']['FontlineEditGifter'])) - self.lineEditGifter.setFont(font) - font.setPointSize(int(geometry['addFormPartTwo']['FontlabelDescription'])) - self.labelDescription.setFont(font) - font.setPointSize(int(geometry['addFormPartTwo']['FonttextEditDescription'])) - self.textEditDescription.setFont(font) - font.setPointSize(int(geometry['addFormPartTwo']['FontlabelPoint'])) - self.labelPoint.setFont(font) - font.setPointSize(int(geometry['addFormPartTwo']['FontlineEditPoint'])) - self.lineEditPoint.setFont(font) - - self.backButton.setFont(ButtonFontPointSize) - self.saveButton.setFont(ButtonFontPointSize) - except: - pass + try: + w, h = cgs('addFormPartTwo', 'Window', 2) # Установка геометрии объектов + main.resize(w, h) + main.setMaximumSize(w, h) + + x, y, w, h = cgs('addFormPartTwo', 'Title', 4) + self.Title.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addFormPartTwo', 'labelGifter', 4) + self.labelGifter.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addFormPartTwo', 'lineEditGifter', 4) + self.lineEditGifter.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addFormPartTwo', 'labelDescription', 4) + self.labelDescription.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addFormPartTwo', 'textEditDescription', 4) + self.textEditDescription.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addFormPartTwo', 'labelPoint', 4) + self.labelPoint.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addFormPartTwo', 'lineEditPoint', 4) + self.lineEditPoint.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addFormPartTwo', 'saveButton', 4) + self.saveButton.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addFormPartTwo', 'backButton', 4) + self.backButton.setGeometry(QtCore.QRect(x, y, w, h)) + + font = QtGui.QFont() # Установка размера шрифта + font.setPointSize(int(geometry['addFormPartTwo']['FontTitle'])) + self.Title.setFont(font) + font.setPointSize(int(geometry['addFormPartTwo']['FontlabelGifter'])) + self.labelGifter.setFont(font) + font.setPointSize(int(geometry['addFormPartTwo']['FontlineEditGifter'])) + self.lineEditGifter.setFont(font) + font.setPointSize(int(geometry['addFormPartTwo']['FontlabelDescription'])) + self.labelDescription.setFont(font) + font.setPointSize(int(geometry['addFormPartTwo']['FonttextEditDescription'])) + self.textEditDescription.setFont(font) + font.setPointSize(int(geometry['addFormPartTwo']['FontlabelPoint'])) + self.labelPoint.setFont(font) + font.setPointSize(int(geometry['addFormPartTwo']['FontlineEditPoint'])) + self.lineEditPoint.setFont(font) + + self.backButton.setFont(ButtonFontPointSize) + self.saveButton.setFont(ButtonFontPointSize) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - self.Title.setStyleSheet(str(styleSheets['addFormPartTwo']['Title'])) - self.labelGifter.setStyleSheet(str(styleSheets['addFormPartTwo']['labelGifter'])) - self.lineEditGifter.setStyleSheet(str(styleSheets['addFormPartTwo']['lineEditGifter'])) - self.labelDescription.setStyleSheet(str(styleSheets['addFormPartTwo']['labelDescription'])) - self.textEditDescription.setStyleSheet(str(styleSheets['addFormPartTwo']['textEditDescription'])) - self.labelPoint.setStyleSheet(str(styleSheets['addFormPartTwo']['labelPoint'])) - self.lineEditPoint.setStyleSheet(str(styleSheets['addFormPartTwo']['lineEditPoint'])) - self.saveButton.setStyleSheet(str(styleSheets['addFormPartTwo']['saveButton'])) - self.backButton.setStyleSheet(str(styleSheets['addFormPartTwo']['backButton'])) - except: - pass - - # Добавление функций к кнопкам - self.backButton.clicked.connect(lambda: self.back()) - self.saveButton.clicked.connect(lambda: self.save()) - - global salk - global salkmain - salk = self - salkmain = main + try: + self.Title.setStyleSheet(str(styleSheets['addFormPartTwo']['Title'])) + self.labelGifter.setStyleSheet(str(styleSheets['addFormPartTwo']['labelGifter'])) + self.lineEditGifter.setStyleSheet(str(styleSheets['addFormPartTwo']['lineEditGifter'])) + self.labelDescription.setStyleSheet(str(styleSheets['addFormPartTwo']['labelDescription'])) + self.textEditDescription.setStyleSheet(str(styleSheets['addFormPartTwo']['textEditDescription'])) + self.labelPoint.setStyleSheet(str(styleSheets['addFormPartTwo']['labelPoint'])) + self.lineEditPoint.setStyleSheet(str(styleSheets['addFormPartTwo']['lineEditPoint'])) + self.saveButton.setStyleSheet(str(styleSheets['addFormPartTwo']['saveButton'])) + self.backButton.setStyleSheet(str(styleSheets['addFormPartTwo']['backButton'])) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) + + # Добавление функций к кнопкам + self.backButton.clicked.connect(lambda: self.back()) + self.saveButton.clicked.connect(lambda: self.save()) + + global salk + global salkmain + salk = self + salkmain = main + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def retranslateUi(self, main): + logging.info(f'{self.__class__.__name__} - retranslateUi') Ui_addFormTwo.retranslateUi(self, main) main.setWindowTitle("Добавление экспоната") def save(self): # Сохранение экспаната в базу данных - selection = selectionAdd - subselection = subselectionAdd - fonds = fondsAdd - Name = nameAdd - number = numberAdd + try: + logging.info(f'{self.__class__.__name__} - save') + selection = selectionAdd + subselection = subselectionAdd + fonds = fondsAdd + Name = nameAdd + number = numberAdd - db = cluster['Все'] - collection = db['none'] + db = cluster['Все'] + collection = db['none'] - if Name != '': - if collection.count_documents({'Name': Name}) == 0: - gifter = self.lineEditGifter.text() - point = self.lineEditPoint.text() - description = self.textEditDescription.toPlainText() + if Name != '': + if collection.count_documents({'Name': Name}) == 0: + gifter = self.lineEditGifter.text() + point = self.lineEditPoint.text() + description = self.textEditDescription.toPlainText() - post = {'fonds': fonds, 'select': selection, 'subselect': subselection , 'Name': Name, 'number': number, 'gifter': gifter, 'point': point, 'description': description} + post = {'fonds': fonds, 'select': selection, 'subselect': subselection , 'Name': Name, 'number': number, 'gifter': gifter, 'point': point, 'description': description} - db = cluster['Все'] - collection = db['none'] - collection.insert_one(post) + db = cluster['Все'] + collection = db['none'] + collection.insert_one(post) - self.mainOpen() + self.mainOpen() + else: + messageBox('Ошибка названия', 'Введено уже существующее название экспоната', QMessageBox.Critical) else: - messageBox('Ошибка названия', 'Введено уже существующее название экспоната', QMessageBox.Critical) - else: - messageBox('Ошибка названия', 'Не введено название экспонат', QMessageBox.Critical) + messageBox('Ошибка названия', 'Не введено название экспонат', QMessageBox.Critical) + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def back(self): + logging.info(f'{self.__class__.__name__} - back') winaddFormTwo.hide() winForm.show() def mainOpen(self): + logging.info(f'{self.__class__.__name__} - mainOpen') winaddFormTwo.hide() Main.show() class UiSubselection(Ui_Subselection): def setupUi(self, main): - Ui_Subselection.setupUi(self, main) try: - main.setStyleSheet(styleSheets['WindowStyles']['UiSubselection']) - except: - pass + logging.info(f'{self.__class__.__name__} - setupUi') + Ui_Subselection.setupUi(self, main) + try: + main.setStyleSheet(styleSheets['WindowStyles']['UiSubselection']) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: # Установка иконки - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) - main.setWindowIcon(icon) - except: - pass + try: # Установка иконки + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) + main.setWindowIcon(icon) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - w, h = cgs('UiSubselection', 'Window', 2) # Установка геометрии объектам - main.resize(w, h) - main.setMaximumSize(w, h) - - x, y, w, h = cgs('UiSubselection', 'Title', 4) - self.Title.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiSubselection', 'labelSubselection', 4) - self.labelSubselection.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiSubselection', 'backButton', 4) - self.backButton.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiSubselection', 'pushButton_1', 4) - self.pushButton_1.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiSubselection', 'pushButton_2', 4) - self.pushButton_2.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiSubselection', 'pushButton_3', 4) - self.pushButton_3.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiSubselection', 'pushButton_4', 4) - self.pushButton_4.setGeometry(QtCore.QRect(x, y, w, h)) - - font = QtGui.QFont() # Установка размера шрифта - font.setPointSize(int(geometry['UiSubselection']['FontTitle'])) - self.Title.setFont(font) - font.setPointSize(int(geometry['UiSubselection']['FontlabelSubselection'])) - self.labelSubselection.setFont(font) - - self.backButton.setFont(ButtonFontPointSize) - self.pushButton_1.setFont(ButtonFontPointSize) - self.pushButton_2.setFont(ButtonFontPointSize) - self.pushButton_3.setFont(ButtonFontPointSize) - self.pushButton_4.setFont(ButtonFontPointSize) - except: - pass + try: + w, h = cgs('UiSubselection', 'Window', 2) # Установка геометрии объектам + main.resize(w, h) + main.setMaximumSize(w, h) + + x, y, w, h = cgs('UiSubselection', 'Title', 4) + self.Title.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiSubselection', 'labelSubselection', 4) + self.labelSubselection.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiSubselection', 'backButton', 4) + self.backButton.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiSubselection', 'pushButton_1', 4) + self.pushButton_1.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiSubselection', 'pushButton_2', 4) + self.pushButton_2.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiSubselection', 'pushButton_3', 4) + self.pushButton_3.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiSubselection', 'pushButton_4', 4) + self.pushButton_4.setGeometry(QtCore.QRect(x, y, w, h)) + + font = QtGui.QFont() # Установка размера шрифта + font.setPointSize(int(geometry['UiSubselection']['FontTitle'])) + self.Title.setFont(font) + font.setPointSize(int(geometry['UiSubselection']['FontlabelSubselection'])) + self.labelSubselection.setFont(font) + + self.backButton.setFont(ButtonFontPointSize) + self.pushButton_1.setFont(ButtonFontPointSize) + self.pushButton_2.setFont(ButtonFontPointSize) + self.pushButton_3.setFont(ButtonFontPointSize) + self.pushButton_4.setFont(ButtonFontPointSize) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - self.Title.setStyleSheet(str(styleSheets['UiSubselection']['Title'])) - self.labelSubselection.setStyleSheet(str(styleSheets['UiSubselection']['labelSubselection'])) - self.backButton.setStyleSheet(str(styleSheets['UiSubselection']['backButton'])) - self.pushButton_1.setStyleSheet(str(styleSheets['UiSubselection']['pushButton_1'])) - self.pushButton_2.setStyleSheet(str(styleSheets['UiSubselection']['pushButton_2'])) - self.pushButton_3.setStyleSheet(str(styleSheets['UiSubselection']['pushButton_3'])) - self.pushButton_4.setStyleSheet(str(styleSheets['UiSubselection']['pushButton_4'])) - except: - pass - - # Добовление функций к кнопкам - self.pushButton_1.clicked.connect(lambda: self.selectionClicked(self.pushButton_1.text())) - self.pushButton_2.clicked.connect(lambda: self.selectionClicked(self.pushButton_2.text())) - self.pushButton_3.clicked.connect(lambda: self.selectionClicked(self.pushButton_3.text())) - self.pushButton_4.clicked.connect(lambda: self.selectionClicked(self.pushButton_4.text())) - self.backButton.clicked.connect(lambda: self.mainOpen()) - - Empty = '...' # Текст пустой кнопки - self.Title.setText(selectionMain) - if selectionMain == 'Изобразительные памятники': # Установка названий подразделов на кнопки - self.pushButton_1.setText("Живопись") - self.pushButton_2.setText("Графика") - self.pushButton_3.setText("Скульптуры") - self.pushButton_4.setText('Другое') - - elif selectionMain == 'Нумизматика': - self.pushButton_1.setText("Медали") - self.pushButton_2.setText("Монеты") - self.pushButton_3.setText("Значки") - self.pushButton_4.setText(Empty) - self.pushButton_4.setEnabled(False) - - elif selectionMain == 'Предметы этнографии': - self.pushButton_1.setText("Предметы быта") - self.pushButton_2.setText("Орудия труда") - self.pushButton_3.setText(Empty) - self.pushButton_4.setText(Empty) - self.pushButton_3.setEnabled(False) - self.pushButton_4.setEnabled(False) - - elif selectionMain == 'Предметы печатной продукции': - self.pushButton_1.setText('Книги') - self.pushButton_2.setText("Брошуры, открытки") - self.pushButton_3.setText("Плакаты") - self.pushButton_4.setText("Другое") + try: + self.Title.setStyleSheet(str(styleSheets['UiSubselection']['Title'])) + self.labelSubselection.setStyleSheet(str(styleSheets['UiSubselection']['labelSubselection'])) + self.backButton.setStyleSheet(str(styleSheets['UiSubselection']['backButton'])) + self.pushButton_1.setStyleSheet(str(styleSheets['UiSubselection']['pushButton_1'])) + self.pushButton_2.setStyleSheet(str(styleSheets['UiSubselection']['pushButton_2'])) + self.pushButton_3.setStyleSheet(str(styleSheets['UiSubselection']['pushButton_3'])) + self.pushButton_4.setStyleSheet(str(styleSheets['UiSubselection']['pushButton_4'])) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) + + # Добовление функций к кнопкам + self.pushButton_1.clicked.connect(lambda: self.selectionClicked(self.pushButton_1.text())) + self.pushButton_2.clicked.connect(lambda: self.selectionClicked(self.pushButton_2.text())) + self.pushButton_3.clicked.connect(lambda: self.selectionClicked(self.pushButton_3.text())) + self.pushButton_4.clicked.connect(lambda: self.selectionClicked(self.pushButton_4.text())) + self.backButton.clicked.connect(lambda: self.mainOpen()) + + Empty = '...' # Текст пустой кнопки + self.Title.setText(selectionMain) + if selectionMain == 'Изобразительные памятники': # Установка названий подразделов на кнопки + self.pushButton_1.setText("Живопись") + self.pushButton_2.setText("Графика") + self.pushButton_3.setText("Скульптуры") + self.pushButton_4.setText('Другое') + + elif selectionMain == 'Нумизматика': + self.pushButton_1.setText("Медали") + self.pushButton_2.setText("Монеты") + self.pushButton_3.setText("Значки") + self.pushButton_4.setText(Empty) + self.pushButton_4.setEnabled(False) + + elif selectionMain == 'Предметы этнографии': + self.pushButton_1.setText("Предметы быта") + self.pushButton_2.setText("Орудия труда") + self.pushButton_3.setText(Empty) + self.pushButton_4.setText(Empty) + self.pushButton_3.setEnabled(False) + self.pushButton_4.setEnabled(False) + + elif selectionMain == 'Предметы печатной продукции': + self.pushButton_1.setText('Книги') + self.pushButton_2.setText("Брошуры, открытки") + self.pushButton_3.setText("Плакаты") + self.pushButton_4.setText("Другое") + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def retranslateUi(self, main): - _translate = QtCore.QCoreApplication.translate + logging.info(f'{self.__class__.__name__} - retranslateUi') Ui_Subselection.retranslateUi(self, main) main.setWindowTitle("Учёт музейных фондов") def selectionClicked(self, selection): # Переход к списку экспонатов - global subselectionMain - subselectionMain = selection + try: + logging.info(f'{self.__class__.__name__} - selectionClicked') + global subselectionMain + subselectionMain = selection - winSubselection.hide() + winSubselection.hide() - global winFond - winFond = QtWidgets.QWidget() - uiFond = Fond() - uiFond.setupUi(winFond) + global winFond + winFond = QtWidgets.QWidget() + uiFond = Fond() + uiFond.setupUi(winFond) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def mainOpen(self): + logging.info(f'{self.__class__.__name__} - mainOpen') winSubselection.hide() Main.show() class UiReadForm(Ui_readForm): def setupUi(self, main): - Ui_readForm.setupUi(self, main) try: - main.setStyleSheet(styleSheets['WindowStyles']['UiReadForm']) - except: - pass + logging.info(f'{self.__class__.__name__} - setupUi') + Ui_readForm.setupUi(self, main) + try: + main.setStyleSheet(styleSheets['WindowStyles']['UiReadForm']) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: # Установка иконки - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) - main.setWindowIcon(icon) - except: - pass + try: # Установка иконки + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) + main.setWindowIcon(icon) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - w, h = cgs('UiReadForm', 'Window', 2) # Установка геометрии объекстов - main.resize(w, h) - main.setMaximumSize(w, h) - - x, y, w, h = cgs('UiReadForm', 'Title', 4) - self.Title.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiReadForm', 'titleSelection', 4) - self.titleSelection.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiReadForm', 'titleSubselection', 4) - self.titleSubselection.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiReadForm', 'labelNumber', 4) - self.labelNumber.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiReadForm', 'labelGifter', 4) - self.labelGifter.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiReadForm', 'labelDescription', 4) - self.labelDescription.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiReadForm', 'labelPoint', 4) - self.labelPoint.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiReadForm', 'labelSelection', 4) - self.labelSelection.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiReadForm', 'labelSubselection', 4) - self.labelSubselection.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiReadForm', 'labelTypeFond', 4) - self.labelTypeFond.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiReadForm', 'lableNumber', 4) - self.lableNumber.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiReadForm', 'lableGifter', 4) - self.lableGifter.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiReadForm', 'lablePoint', 4) - self.lablePoint.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiReadForm', 'textBrowserDescription', 4) - self.textBrowserDescription.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiReadForm', 'pushButtonDelite', 4) - self.pushButtonDelite.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiReadForm', 'pushButtonClose', 4) - self.pushButtonClose.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiReadForm', 'pushButtonEdit', 4) - self.pushButtonEdit.setGeometry(QtCore.QRect(x, y, w, h)) - - font = QtGui.QFont() # Установка размера шрифта - font.setPointSize(int(geometry['UiReadForm']['FontTitle'])) - self.Title.setFont(font) - font.setPointSize(int(geometry['UiReadForm']['FonttitleSelection'])) - self.titleSelection.setFont(font) - font.setPointSize(int(geometry['UiReadForm']['FonttitleSubselection'])) - self.titleSubselection.setFont(font) - font.setPointSize(int(geometry['UiReadForm']['FontlabelNumber'])) - self.labelNumber.setFont(font) - font.setPointSize(int(geometry['UiReadForm']['FontlabelGifter'])) - self.labelGifter.setFont(font) - font.setPointSize(int(geometry['UiReadForm']['FontlabelDescription'])) - self.labelDescription.setFont(font) - font.setPointSize(int(geometry['UiReadForm']['FontlabelPoint'])) - self.labelPoint.setFont(font) - font.setPointSize(int(geometry['UiReadForm']['FontlabelSelection'])) - self.labelSelection.setFont(font) - font.setPointSize(int(geometry['UiReadForm']['FontlabelSubselection'])) - self.labelSubselection.setFont(font) - font.setPointSize(int(geometry['UiReadForm']['FontlabelTypeFond'])) - self.labelTypeFond.setFont(font) - font.setPointSize(int(geometry['UiReadForm']['FontlableNumber'])) - self.lableNumber.setFont(font) - font.setPointSize(int(geometry['UiReadForm']['FontlableGifter'])) - self.lableGifter.setFont(font) - font.setPointSize(int(geometry['UiReadForm']['FontlablePoint'])) - self.lablePoint.setFont(font) - font.setPointSize(int(geometry['UiReadForm']['FonttextBrowserDescription'])) - self.textBrowserDescription.setFont(font) - - self.pushButtonDelite.setFont(ButtonFontPointSize) - self.pushButtonClose.setFont(ButtonFontPointSize) - self.pushButtonEdit.setFont(ButtonFontPointSize) - except: - pass + try: + w, h = cgs('UiReadForm', 'Window', 2) # Установка геометрии объекстов + main.resize(w, h) + main.setMaximumSize(w, h) + + x, y, w, h = cgs('UiReadForm', 'Title', 4) + self.Title.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiReadForm', 'titleSelection', 4) + self.titleSelection.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiReadForm', 'titleSubselection', 4) + self.titleSubselection.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiReadForm', 'labelNumber', 4) + self.labelNumber.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiReadForm', 'labelGifter', 4) + self.labelGifter.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiReadForm', 'labelDescription', 4) + self.labelDescription.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiReadForm', 'labelPoint', 4) + self.labelPoint.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiReadForm', 'labelSelection', 4) + self.labelSelection.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiReadForm', 'labelSubselection', 4) + self.labelSubselection.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiReadForm', 'labelTypeFond', 4) + self.labelTypeFond.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiReadForm', 'lableNumber', 4) + self.lableNumber.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiReadForm', 'lableGifter', 4) + self.lableGifter.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiReadForm', 'lablePoint', 4) + self.lablePoint.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiReadForm', 'textBrowserDescription', 4) + self.textBrowserDescription.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiReadForm', 'pushButtonDelite', 4) + self.pushButtonDelite.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiReadForm', 'pushButtonClose', 4) + self.pushButtonClose.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiReadForm', 'pushButtonEdit', 4) + self.pushButtonEdit.setGeometry(QtCore.QRect(x, y, w, h)) + + font = QtGui.QFont() # Установка размера шрифта + font.setPointSize(int(geometry['UiReadForm']['FontTitle'])) + self.Title.setFont(font) + font.setPointSize(int(geometry['UiReadForm']['FonttitleSelection'])) + self.titleSelection.setFont(font) + font.setPointSize(int(geometry['UiReadForm']['FonttitleSubselection'])) + self.titleSubselection.setFont(font) + font.setPointSize(int(geometry['UiReadForm']['FontlabelNumber'])) + self.labelNumber.setFont(font) + font.setPointSize(int(geometry['UiReadForm']['FontlabelGifter'])) + self.labelGifter.setFont(font) + font.setPointSize(int(geometry['UiReadForm']['FontlabelDescription'])) + self.labelDescription.setFont(font) + font.setPointSize(int(geometry['UiReadForm']['FontlabelPoint'])) + self.labelPoint.setFont(font) + font.setPointSize(int(geometry['UiReadForm']['FontlabelSelection'])) + self.labelSelection.setFont(font) + font.setPointSize(int(geometry['UiReadForm']['FontlabelSubselection'])) + self.labelSubselection.setFont(font) + font.setPointSize(int(geometry['UiReadForm']['FontlabelTypeFond'])) + self.labelTypeFond.setFont(font) + font.setPointSize(int(geometry['UiReadForm']['FontlableNumber'])) + self.lableNumber.setFont(font) + font.setPointSize(int(geometry['UiReadForm']['FontlableGifter'])) + self.lableGifter.setFont(font) + font.setPointSize(int(geometry['UiReadForm']['FontlablePoint'])) + self.lablePoint.setFont(font) + font.setPointSize(int(geometry['UiReadForm']['FonttextBrowserDescription'])) + self.textBrowserDescription.setFont(font) + + self.pushButtonDelite.setFont(ButtonFontPointSize) + self.pushButtonClose.setFont(ButtonFontPointSize) + self.pushButtonEdit.setFont(ButtonFontPointSize) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - self.Title.setStyleSheet(str(styleSheets['UiReadForm']['Title'])) - self.titleSelection.setStyleSheet(str(styleSheets['UiReadForm']['titleSelection'])) - self.titleSubselection.setStyleSheet(str(styleSheets['UiReadForm']['titleSubselection'])) - self.labelNumber.setStyleSheet(str(styleSheets['UiReadForm']['labelNumber'])) - self.labelGifter.setStyleSheet(str(styleSheets['UiReadForm']['labelGifter'])) - self.labelDescription.setStyleSheet(str(styleSheets['UiReadForm']['labelDescription'])) - self.labelPoint.setStyleSheet(str(styleSheets['UiReadForm']['labelPoint'])) - self.labelSelection.setStyleSheet(str(styleSheets['UiReadForm']['labelSelection'])) - self.labelSubselection.setStyleSheet(str(styleSheets['UiReadForm']['labelSubselection'])) - self.labelTypeFond.setStyleSheet(str(styleSheets['UiReadForm']['labelTypeFond'])) - self.lableNumber.setStyleSheet(str(styleSheets['UiReadForm']['lableNumber'])) - self.lableGifter.setStyleSheet(str(styleSheets['UiReadForm']['lableGifter'])) - self.lablePoint.setStyleSheet(str(styleSheets['UiReadForm']['lablePoint'])) - self.textBrowserDescription.setStyleSheet(str(styleSheets['UiReadForm']['textBrowserDescription'])) - self.pushButtonDelite.setStyleSheet(str(styleSheets['UiReadForm']['pushButtonDelite'])) - self.pushButtonClose.setStyleSheet(str(styleSheets['UiReadForm']['pushButtonClose'])) - self.pushButtonEdit.setStyleSheet(str(styleSheets['UiReadForm']['pushButtonEdit'])) - except: - pass - - # Добавление функций к кнопкам - self.pushButtonDelite.clicked.connect(lambda: self.showDialog()) - self.pushButtonClose.clicked.connect(lambda: readForm.close()) - self.pushButtonEdit.clicked.connect(lambda: self.editOpen()) + try: + self.Title.setStyleSheet(str(styleSheets['UiReadForm']['Title'])) + self.titleSelection.setStyleSheet(str(styleSheets['UiReadForm']['titleSelection'])) + self.titleSubselection.setStyleSheet(str(styleSheets['UiReadForm']['titleSubselection'])) + self.labelNumber.setStyleSheet(str(styleSheets['UiReadForm']['labelNumber'])) + self.labelGifter.setStyleSheet(str(styleSheets['UiReadForm']['labelGifter'])) + self.labelDescription.setStyleSheet(str(styleSheets['UiReadForm']['labelDescription'])) + self.labelPoint.setStyleSheet(str(styleSheets['UiReadForm']['labelPoint'])) + self.labelSelection.setStyleSheet(str(styleSheets['UiReadForm']['labelSelection'])) + self.labelSubselection.setStyleSheet(str(styleSheets['UiReadForm']['labelSubselection'])) + self.labelTypeFond.setStyleSheet(str(styleSheets['UiReadForm']['labelTypeFond'])) + self.lableNumber.setStyleSheet(str(styleSheets['UiReadForm']['lableNumber'])) + self.lableGifter.setStyleSheet(str(styleSheets['UiReadForm']['lableGifter'])) + self.lablePoint.setStyleSheet(str(styleSheets['UiReadForm']['lablePoint'])) + self.textBrowserDescription.setStyleSheet(str(styleSheets['UiReadForm']['textBrowserDescription'])) + self.pushButtonDelite.setStyleSheet(str(styleSheets['UiReadForm']['pushButtonDelite'])) + self.pushButtonClose.setStyleSheet(str(styleSheets['UiReadForm']['pushButtonClose'])) + self.pushButtonEdit.setStyleSheet(str(styleSheets['UiReadForm']['pushButtonEdit'])) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) + + # Добавление функций к кнопкам + self.pushButtonDelite.clicked.connect(lambda: self.showDialog()) + self.pushButtonClose.clicked.connect(lambda: readForm.close()) + self.pushButtonEdit.clicked.connect(lambda: self.editOpen()) + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def editOpen(self): - readForm.hide() + try: + logging.info(f'{self.__class__.__name__} - editOpen') + readForm.hide() - uieditForm.Substitution() - uEFT.Substitution() + uieditForm.Substitution() + uEFT.Substitution() - wineditForm.show() + wineditForm.show() + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def retranslateUi(self, main): - _translate = QtCore.QCoreApplication.translate - Ui_readForm.retranslateUi(self, main) - readForm.setWindowTitle("Данные экспоната") - self.Title.setText(forread[1]) - self.labelSelection.setText(forread[6]) - self.labelSubselection.setText(forread[7]) - self.labelTypeFond.setText(forread[0]) - self.lableNumber.setText(str(forread[2])) - self.lableGifter.setText(forread[3]) - self.lablePoint.setText(forread[4]) - self.textBrowserDescription.setHtml(forread[5]) + try: + logging.info(f'{self.__class__.__name__} - retranslateUi') + Ui_readForm.retranslateUi(self, main) + readForm.setWindowTitle("Данные экспоната") + self.Title.setText(forread[1]) + self.labelSelection.setText(forread[6]) + self.labelSubselection.setText(forread[7]) + self.labelTypeFond.setText(forread[0]) + self.lableNumber.setText(str(forread[2])) + self.lableGifter.setText(forread[3]) + self.lablePoint.setText(forread[4]) + self.textBrowserDescription.setHtml(forread[5]) + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def showDialog(self): # Окно подтверждения о удалении экспоната из базы данных - msgBox = QMessageBox() - msgBox.setIcon(QMessageBox.Information) - msgBox.setText("Вы действительно хотите удалить этот экспонат из базы данных?") - msgBox.setWindowTitle("Удалить этот экспонат?") try: - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) - msgBox.setWindowIcon(icon) - except: - pass - msgBox.setIcon(QMessageBox.Question) - msgBox.setStandardButtons(QMessageBox.Yes | QMessageBox.Cancel) - - returnValue = msgBox.exec() - if returnValue == QMessageBox.Yes : - self.Del() + logging.info(f'{self.__class__.__name__} - showDialog') + msgBox = QMessageBox() + msgBox.setIcon(QMessageBox.Information) + msgBox.setText("Вы действительно хотите удалить этот экспонат из базы данных?") + msgBox.setWindowTitle("Удалить этот экспонат?") + try: + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) + msgBox.setWindowIcon(icon) + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) + + msgBox.setIcon(QMessageBox.Question) + msgBox.setStandardButtons(QMessageBox.Yes | QMessageBox.Cancel) + + returnValue = msgBox.exec() + if returnValue == QMessageBox.Yes : + self.Del() + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def Del(self): # Удаление экспоната из базы данных - selection = forread[6] - subselection = forread[7] + try: + logging.info(f'{self.__class__.__name__} - Del') + selection = forread[6] + subselection = forread[7] - db = cluster['Все'] - collection = db['none'] - collection.delete_one({'Name': forread[1]}) + db = cluster['Все'] + collection = db['none'] + collection.delete_one({'Name': forread[1]}) - fondSelf.refresh() - readForm.hide() + fondSelf.refresh() + readForm.hide() + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл class UiSettings(Ui_Settings): def setupUi(self, main): - Ui_Settings.setupUi(self, main) try: - main.setStyleSheet(styleSheets['WindowStyles']['UiSettings']) - except: - pass + logging.info(f'{self.__class__.__name__} - setupUi') + Ui_Settings.setupUi(self, main) + try: + main.setStyleSheet(styleSheets['WindowStyles']['UiSettings']) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: # Установка иконки - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) - main.setWindowIcon(icon) - except: - pass + try: # Установка иконки + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) + main.setWindowIcon(icon) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - w, h = cgs('UiSettings', 'Window', 2) # Устанока геометрии объектов - main.resize(w, h) - main.setMaximumSize(w, h) - - x, y, w, h = cgs('UiSettings', 'Title', 4) - self.Title.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiSettings', 'appyButton', 4) - self.appyButton.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiSettings', 'themeLabel', 4) - self.themeLabel.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiSettings', 'themeComboBox', 4) - self.themeComboBox.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiSettings', 'geometryComboBox', 4) - self.geometryComboBox.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('UiSettings', 'geometryLabel', 4) - self.geometryLabel.setGeometry(QtCore.QRect(x, y, w, h)) - - font = QtGui.QFont() # Установка размера рифта - font.setPointSize(int(geometry['UiSettings']['FontTitle'])) - self.Title.setFont(font) - font.setPointSize(int(geometry['UiSettings']['FontthemeLabel'])) - self.themeLabel.setFont(font) - font.setPointSize(int(geometry['UiSettings']['FontthemeComboBox'])) - self.themeComboBox.setFont(font) - font.setPointSize(int(geometry['UiSettings']['FontgeometryLabel'])) - self.geometryLabel.setFont(font) - font.setPointSize(int(geometry['UiSettings']['FontgeometryComboBox'])) - self.geometryComboBox.setFont(font) - - self.appyButton.setFont(ButtonFontPointSize) - except: - pass + try: + w, h = cgs('UiSettings', 'Window', 2) # Устанока геометрии объектов + main.resize(w, h) + main.setMaximumSize(w, h) + + x, y, w, h = cgs('UiSettings', 'Title', 4) + self.Title.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiSettings', 'appyButton', 4) + self.appyButton.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiSettings', 'themeLabel', 4) + self.themeLabel.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiSettings', 'themeComboBox', 4) + self.themeComboBox.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiSettings', 'geometryComboBox', 4) + self.geometryComboBox.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('UiSettings', 'geometryLabel', 4) + self.geometryLabel.setGeometry(QtCore.QRect(x, y, w, h)) + + font = QtGui.QFont() # Установка размера рифта + font.setPointSize(int(geometry['UiSettings']['FontTitle'])) + self.Title.setFont(font) + font.setPointSize(int(geometry['UiSettings']['FontthemeLabel'])) + self.themeLabel.setFont(font) + font.setPointSize(int(geometry['UiSettings']['FontthemeComboBox'])) + self.themeComboBox.setFont(font) + font.setPointSize(int(geometry['UiSettings']['FontgeometryLabel'])) + self.geometryLabel.setFont(font) + font.setPointSize(int(geometry['UiSettings']['FontgeometryComboBox'])) + self.geometryComboBox.setFont(font) + + self.appyButton.setFont(ButtonFontPointSize) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - self.Title.setStyleSheet(str(styleSheets['UiSettings']['Title'])) - self.appyButton.setStyleSheet(str(styleSheets['UiSettings']['appyButton'])) - self.themeLabel.setStyleSheet(str(styleSheets['UiSettings']['themeLabel'])) - self.themeComboBox.setStyleSheet(str(styleSheets['UiSettings']['themeComboBox'])) - self.geometryComboBox.setStyleSheet(str(styleSheets['UiSettings']['geometryComboBox'])) - self.geometryLabel.setStyleSheet(str(styleSheets['UiSettings']['geometryLabel'])) - except: - pass - - self.themeComboBox.clear() # Устанока списка тем в выпадающий список из папки styles - self.themeComboBox.addItem(config['Settings']['theme']) - with os.scandir(os.getcwd() + '\\Resourses\\styles') as listOfEntries: - for entry in listOfEntries: - if entry.is_file() and entry.name[-3:] == 'ini' and entry.name[:-4] != config['Settings']['Theme']: - self.themeComboBox.addItem(entry.name[:-4]) - - self.geometryComboBox.clear() # Установка списка геометрий для объектов в выпадающий список из папки Geometry - self.geometryComboBox.addItem(config['Settings']['geometry']) - with os.scandir(os.getcwd() + '\\Resourses\\Geometry') as listOfEntries: - for entry in listOfEntries: - if entry.is_file() and entry.name[-3:] == 'ini' and entry.name[:-4] != config['Settings']['geometry']: - self.geometryComboBox.addItem(entry.name[:-4]) + try: + self.Title.setStyleSheet(str(styleSheets['UiSettings']['Title'])) + self.appyButton.setStyleSheet(str(styleSheets['UiSettings']['appyButton'])) + self.themeLabel.setStyleSheet(str(styleSheets['UiSettings']['themeLabel'])) + self.themeComboBox.setStyleSheet(str(styleSheets['UiSettings']['themeComboBox'])) + self.geometryComboBox.setStyleSheet(str(styleSheets['UiSettings']['geometryComboBox'])) + self.geometryLabel.setStyleSheet(str(styleSheets['UiSettings']['geometryLabel'])) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) + + self.themeComboBox.clear() # Устанока списка тем в выпадающий список из папки styles + self.themeComboBox.addItem(config['Settings']['theme']) + with os.scandir(os.getcwd() + '\\Resourses\\styles') as listOfEntries: + for entry in listOfEntries: + if entry.is_file() and entry.name[-3:] == 'ini' and entry.name[:-4] != config['Settings']['Theme']: + self.themeComboBox.addItem(entry.name[:-4]) + + self.geometryComboBox.clear() # Установка списка геометрий для объектов в выпадающий список из папки Geometry + self.geometryComboBox.addItem(config['Settings']['geometry']) + with os.scandir(os.getcwd() + '\\Resourses\\Geometry') as listOfEntries: + for entry in listOfEntries: + if entry.is_file() and entry.name[-3:] == 'ini' and entry.name[:-4] != config['Settings']['geometry']: + self.geometryComboBox.addItem(entry.name[:-4]) + + self.appyButton.clicked.connect(lambda: self.appy()) # Добавление функции сохранения настроек к нопки - self.appyButton.clicked.connect(lambda: self.appy()) # Добавление функции сохранения настроек к нопки + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def retranslateUi(self, main): - _translate = QtCore.QCoreApplication.translate + logging.info(f'{self.__class__.__name__} - retranslateUi') Ui_Settings.retranslateUi(self, main) main.setWindowTitle("Настройки") def appy(self): # Сохранение настроек - config['Settings']['theme'] = self.themeComboBox.currentText() - config['Settings']['geometry'] = self.geometryComboBox.currentText() + try: + logging.info(f'{self.__class__.__name__} - appy') + config['Settings']['theme'] = self.themeComboBox.currentText() + config['Settings']['geometry'] = self.geometryComboBox.currentText() - with open(configWay, 'w+', encoding ="utf8") as configfile: - config.write(configfile) + with open(configWay, 'w+', encoding ="utf8") as configfile: + config.write(configfile) - themeSelect() + themeSelect() - messageBox('Перезапуск приложения', 'Для применения настроек\n будет автоматически перезагруженно приложение') + messageBox('Перезапуск приложения', 'Для применения настроек\n будет автоматически перезагруженно приложение') - Main.show() - Settings.hide() - restart() + Main.show() + Settings.hide() + restart() + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл class editForm(Ui_addForm): def setupUi(self, main): - Ui_addForm.setupUi(self, main) try: - main.setStyleSheet(styleSheets['WindowStyles']['addForm']) - except: - pass + logging.info(f'{self.__class__.__name__} - setupUi') + Ui_addForm.setupUi(self, main) + try: + main.setStyleSheet(styleSheets['WindowStyles']['addForm']) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: # Установка иконки - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) - main.setWindowIcon(icon) - except: - pass + try: # Установка иконки + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) + main.setWindowIcon(icon) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - w, h = cgs('addForm', 'Window', 2) # Установка геометрии объектам - main.resize(w, h) - main.setMaximumSize(w, h) - - x, y, w, h = cgs('addForm', 'Title', 4) - self.Title.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'labelSelection', 4) - self.labelSelection.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'Section', 4) - self.Section.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'labelSubselection', 4) - self.labelSubselection.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'Subselection', 4) - self.Subselection.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'radioButtonFond_1', 4) - self.radioButtonFond_1.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'radioButtonFond_2', 4) - self.radioButtonFond_2.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'nextButton', 4) - self.nextButton.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'backButton', 4) - self.backButton.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'lineEditName', 4) - self.lineEditName.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'labelName', 4) - self.labelName.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'labelNumber', 4) - self.labelNumber.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addForm', 'lineEditNumber', 4) - self.lineEditNumber.setGeometry(QtCore.QRect(x, y, w, h)) - - font = QtGui.QFont() # Установка размера шрифта - font.setPointSize(int(geometry['addForm']['FontTitle'])) - self.Title.setFont(font) - font.setPointSize(int(geometry['addForm']['FontlabelSelection'])) - self.labelSelection.setFont(font) - font.setPointSize(int(geometry['addForm']['FontSection'])) - self.Section.setFont(font) - font.setPointSize(int(geometry['addForm']['FontlabelSubselection'])) - self.labelSubselection.setFont(font) - font.setPointSize(int(geometry['addForm']['FontSubselection'])) - self.Subselection.setFont(font) - font.setPointSize(int(geometry['addForm']['FontradioButtonFond_1'])) - self.radioButtonFond_1.setFont(font) - font.setPointSize(int(geometry['addForm']['FontradioButtonFond_2'])) - self.radioButtonFond_2.setFont(font) - font.setPointSize(int(geometry['addForm']['FontlineEditName'])) - self.lineEditName.setFont(font) - font.setPointSize(int(geometry['addForm']['FontlabelName'])) - self.labelName.setFont(font) - font.setPointSize(int(geometry['addForm']['FontlabelNumber'])) - self.labelNumber.setFont(font) - font.setPointSize(int(geometry['addForm']['FontlineEditNumber'])) - self.lineEditNumber.setFont(font) - - self.nextButton.setFont(ButtonFontPointSize) - self.backButton.setFont(ButtonFontPointSize) - except: - pass + try: + w, h = cgs('addForm', 'Window', 2) # Установка геометрии объектам + main.resize(w, h) + main.setMaximumSize(w, h) + + x, y, w, h = cgs('addForm', 'Title', 4) + self.Title.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'labelSelection', 4) + self.labelSelection.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'Section', 4) + self.Section.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'labelSubselection', 4) + self.labelSubselection.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'Subselection', 4) + self.Subselection.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'radioButtonFond_1', 4) + self.radioButtonFond_1.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'radioButtonFond_2', 4) + self.radioButtonFond_2.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'nextButton', 4) + self.nextButton.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'backButton', 4) + self.backButton.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'lineEditName', 4) + self.lineEditName.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'labelName', 4) + self.labelName.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'labelNumber', 4) + self.labelNumber.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addForm', 'lineEditNumber', 4) + self.lineEditNumber.setGeometry(QtCore.QRect(x, y, w, h)) + + font = QtGui.QFont() # Установка размера шрифта + font.setPointSize(int(geometry['addForm']['FontTitle'])) + self.Title.setFont(font) + font.setPointSize(int(geometry['addForm']['FontlabelSelection'])) + self.labelSelection.setFont(font) + font.setPointSize(int(geometry['addForm']['FontSection'])) + self.Section.setFont(font) + font.setPointSize(int(geometry['addForm']['FontlabelSubselection'])) + self.labelSubselection.setFont(font) + font.setPointSize(int(geometry['addForm']['FontSubselection'])) + self.Subselection.setFont(font) + font.setPointSize(int(geometry['addForm']['FontradioButtonFond_1'])) + self.radioButtonFond_1.setFont(font) + font.setPointSize(int(geometry['addForm']['FontradioButtonFond_2'])) + self.radioButtonFond_2.setFont(font) + font.setPointSize(int(geometry['addForm']['FontlineEditName'])) + self.lineEditName.setFont(font) + font.setPointSize(int(geometry['addForm']['FontlabelName'])) + self.labelName.setFont(font) + font.setPointSize(int(geometry['addForm']['FontlabelNumber'])) + self.labelNumber.setFont(font) + font.setPointSize(int(geometry['addForm']['FontlineEditNumber'])) + self.lineEditNumber.setFont(font) + + self.nextButton.setFont(ButtonFontPointSize) + self.backButton.setFont(ButtonFontPointSize) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - self.Title.setStyleSheet(str(styleSheets['addForm']['Title'])) - self.labelSelection.setStyleSheet(str(styleSheets['addForm']['labelSelection'])) - self.Section.setStyleSheet(str(styleSheets['addForm']['Section'])) - self.labelSubselection.setStyleSheet(str(styleSheets['addForm']['labelSubselection'])) - self.Subselection.setStyleSheet(str(styleSheets['addForm']['Subselection'])) - self.radioButtonFond_1.setStyleSheet(str(styleSheets['addForm']['radioButtonFond_1'])) - self.radioButtonFond_2.setStyleSheet(str(styleSheets['addForm']['radioButtonFond_2'])) - self.nextButton.setStyleSheet(str(styleSheets['addForm']['nextButton'])) - self.backButton.setStyleSheet(str(styleSheets['addForm']['backButton'])) - self.lineEditName.setStyleSheet(str(styleSheets['addForm']['lineEditName'])) - self.labelName.setStyleSheet(str(styleSheets['addForm']['labelName'])) - self.labelNumber.setStyleSheet(str(styleSheets['addForm']['labelNumber'])) - self.lineEditNumber.setStyleSheet(str(styleSheets['addForm']['lineEditNumber'])) - except: - pass - - # Добавление функций к объектам - self.Section.activated.connect(lambda: self.selectionClicked(self.Section.currentText())) - self.backButton.clicked.connect(lambda: self.close()) - self.nextButton.clicked.connect(lambda: self.next()) - - self.Section.addItem("Изобразительные памятники") - self.Section.addItem("Нумизматика") - self.Section.addItem("Археология") - self.Section.addItem("Предметы этнографии") - self.Section.addItem("Оружие") - self.Section.addItem("Документы, фотографии") - self.Section.addItem("Предметы исторической техники") - self.Section.addItem("Предметы печатной продукции") - self.Section.addItem("Прочее") - - self.selectionClicked(self.Section.currentText()) + try: + self.Title.setStyleSheet(str(styleSheets['addForm']['Title'])) + self.labelSelection.setStyleSheet(str(styleSheets['addForm']['labelSelection'])) + self.Section.setStyleSheet(str(styleSheets['addForm']['Section'])) + self.labelSubselection.setStyleSheet(str(styleSheets['addForm']['labelSubselection'])) + self.Subselection.setStyleSheet(str(styleSheets['addForm']['Subselection'])) + self.radioButtonFond_1.setStyleSheet(str(styleSheets['addForm']['radioButtonFond_1'])) + self.radioButtonFond_2.setStyleSheet(str(styleSheets['addForm']['radioButtonFond_2'])) + self.nextButton.setStyleSheet(str(styleSheets['addForm']['nextButton'])) + self.backButton.setStyleSheet(str(styleSheets['addForm']['backButton'])) + self.lineEditName.setStyleSheet(str(styleSheets['addForm']['lineEditName'])) + self.labelName.setStyleSheet(str(styleSheets['addForm']['labelName'])) + self.labelNumber.setStyleSheet(str(styleSheets['addForm']['labelNumber'])) + self.lineEditNumber.setStyleSheet(str(styleSheets['addForm']['lineEditNumber'])) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) + + # Добавление функций к объектам + self.Section.activated.connect(lambda: self.selectionClicked(self.Section.currentText())) + self.backButton.clicked.connect(lambda: self.close()) + self.nextButton.clicked.connect(lambda: self.next()) + + self.Section.addItem("Изобразительные памятники") + self.Section.addItem("Нумизматика") + self.Section.addItem("Археология") + self.Section.addItem("Предметы этнографии") + self.Section.addItem("Оружие") + self.Section.addItem("Документы, фотографии") + self.Section.addItem("Предметы исторической техники") + self.Section.addItem("Предметы печатной продукции") + self.Section.addItem("Прочее") + + self.selectionClicked(self.Section.currentText()) + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def retranslateUi(self, main): + logging.info(f'{self.__class__.__name__} - retranslateUi') Ui_addForm.retranslateUi(self, main) main.setWindowTitle("Редактирование экспоната") self.Title.setText("Редактировать экспонат") self.backButton.setText("Отмена") def selectionClicked(self, selection): # Установка подразделов в выпадающий список, в зависимости от выбранного раздела - self.Subselection.clear() + try: + logging.info(f'{self.__class__.__name__} - selectionClicked') + self.Subselection.clear() - if selection == 'Изобразительные памятники': - self.labelSubselection.setEnabled(True) - self.Subselection.setEnabled(True) + if selection == 'Изобразительные памятники': + self.labelSubselection.setEnabled(True) + self.Subselection.setEnabled(True) - self.Subselection.addItem("Живопись") - self.Subselection.addItem("Графика") - self.Subselection.addItem("Скульптуры") - self.Subselection.addItem('Другое') + self.Subselection.addItem("Живопись") + self.Subselection.addItem("Графика") + self.Subselection.addItem("Скульптуры") + self.Subselection.addItem('Другое') - elif selection == 'Нумизматика': - self.labelSubselection.setEnabled(True) - self.Subselection.setEnabled(True) + elif selection == 'Нумизматика': + self.labelSubselection.setEnabled(True) + self.Subselection.setEnabled(True) - self.Subselection.addItem("Монеты") - self.Subselection.addItem("Медали") - self.Subselection.addItem("Значки") + self.Subselection.addItem("Монеты") + self.Subselection.addItem("Медали") + self.Subselection.addItem("Значки") - elif selection == 'Предметы этнографии': - self.labelSubselection.setEnabled(True) - self.Subselection.setEnabled(True) + elif selection == 'Предметы этнографии': + self.labelSubselection.setEnabled(True) + self.Subselection.setEnabled(True) - self.Subselection.addItem('Предметы быта') - self.Subselection.addItem('Орудия труда') + self.Subselection.addItem('Предметы быта') + self.Subselection.addItem('Орудия труда') - elif selection == 'Предметы печатной продукции': - self.labelSubselection.setEnabled(True) - self.Subselection.setEnabled(True) + elif selection == 'Предметы печатной продукции': + self.labelSubselection.setEnabled(True) + self.Subselection.setEnabled(True) - self.Subselection.addItem('Книги') - self.Subselection.addItem('Брошуры, открытки') - self.Subselection.addItem('Плакаты') - self.Subselection.addItem('Другое') + self.Subselection.addItem('Книги') + self.Subselection.addItem('Брошуры, открытки') + self.Subselection.addItem('Плакаты') + self.Subselection.addItem('Другое') - else: - self.labelSubselection.setEnabled(False) - self.Subselection.setEnabled(False) + else: + self.labelSubselection.setEnabled(False) + self.Subselection.setEnabled(False) - self.nextButton.setEnabled(True) + self.nextButton.setEnabled(True) + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def next(self): # Переход на следующюю страницу и сохранение текущих характеристик - global selectionAdd - global subselectionAdd - global fondsAdd - global nameAdd - global numberAdd + try: + logging.info(f'{self.__class__.__name__} - next') + global selectionAdd + global subselectionAdd + global fondsAdd + global nameAdd + global numberAdd - selectionAdd = self.Section.currentText() - subselectionAdd = self.Subselection.currentText() + selectionAdd = self.Section.currentText() + subselectionAdd = self.Subselection.currentText() - if self.radioButtonFond_1.isChecked() == True: - fondsAdd = 'Основной фонд' - elif self.radioButtonFond_2.isChecked() == True: - fondsAdd = 'Научно-вспомогательный фонд' + if self.radioButtonFond_1.isChecked() == True: + fondsAdd = 'Основной фонд' + elif self.radioButtonFond_2.isChecked() == True: + fondsAdd = 'Научно-вспомогательный фонд' - nameAdd = self.lineEditName.text() - numberAdd = self.lineEditNumber.text() + nameAdd = self.lineEditName.text() + numberAdd = self.lineEditNumber.text() - wineditForm.hide() - wineditFormTwo.show() + wineditForm.hide() + wineditFormTwo.show() + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def Substitution(self): - self.Section.setCurrentText(forread[6]) - self.selectionClicked(self.Section.currentText()) - self.Subselection.setCurrentText(forread[7]) + try: + logging.info(f'{self.__class__.__name__} - Substitution') + self.Section.setCurrentText(forread[6]) + self.selectionClicked(self.Section.currentText()) + self.Subselection.setCurrentText(forread[7]) - if forread[0] == 'Основной фонд': - self.radioButtonFond_1.setChecked(True) - else: - self.radioButtonFond_2.setChecked(True) + if forread[0] == 'Основной фонд': + self.radioButtonFond_1.setChecked(True) + else: + self.radioButtonFond_2.setChecked(True) - self.lineEditName.setText(forread[1]) - self.lineEditNumber.setText(str(forread[2])) + self.lineEditName.setText(forread[1]) + self.lineEditNumber.setText(str(forread[2])) + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def close(self): + logging.info(f'{self.__class__.__name__} - close') wineditForm.hide() class editFormPartTwo(Ui_addFormTwo): def setupUi(self, main): - Ui_addFormTwo.setupUi(self, main) try: - main.setStyleSheet(styleSheets['WindowStyles']['addFormPartTwo']) - except: - pass + logging.info(f'{self.__class__.__name__} - setupUi') + Ui_addFormTwo.setupUi(self, main) + try: + main.setStyleSheet(styleSheets['WindowStyles']['addFormPartTwo']) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: # Установка иконки - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) - main.setWindowIcon(icon) - except: - pass + try: # Установка иконки + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) + main.setWindowIcon(icon) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - w, h = cgs('addFormPartTwo', 'Window', 2) # Установка геометрии объектов - main.resize(w, h) - main.setMaximumSize(w, h) - - x, y, w, h = cgs('addFormPartTwo', 'Title', 4) - self.Title.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addFormPartTwo', 'labelGifter', 4) - self.labelGifter.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addFormPartTwo', 'lineEditGifter', 4) - self.lineEditGifter.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addFormPartTwo', 'labelDescription', 4) - self.labelDescription.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addFormPartTwo', 'textEditDescription', 4) - self.textEditDescription.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addFormPartTwo', 'labelPoint', 4) - self.labelPoint.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addFormPartTwo', 'lineEditPoint', 4) - self.lineEditPoint.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addFormPartTwo', 'saveButton', 4) - self.saveButton.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('addFormPartTwo', 'backButton', 4) - self.backButton.setGeometry(QtCore.QRect(x, y, w, h)) - - font = QtGui.QFont() # Установка размера шрифта - font.setPointSize(int(geometry['addFormPartTwo']['FontTitle'])) - self.Title.setFont(font) - font.setPointSize(int(geometry['addFormPartTwo']['FontlabelGifter'])) - self.labelGifter.setFont(font) - font.setPointSize(int(geometry['addFormPartTwo']['FontlineEditGifter'])) - self.lineEditGifter.setFont(font) - font.setPointSize(int(geometry['addFormPartTwo']['FontlabelDescription'])) - self.labelDescription.setFont(font) - font.setPointSize(int(geometry['addFormPartTwo']['FonttextEditDescription'])) - self.textEditDescription.setFont(font) - font.setPointSize(int(geometry['addFormPartTwo']['FontlabelPoint'])) - self.labelPoint.setFont(font) - font.setPointSize(int(geometry['addFormPartTwo']['FontlineEditPoint'])) - self.lineEditPoint.setFont(font) - - self.backButton.setFont(ButtonFontPointSize) - self.saveButton.setFont(ButtonFontPointSize) - except: - pass + try: + w, h = cgs('addFormPartTwo', 'Window', 2) # Установка геометрии объектов + main.resize(w, h) + main.setMaximumSize(w, h) + + x, y, w, h = cgs('addFormPartTwo', 'Title', 4) + self.Title.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addFormPartTwo', 'labelGifter', 4) + self.labelGifter.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addFormPartTwo', 'lineEditGifter', 4) + self.lineEditGifter.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addFormPartTwo', 'labelDescription', 4) + self.labelDescription.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addFormPartTwo', 'textEditDescription', 4) + self.textEditDescription.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addFormPartTwo', 'labelPoint', 4) + self.labelPoint.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addFormPartTwo', 'lineEditPoint', 4) + self.lineEditPoint.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addFormPartTwo', 'saveButton', 4) + self.saveButton.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('addFormPartTwo', 'backButton', 4) + self.backButton.setGeometry(QtCore.QRect(x, y, w, h)) + + font = QtGui.QFont() # Установка размера шрифта + font.setPointSize(int(geometry['addFormPartTwo']['FontTitle'])) + self.Title.setFont(font) + font.setPointSize(int(geometry['addFormPartTwo']['FontlabelGifter'])) + self.labelGifter.setFont(font) + font.setPointSize(int(geometry['addFormPartTwo']['FontlineEditGifter'])) + self.lineEditGifter.setFont(font) + font.setPointSize(int(geometry['addFormPartTwo']['FontlabelDescription'])) + self.labelDescription.setFont(font) + font.setPointSize(int(geometry['addFormPartTwo']['FonttextEditDescription'])) + self.textEditDescription.setFont(font) + font.setPointSize(int(geometry['addFormPartTwo']['FontlabelPoint'])) + self.labelPoint.setFont(font) + font.setPointSize(int(geometry['addFormPartTwo']['FontlineEditPoint'])) + self.lineEditPoint.setFont(font) + + self.backButton.setFont(ButtonFontPointSize) + self.saveButton.setFont(ButtonFontPointSize) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - self.Title.setStyleSheet(str(styleSheets['addFormPartTwo']['Title'])) - self.labelGifter.setStyleSheet(str(styleSheets['addFormPartTwo']['labelGifter'])) - self.lineEditGifter.setStyleSheet(str(styleSheets['addFormPartTwo']['lineEditGifter'])) - self.labelDescription.setStyleSheet(str(styleSheets['addFormPartTwo']['labelDescription'])) - self.textEditDescription.setStyleSheet(str(styleSheets['addFormPartTwo']['textEditDescription'])) - self.labelPoint.setStyleSheet(str(styleSheets['addFormPartTwo']['labelPoint'])) - self.lineEditPoint.setStyleSheet(str(styleSheets['addFormPartTwo']['lineEditPoint'])) - self.saveButton.setStyleSheet(str(styleSheets['addFormPartTwo']['saveButton'])) - self.backButton.setStyleSheet(str(styleSheets['addFormPartTwo']['backButton'])) - except: - pass - - # Добавление функций к кнопкам - self.backButton.clicked.connect(lambda: self.back()) - self.saveButton.clicked.connect(lambda: self.save()) + try: + self.Title.setStyleSheet(str(styleSheets['addFormPartTwo']['Title'])) + self.labelGifter.setStyleSheet(str(styleSheets['addFormPartTwo']['labelGifter'])) + self.lineEditGifter.setStyleSheet(str(styleSheets['addFormPartTwo']['lineEditGifter'])) + self.labelDescription.setStyleSheet(str(styleSheets['addFormPartTwo']['labelDescription'])) + self.textEditDescription.setStyleSheet(str(styleSheets['addFormPartTwo']['textEditDescription'])) + self.labelPoint.setStyleSheet(str(styleSheets['addFormPartTwo']['labelPoint'])) + self.lineEditPoint.setStyleSheet(str(styleSheets['addFormPartTwo']['lineEditPoint'])) + self.saveButton.setStyleSheet(str(styleSheets['addFormPartTwo']['saveButton'])) + self.backButton.setStyleSheet(str(styleSheets['addFormPartTwo']['backButton'])) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) + + # Добавление функций к кнопкам + self.backButton.clicked.connect(lambda: self.back()) + self.saveButton.clicked.connect(lambda: self.save()) + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def retranslateUi(self, main): + logging.info(f'{self.__class__.__name__} - retranslateUi') Ui_addFormTwo.retranslateUi(self, main) main.setWindowTitle("Редактирование экспоната") self.Title.setText("Редактировать экспонат") self.saveButton.setText("Изменить") def save(self): # Сохранение экспаната в базу данных - selection = selectionAdd - subselection = subselectionAdd - fonds = fondsAdd - Name = nameAdd - number = numberAdd - gifter = self.lineEditGifter.text() - point = self.lineEditPoint.text() - description = self.textEditDescription.toPlainText() + try: + logging.info(f'{self.__class__.__name__} - save') + selection = selectionAdd + subselection = subselectionAdd + fonds = fondsAdd + Name = nameAdd + number = numberAdd + gifter = self.lineEditGifter.text() + point = self.lineEditPoint.text() + description = self.textEditDescription.toPlainText() - db = cluster['Все'] - collection = db['none'] + db = cluster['Все'] + collection = db['none'] - post = {'fonds': fonds, 'select': selection, 'subselect': subselection , 'Name': Name, 'number': number, 'gifter': gifter, 'point': point, 'description': description} + post = {'fonds': fonds, 'select': selection, 'subselect': subselection , 'Name': Name, 'number': number, 'gifter': gifter, 'point': point, 'description': description} - if Name != '': - if str(Name) == str(forread[1]): - collection.update_one({'Name': forread[1]}, {'$set': post}) - self.mainOpen() + if Name != '': + if str(Name) == str(forread[1]): + collection.update_one({'Name': forread[1]}, {'$set': post}) + self.mainOpen() - elif collection.count_documents({'Name': Name}) == 0: - collection.update_one({'Name': forread[1]}, {'$set': post}) - self.mainOpen() + elif collection.count_documents({'Name': Name}) == 0: + collection.update_one({'Name': forread[1]}, {'$set': post}) + self.mainOpen() + else: + messageBox('Ошибка названия', 'Введено название уже существующего экспоната', QMessageBox.Critical) else: - messageBox('Ошибка названия', 'Введено название уже существующего экспоната', QMessageBox.Critical) - else: - messageBox('Ошибка названия', 'Не введено название экспонат', QMessageBox.Critical) + messageBox('Ошибка названия', 'Не введено название экспонат', QMessageBox.Critical) + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def Substitution(self): - self.lineEditGifter.setText(forread[3]) - self.lineEditPoint.setText(forread[4]) - self.textEditDescription.setPlainText(forread[5]) + try: + logging.info(f'{self.__class__.__name__} - Substitution') + self.lineEditGifter.setText(forread[3]) + self.lineEditPoint.setText(forread[4]) + self.textEditDescription.setPlainText(forread[5]) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def back(self): + logging.info(f'{self.__class__.__name__} - back') wineditFormTwo.hide() wineditForm.show() def mainOpen(self): + logging.info(f'{self.__class__.__name__} - mainOpen') wineditFormTwo.hide() fondSelf.refresh() @@ -1571,367 +1791,435 @@ def mainOpen(self): class wSingIn(Ui_SingIn): def setupUi(self, main): - Ui_SingIn.setupUi(self, main) try: - main.setStyleSheet(styleSheets['WindowStyles']['wSingIn']) - except: - pass + logging.info(f'{self.__class__.__name__} - setupUi') + Ui_SingIn.setupUi(self, main) + try: + main.setStyleSheet(styleSheets['WindowStyles']['wSingIn']) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: # Установка иконки - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) - main.setWindowIcon(icon) - except: - pass + try: # Установка иконки + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) + main.setWindowIcon(icon) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - w, h = cgs('wSingIn', 'Window', 2) # Устанока геометрии объектов - main.resize(w, h) - main.setMaximumSize(w, h) - - x, y, w, h = cgs('wSingIn', 'Title', 4) - self.Title.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('wSingIn', 'listWidget', 4) - self.listWidget.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('wSingIn', 'editButton', 4) - self.editButton.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('wSingIn', 'addButton', 4) - self.addButton.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('wSingIn', 'removeButton', 4) - self.removeButton.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('wSingIn', 'exitButton', 4) - self.exitButton.setGeometry(QtCore.QRect(x, y, w, h)) - - font = QtGui.QFont() # Установка размера рифта - font.setPointSize(int(geometry['wSingIn']['FontTitle'])) - self.Title.setFont(font) - font.setPointSize(int(geometry['wSingIn']['FontlistWidget'])) - self.listWidget.setFont(font) - - self.editButton.setFont(ButtonFontPointSize) - self.addButton.setFont(ButtonFontPointSize) - self.removeButton.setFont(ButtonFontPointSize) - self.exitButton.setFont(ButtonFontPointSize) - except: - pass + try: + w, h = cgs('wSingIn', 'Window', 2) # Устанока геометрии объектов + main.resize(w, h) + main.setMaximumSize(w, h) + + x, y, w, h = cgs('wSingIn', 'Title', 4) + self.Title.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('wSingIn', 'listWidget', 4) + self.listWidget.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('wSingIn', 'editButton', 4) + self.editButton.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('wSingIn', 'addButton', 4) + self.addButton.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('wSingIn', 'removeButton', 4) + self.removeButton.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('wSingIn', 'exitButton', 4) + self.exitButton.setGeometry(QtCore.QRect(x, y, w, h)) + + font = QtGui.QFont() # Установка размера рифта + font.setPointSize(int(geometry['wSingIn']['FontTitle'])) + self.Title.setFont(font) + font.setPointSize(int(geometry['wSingIn']['FontlistWidget'])) + self.listWidget.setFont(font) + + self.editButton.setFont(ButtonFontPointSize) + self.addButton.setFont(ButtonFontPointSize) + self.removeButton.setFont(ButtonFontPointSize) + self.exitButton.setFont(ButtonFontPointSize) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - self.Title.setStyleSheet(str(styleSheets['wSingIn']['Title'])) - self.listWidget.setStyleSheet(str(styleSheets['wSingIn']['listWidget'])) - self.editButton.setStyleSheet(str(styleSheets['wSingIn']['editButton'])) - self.addButton.setStyleSheet(str(styleSheets['wSingIn']['addButton'])) - self.removeButton.setStyleSheet(str(styleSheets['wSingIn']['removeButton'])) - self.exitButton.setStyleSheet(str(styleSheets['wSingIn']['exitButton'])) - except: - pass - - self.exitButton.clicked.connect(lambda: winSingIn.close()) - self.addButton.clicked.connect(lambda: self.add()) - self.listWidget.itemDoubleClicked.connect(self.open) - self.editButton.clicked.connect(lambda: self.edit()) - self.removeButton.clicked.connect(lambda: self.showDialog()) - - global singInSelf - singInSelf = self + try: + self.Title.setStyleSheet(str(styleSheets['wSingIn']['Title'])) + self.listWidget.setStyleSheet(str(styleSheets['wSingIn']['listWidget'])) + self.editButton.setStyleSheet(str(styleSheets['wSingIn']['editButton'])) + self.addButton.setStyleSheet(str(styleSheets['wSingIn']['addButton'])) + self.removeButton.setStyleSheet(str(styleSheets['wSingIn']['removeButton'])) + self.exitButton.setStyleSheet(str(styleSheets['wSingIn']['exitButton'])) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) + + self.exitButton.clicked.connect(lambda: winSingIn.close()) + self.addButton.clicked.connect(lambda: self.add()) + self.listWidget.itemDoubleClicked.connect(self.open) + self.editButton.clicked.connect(lambda: self.edit()) + self.removeButton.clicked.connect(lambda: self.showDialog()) + + global singInSelf + singInSelf = self + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def retranslateUi(self, main): - Ui_SingIn.retranslateUi(self, main) - main.setWindowTitle("Выбор базы данных") + try: + logging.info(f'{self.__class__.__name__} - retranslateUi') + Ui_SingIn.retranslateUi(self, main) + main.setWindowTitle("Выбор базы данных") - self.listWidget.clear() - for item in config['databases']: - self.listWidget.addItem(item) + self.listWidget.clear() + for item in config['databases']: + self.listWidget.addItem(item) + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def add(self): + logging.info(f'{self.__class__.__name__} - add') uADB.setupUi(winAddDB) winAddDB.show() def showDialog(self): # Окно подтверждения о удалении экспоната из базы данных try: - name = str(self.listWidget.currentItem().text()) - except: - name = None - if name != None: - msgBox = QMessageBox() - msgBox.setIcon(QMessageBox.Information) - msgBox.setText("Вы действительно хотите удалить запись о этой базе данных?") - msgBox.setWindowTitle("Удалить эту запись?") + logging.info(f'{self.__class__.__name__} - showDialog') try: - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) - msgBox.setWindowIcon(icon) - except: - pass - msgBox.setIcon(QMessageBox.Question) - msgBox.setStandardButtons(QMessageBox.Yes | QMessageBox.Cancel) - - returnValue = msgBox.exec() - if returnValue == QMessageBox.Yes : - self.remove(name) + name = str(self.listWidget.currentItem().text()) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) + name = None + + if name != None: + msgBox = QMessageBox() + msgBox.setIcon(QMessageBox.Information) + msgBox.setText("Вы действительно хотите удалить запись о этой базе данных?") + msgBox.setWindowTitle("Удалить эту запись?") + try: + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) + msgBox.setWindowIcon(icon) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) + + msgBox.setIcon(QMessageBox.Question) + msgBox.setStandardButtons(QMessageBox.Yes | QMessageBox.Cancel) + + returnValue = msgBox.exec() + if returnValue == QMessageBox.Yes : + self.remove(name) + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def remove(self, name): try: + logging.info(f'{self.__class__.__name__} - remove') del config['databases'][name] with open(configWay, 'w+', encoding ="utf8") as configfile: config.write(configfile) uWSI.retranslateUi(winSingIn) - except: - pass + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def edit(self): try: + logging.info(f'{self.__class__.__name__} - edit') name = str(self.listWidget.currentItem().text()) connect = str(config['databases'][name]) uEDB.setLabels(name, connect) winEditDB.show() - except: - pass + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def open(self, item): - global cluster + try: + logging.info(f'{self.__class__.__name__} - open') + global cluster - name = str(item.text()) - connect = str(config['databases'][name]) + name = str(item.text()) + connect = str(config['databases'][name]) - test = 'No' - try: - cluster = MongoClient(connect) - cluster.server_info() - test = 'Ok' - except: - messageBox('Не удалось войти в базу данных', 'Проверьте соединение с интернетом и строку подключения на ошибки') + test = 'No' + try: + cluster = MongoClient(connect) + cluster.server_info() + test = 'Ok' - if test == 'Ok': - Main.show() - uimain.setTitle(Main, name) - winSingIn.close() + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) + messageBox('Не удалось войти в базу данных', 'Проверьте соединение с интернетом и строку подключения на ошибки') + + if test == 'Ok': + Main.show() + uimain.setTitle(Main, name) + winSingIn.close() + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл class wAddDB(Ui_addDB): def setupUi(self, main): - Ui_addDB.setupUi(self, main) try: - main.setStyleSheet(styleSheets['WindowStyles']['wAddDB']) - except: - pass + logging.info(f'{self.__class__.__name__} - setupUi') + Ui_addDB.setupUi(self, main) + try: + main.setStyleSheet(styleSheets['WindowStyles']['wAddDB']) - try: # Установка иконки - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) - main.setWindowIcon(icon) - except: - pass + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - w, h = cgs('wAddDB', 'Window', 2) # Устанока геометрии объектов - main.resize(w, h) - main.setMaximumSize(w, h) - - x, y, w, h = cgs('wAddDB', 'Title', 4) - self.Title.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('wAddDB', 'labelName', 4) - self.labelName.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('wAddDB', 'lineName', 4) - self.lineName.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('wAddDB', 'labelConnect', 4) - self.labelConnect.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('wAddDB', 'lineConnect', 4) - self.lineConnect.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('wAddDB', 'addButton', 4) - self.addButton.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('wAddDB', 'closeButton', 4) - self.closeButton.setGeometry(QtCore.QRect(x, y, w, h)) - - font = QtGui.QFont() # Установка размера рифта - font.setPointSize(int(geometry['wAddDB']['FontTitle'])) - self.Title.setFont(font) - font.setPointSize(int(geometry['wAddDB']['FontlabelName'])) - self.labelName.setFont(font) - font.setPointSize(int(geometry['wAddDB']['FontlineName'])) - self.lineName.setFont(font) - font.setPointSize(int(geometry['wAddDB']['FontlabelConnect'])) - self.labelConnect.setFont(font) - font.setPointSize(int(geometry['wAddDB']['FontlineConnect'])) - self.lineConnect.setFont(font) - - self.closeButton.setFont(ButtonFontPointSize) - self.addButton.setFont(ButtonFontPointSize) - except: - pass + try: # Установка иконки + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) + main.setWindowIcon(icon) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - self.Title.setStyleSheet(str(styleSheets['wAddDB']['Title'])) - self.labelName.setStyleSheet(str(styleSheets['wAddDB']['labelName'])) - self.lineName.setStyleSheet(str(styleSheets['wAddDB']['lineName'])) - self.labelConnect.setStyleSheet(str(styleSheets['wAddDB']['labelConnect'])) - self.lineConnect.setStyleSheet(str(styleSheets['wAddDB']['lineConnect'])) - self.addButton.setStyleSheet(str(styleSheets['wAddDB']['addButton'])) - self.closeButton.setStyleSheet(str(styleSheets['wAddDB']['closeButton'])) - except: - pass - - self.closeButton.clicked.connect(lambda: winAddDB.close()) - self.addButton.clicked.connect(lambda: self.add()) + try: + w, h = cgs('wAddDB', 'Window', 2) # Устанока геометрии объектов + main.resize(w, h) + main.setMaximumSize(w, h) + + x, y, w, h = cgs('wAddDB', 'Title', 4) + self.Title.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('wAddDB', 'labelName', 4) + self.labelName.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('wAddDB', 'lineName', 4) + self.lineName.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('wAddDB', 'labelConnect', 4) + self.labelConnect.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('wAddDB', 'lineConnect', 4) + self.lineConnect.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('wAddDB', 'addButton', 4) + self.addButton.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('wAddDB', 'closeButton', 4) + self.closeButton.setGeometry(QtCore.QRect(x, y, w, h)) + + font = QtGui.QFont() # Установка размера рифта + font.setPointSize(int(geometry['wAddDB']['FontTitle'])) + self.Title.setFont(font) + font.setPointSize(int(geometry['wAddDB']['FontlabelName'])) + self.labelName.setFont(font) + font.setPointSize(int(geometry['wAddDB']['FontlineName'])) + self.lineName.setFont(font) + font.setPointSize(int(geometry['wAddDB']['FontlabelConnect'])) + self.labelConnect.setFont(font) + font.setPointSize(int(geometry['wAddDB']['FontlineConnect'])) + self.lineConnect.setFont(font) + + self.closeButton.setFont(ButtonFontPointSize) + self.addButton.setFont(ButtonFontPointSize) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) + + try: + self.Title.setStyleSheet(str(styleSheets['wAddDB']['Title'])) + self.labelName.setStyleSheet(str(styleSheets['wAddDB']['labelName'])) + self.lineName.setStyleSheet(str(styleSheets['wAddDB']['lineName'])) + self.labelConnect.setStyleSheet(str(styleSheets['wAddDB']['labelConnect'])) + self.lineConnect.setStyleSheet(str(styleSheets['wAddDB']['lineConnect'])) + self.addButton.setStyleSheet(str(styleSheets['wAddDB']['addButton'])) + self.closeButton.setStyleSheet(str(styleSheets['wAddDB']['closeButton'])) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) + + self.closeButton.clicked.connect(lambda: winAddDB.close()) + self.addButton.clicked.connect(lambda: self.add()) + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def retranslateUi(self, main): + logging.info(f'{self.__class__.__name__} - retranslateUi') Ui_addDB.retranslateUi(self, main) main.setWindowTitle("Добавление базы данных") def add(self): - name = str(self.lineName.text()) - connect = str(self.lineConnect.text()) - if name.strip() != '' and connect.strip() != '': - test = 'No' - try: - connect.index(":") - cluster = MongoClient(connect) - cluster.server_info() - test = 'Ok' - except: - messageBox('Не удалось добавить базу данных', 'Проверьте соединение с интернетом и строку подключения на ошибки') - - if test == 'Ok': - config['databases'][name] = connect - with open(configWay, 'w+', encoding ="utf8") as configfile: - config.write(configfile) - winAddDB.close() - uWSI.retranslateUi(winSingIn) + try: + logging.info(f'{self.__class__.__name__} - add') + name = str(self.lineName.text()) + connect = str(self.lineConnect.text()) + if name.strip() != '' and connect.strip() != '': + test = 'No' + try: + connect.index(":") + cluster = MongoClient(connect) + cluster.server_info() + test = 'Ok' + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) + messageBox('Не удалось добавить базу данных', 'Проверьте соединение с интернетом и строку подключения на ошибки') + + if test == 'Ok': + config['databases'][name] = connect + with open(configWay, 'w+', encoding ="utf8") as configfile: + config.write(configfile) + winAddDB.close() + uWSI.retranslateUi(winSingIn) + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл class wEditDB(Ui_addDB): def setupUi(self, main): - Ui_addDB.setupUi(self, main) try: - main.setStyleSheet(styleSheets['WindowStyles']['wAddDB']) - except: - pass + logging.info(f'{self.__class__.__name__} - setupUi') + Ui_addDB.setupUi(self, main) + try: + main.setStyleSheet(styleSheets['WindowStyles']['wAddDB']) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: # Установка иконки - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) - main.setWindowIcon(icon) - except: - pass + try: # Установка иконки + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(logo), QtGui.QIcon.Selected, QtGui.QIcon.On) + main.setWindowIcon(icon) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - w, h = cgs('wAddDB', 'Window', 2) # Устанока геометрии объектов - main.resize(w, h) - main.setMaximumSize(w, h) - - x, y, w, h = cgs('wAddDB', 'Title', 4) - self.Title.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('wAddDB', 'labelName', 4) - self.labelName.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('wAddDB', 'lineName', 4) - self.lineName.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('wAddDB', 'labelConnect', 4) - self.labelConnect.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('wAddDB', 'lineConnect', 4) - self.lineConnect.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('wAddDB', 'addButton', 4) - self.addButton.setGeometry(QtCore.QRect(x, y, w, h)) - x, y, w, h = cgs('wAddDB', 'closeButton', 4) - self.closeButton.setGeometry(QtCore.QRect(x, y, w, h)) - - font = QtGui.QFont() # Установка размера рифта - font.setPointSize(int(geometry['wAddDB']['FontTitle'])) - self.Title.setFont(font) - font.setPointSize(int(geometry['wAddDB']['FontlabelName'])) - self.labelName.setFont(font) - font.setPointSize(int(geometry['wAddDB']['FontlineName'])) - self.lineName.setFont(font) - font.setPointSize(int(geometry['wAddDB']['FontlabelConnect'])) - self.labelConnect.setFont(font) - font.setPointSize(int(geometry['wAddDB']['FontlineConnect'])) - self.lineConnect.setFont(font) - - self.closeButton.setFont(ButtonFontPointSize) - self.addButton.setFont(ButtonFontPointSize) - except: - pass + try: + w, h = cgs('wAddDB', 'Window', 2) # Устанока геометрии объектов + main.resize(w, h) + main.setMaximumSize(w, h) + + x, y, w, h = cgs('wAddDB', 'Title', 4) + self.Title.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('wAddDB', 'labelName', 4) + self.labelName.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('wAddDB', 'lineName', 4) + self.lineName.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('wAddDB', 'labelConnect', 4) + self.labelConnect.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('wAddDB', 'lineConnect', 4) + self.lineConnect.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('wAddDB', 'addButton', 4) + self.addButton.setGeometry(QtCore.QRect(x, y, w, h)) + x, y, w, h = cgs('wAddDB', 'closeButton', 4) + self.closeButton.setGeometry(QtCore.QRect(x, y, w, h)) + + font = QtGui.QFont() # Установка размера рифта + font.setPointSize(int(geometry['wAddDB']['FontTitle'])) + self.Title.setFont(font) + font.setPointSize(int(geometry['wAddDB']['FontlabelName'])) + self.labelName.setFont(font) + font.setPointSize(int(geometry['wAddDB']['FontlineName'])) + self.lineName.setFont(font) + font.setPointSize(int(geometry['wAddDB']['FontlabelConnect'])) + self.labelConnect.setFont(font) + font.setPointSize(int(geometry['wAddDB']['FontlineConnect'])) + self.lineConnect.setFont(font) + + self.closeButton.setFont(ButtonFontPointSize) + self.addButton.setFont(ButtonFontPointSize) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) - try: - self.Title.setStyleSheet(str(styleSheets['wAddDB']['Title'])) - self.labelName.setStyleSheet(str(styleSheets['wAddDB']['labelName'])) - self.lineName.setStyleSheet(str(styleSheets['wAddDB']['lineName'])) - self.labelConnect.setStyleSheet(str(styleSheets['wAddDB']['labelConnect'])) - self.lineConnect.setStyleSheet(str(styleSheets['wAddDB']['lineConnect'])) - self.addButton.setStyleSheet(str(styleSheets['wAddDB']['addButton'])) - self.closeButton.setStyleSheet(str(styleSheets['wAddDB']['closeButton'])) - except: - pass - - self.closeButton.clicked.connect(lambda: winEditDB.close()) - self.addButton.clicked.connect(lambda: self.edit()) + try: + self.Title.setStyleSheet(str(styleSheets['wAddDB']['Title'])) + self.labelName.setStyleSheet(str(styleSheets['wAddDB']['labelName'])) + self.lineName.setStyleSheet(str(styleSheets['wAddDB']['lineName'])) + self.labelConnect.setStyleSheet(str(styleSheets['wAddDB']['labelConnect'])) + self.lineConnect.setStyleSheet(str(styleSheets['wAddDB']['lineConnect'])) + self.addButton.setStyleSheet(str(styleSheets['wAddDB']['addButton'])) + self.closeButton.setStyleSheet(str(styleSheets['wAddDB']['closeButton'])) + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) + + self.closeButton.clicked.connect(lambda: winEditDB.close()) + self.addButton.clicked.connect(lambda: self.edit()) + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def retranslateUi(self, main): + logging.info(f'{self.__class__.__name__} - retranslateUi') + Ui_addDB.retranslateUi(self, main) main.setWindowTitle("Изменение записи базы данных") self.Title.setText("Измененить запись базы данных") self.addButton.setText("Изменить") def setLabels(self, name, connect): - self.name = name - self.connect = connect - self.lineName.setText(name) - self.lineConnect.setText(connect) + try: + logging.info(f'{self.__class__.__name__} - setLabels') + + self.name = name + self.connect = connect + self.lineName.setText(name) + self.lineConnect.setText(connect) + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл def edit(self): - name = str(self.lineName.text()) - connect = str(self.lineConnect.text()) - test = 'No' try: - connect.index(":") - cluster = MongoClient(connect) - cluster.server_info() - test = 'Ok' - except: - messageBox('Не удалось изменить базу данных', 'Проверьте соединение с интернетом и строку подключения на ошибки') + logging.info(f'{self.__class__.__name__} - edit') + + name = str(self.lineName.text()) + connect = str(self.lineConnect.text()) + test = 'No' + try: + connect.index(":") + cluster = MongoClient(connect) + cluster.server_info() + test = 'Ok' + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) + messageBox('Не удалось изменить базу данных', 'Проверьте соединение с интернетом и строку подключения на ошибки') - if test == 'Ok': - del config['databases'][self.name] - config['databases'][name] = connect + if test == 'Ok': + del config['databases'][self.name] + config['databases'][name] = connect - with open(configWay, 'w+', encoding ="utf8") as configfile: - config.write(configfile) + with open(configWay, 'w+', encoding ="utf8") as configfile: + config.write(configfile) - uWSI.retranslateUi(winSingIn) - winEditDB.close() + uWSI.retranslateUi(winSingIn) + winEditDB.close() + + except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) # Вывожу ошибку в log файл + +try: + logging.info('windows initialization') + + app = QtWidgets.QApplication(sys.argv) + + Main = QtWidgets.QWidget() + uimain = main() + uimain.setupUi(Main) -app = QtWidgets.QApplication(sys.argv) + winForm = QtWidgets.QWidget() + uiaddForm = addForm() + uiaddForm.setupUi(winForm) -Main = QtWidgets.QWidget() -uimain = main() -uimain.setupUi(Main) + winaddFormTwo = QtWidgets.QWidget() + ui = addFormPartTwo() + ui.setupUi(winaddFormTwo) -winForm = QtWidgets.QWidget() -uiaddForm = addForm() -uiaddForm.setupUi(winForm) + wineditForm = QtWidgets.QWidget() + uieditForm = editForm() + uieditForm.setupUi(wineditForm) -winaddFormTwo = QtWidgets.QWidget() -ui = addFormPartTwo() -ui.setupUi(winaddFormTwo) + wineditFormTwo = QtWidgets.QWidget() + uEFT = editFormPartTwo() + uEFT.setupUi(wineditFormTwo) -wineditForm = QtWidgets.QWidget() -uieditForm = editForm() -uieditForm.setupUi(wineditForm) + winSingIn = QtWidgets.QWidget() + uWSI = wSingIn() + uWSI.setupUi(winSingIn) -wineditFormTwo = QtWidgets.QWidget() -uEFT = editFormPartTwo() -uEFT.setupUi(wineditFormTwo) + winAddDB = QtWidgets.QWidget() + uADB = wAddDB() + uADB.setupUi(winAddDB) -winSingIn = QtWidgets.QWidget() -uWSI = wSingIn() -uWSI.setupUi(winSingIn) + winEditDB = QtWidgets.QWidget() + uEDB = wEditDB() + uEDB.setupUi(winEditDB) -winAddDB = QtWidgets.QWidget() -uADB = wAddDB() -uADB.setupUi(winAddDB) + winSingIn.show() -winEditDB = QtWidgets.QWidget() -uEDB = wEditDB() -uEDB.setupUi(winEditDB) +except Exception: + logging.critical(traceback.format_exc().replace('"', '\'')) -winSingIn.show() sys.exit(app.exec_()) \ No newline at end of file diff --git a/Emook_code/search.py b/Emook_code/search.py new file mode 100644 index 0000000..0395d5f --- /dev/null +++ b/Emook_code/search.py @@ -0,0 +1,44 @@ +from thefuzz import fuzz +from thefuzz import process +def thefuzz_search(items: list, search: str): + a = [] + for item in items: + coincidence = fuzz.partial_ratio(item.lower(), search.lower()) # Получаю % совпадения + if coincidence != 0: + a.append([item, coincidence]) # Добавляется список ['текст', % совпадения] в список "a" + + N = len(a) + for i in range(N-1): # Пузырьковая сортировка списка вида: [['Текст1', 1], ['fwetfs', '2']] + for j in range(N-i-1): + if a[j][1] < a[j+1][1]: + a[j], a[j+1] = a[j+1], a[j] + + sort_n = [] + for i in range(len(a)): + sort_n.append(a[i][0]) # Делаю отсортированый список только из items + return sort_n + +def thefuzz_search_id(items: list, search: str): + a = [] + for item in items: + if item != '': + coincidence = fuzz.partial_ratio(item, search) # Получаю % совпадения + if coincidence != 0: + a.append([item, coincidence]) # Добавляется список ['текст', % совпадения] в список "a" + + N = len(a) + for i in range(N-1): # Пузырьковая сортировка списка вида: [['Текст1', 1], ['fwetfs', '2']] + for j in range(N-i-1): + if a[j][1] < a[j+1][1]: + a[j], a[j+1] = a[j+1], a[j] + + b = [] + for i in a: + if i not in b: + b.append(i) + a = b + + sort_n = [] + for i in range(len(a)): + sort_n.append(a[i][0]) # Делаю отсортированый список только из items + return sort_n \ No newline at end of file