diff --git a/src/ui/main_ui.py b/src/ui/main_ui.py index 3df118c..a438700 100644 --- a/src/ui/main_ui.py +++ b/src/ui/main_ui.py @@ -68,7 +68,6 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow): ) self.input_file_ident.setFocus() # self.userdata.textChanged.connect(lambda: self.mode.setText("Ausleihe")) - # self.input_userno. # variables self.db = Database() self.currentDate = QtCore.QDate.currentDate() diff --git a/src/ui/sources/Ui_dialog_settings.py b/src/ui/sources/Ui_dialog_settings.py index 81171d8..e57fe1a 100644 --- a/src/ui/sources/Ui_dialog_settings.py +++ b/src/ui/sources/Ui_dialog_settings.py @@ -21,12 +21,9 @@ class Ui_Dialog(object): self.institution_name = QtWidgets.QLineEdit(parent=Dialog) self.institution_name.setObjectName("institution_name") self.formLayout.setWidget(0, QtWidgets.QFormLayout.ItemRole.FieldRole, self.institution_name) - self.label_2 = QtWidgets.QLabel(parent=Dialog) - self.label_2.setObjectName("label_2") - self.formLayout.setWidget(1, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_2) self.label_3 = QtWidgets.QLabel(parent=Dialog) self.label_3.setObjectName("label_3") - self.formLayout.setWidget(3, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_3) + self.formLayout.setWidget(5, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_3) self.databasesettings = QtWidgets.QGridLayout() self.databasesettings.setObjectName("databasesettings") self.database_name = QtWidgets.QLineEdit(parent=Dialog) @@ -56,27 +53,15 @@ class Ui_Dialog(object): self.btn_select_database_backupLocation = QtWidgets.QToolButton(parent=Dialog) self.btn_select_database_backupLocation.setObjectName("btn_select_database_backupLocation") self.databasesettings.addWidget(self.btn_select_database_backupLocation, 2, 2, 1, 1) - self.formLayout.setLayout(3, QtWidgets.QFormLayout.ItemRole.FieldRole, self.databasesettings) - self.label_7 = QtWidgets.QLabel(parent=Dialog) - self.label_7.setObjectName("label_7") - self.formLayout.setWidget(2, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_7) - self.default_loan_duration = QtWidgets.QSpinBox(parent=Dialog) - self.default_loan_duration.setProperty("value", 7) - self.default_loan_duration.setObjectName("default_loan_duration") - self.formLayout.setWidget(1, QtWidgets.QFormLayout.ItemRole.FieldRole, self.default_loan_duration) - self.delete_inactive_user_duration = QtWidgets.QSpinBox(parent=Dialog) - self.delete_inactive_user_duration.setMaximum(9999) - self.delete_inactive_user_duration.setProperty("value", 365) - self.delete_inactive_user_duration.setObjectName("delete_inactive_user_duration") - self.formLayout.setWidget(2, QtWidgets.QFormLayout.ItemRole.FieldRole, self.delete_inactive_user_duration) + self.formLayout.setLayout(5, QtWidgets.QFormLayout.ItemRole.FieldRole, self.databasesettings) self.buttonBox = QtWidgets.QDialogButtonBox(parent=Dialog) self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.StandardButton.Cancel|QtWidgets.QDialogButtonBox.StandardButton.Discard|QtWidgets.QDialogButtonBox.StandardButton.Ok) self.buttonBox.setObjectName("buttonBox") - self.formLayout.setWidget(5, QtWidgets.QFormLayout.ItemRole.FieldRole, self.buttonBox) + self.formLayout.setWidget(7, QtWidgets.QFormLayout.ItemRole.FieldRole, self.buttonBox) self.label_9 = QtWidgets.QLabel(parent=Dialog) self.label_9.setObjectName("label_9") - self.formLayout.setWidget(4, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_9) + self.formLayout.setWidget(6, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_9) self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.btn_select_report_path = QtWidgets.QToolButton(parent=Dialog) @@ -106,7 +91,36 @@ class Ui_Dialog(object): self.report_day.addItem("") self.report_day.addItem("") self.gridLayout.addWidget(self.report_day, 0, 1, 1, 1) - self.formLayout.setLayout(4, QtWidgets.QFormLayout.ItemRole.FieldRole, self.gridLayout) + self.formLayout.setLayout(6, QtWidgets.QFormLayout.ItemRole.FieldRole, self.gridLayout) + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.delete_inactive_user_duration = QtWidgets.QSpinBox(parent=Dialog) + self.delete_inactive_user_duration.setMaximum(9999) + self.delete_inactive_user_duration.setProperty("value", 365) + self.delete_inactive_user_duration.setObjectName("delete_inactive_user_duration") + self.horizontalLayout.addWidget(self.delete_inactive_user_duration) + self.label_12 = QtWidgets.QLabel(parent=Dialog) + self.label_12.setMaximumSize(QtCore.QSize(43, 16777215)) + self.label_12.setObjectName("label_12") + self.horizontalLayout.addWidget(self.label_12) + self.formLayout.setLayout(3, QtWidgets.QFormLayout.ItemRole.FieldRole, self.horizontalLayout) + self.label_7 = QtWidgets.QLabel(parent=Dialog) + self.label_7.setObjectName("label_7") + self.formLayout.setWidget(3, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_7) + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.default_loan_duration = QtWidgets.QSpinBox(parent=Dialog) + self.default_loan_duration.setProperty("value", 7) + self.default_loan_duration.setObjectName("default_loan_duration") + self.horizontalLayout_2.addWidget(self.default_loan_duration) + self.label_13 = QtWidgets.QLabel(parent=Dialog) + self.label_13.setMaximumSize(QtCore.QSize(43, 16777215)) + self.label_13.setObjectName("label_13") + self.horizontalLayout_2.addWidget(self.label_13) + self.formLayout.setLayout(1, QtWidgets.QFormLayout.ItemRole.FieldRole, self.horizontalLayout_2) + self.label_2 = QtWidgets.QLabel(parent=Dialog) + self.label_2.setObjectName("label_2") + self.formLayout.setWidget(1, QtWidgets.QFormLayout.ItemRole.LabelRole, self.label_2) self.retranslateUi(Dialog) self.buttonBox.accepted.connect(Dialog.accept) # type: ignore @@ -123,7 +137,6 @@ class Ui_Dialog(object): _translate = QtCore.QCoreApplication.translate Dialog.setWindowTitle(_translate("Dialog", "Dialog")) self.label.setText(_translate("Dialog", "Name der Einrichtung")) - self.label_2.setText(_translate("Dialog", "Leihdauer in Tagen")) self.label_3.setText(_translate("Dialog", "Datenbank")) self.label_4.setText(_translate("Dialog", "Speicherort")) self.label_6.setText(_translate("Dialog", "Sicherungspfad")) @@ -131,8 +144,6 @@ class Ui_Dialog(object): self.btn_select_database_path.setText(_translate("Dialog", "...")) self.btn_select_database_name.setText(_translate("Dialog", "...")) self.btn_select_database_backupLocation.setText(_translate("Dialog", "...")) - self.label_7.setText(_translate("Dialog", "Inaktive Nutzer\n" -"Löschen nach")) self.label_9.setText(_translate("Dialog", "Bericht")) self.btn_select_report_path.setText(_translate("Dialog", "...")) self.check_generate_report.setText(_translate("Dialog", "Bericht erstellen")) @@ -143,3 +154,8 @@ class Ui_Dialog(object): self.report_day.setItemText(2, _translate("Dialog", "Mittwoch")) self.report_day.setItemText(3, _translate("Dialog", "Donnerstag")) self.report_day.setItemText(4, _translate("Dialog", "Freitag")) + self.label_12.setText(_translate("Dialog", "Tage(n)")) + self.label_7.setText(_translate("Dialog", "Inaktive Nutzer\n" +"Löschen nach")) + self.label_13.setText(_translate("Dialog", "Tage(n)")) + self.label_2.setText(_translate("Dialog", "Leihdauer")) diff --git a/src/ui/sources/dialog_settings.ui b/src/ui/sources/dialog_settings.ui index c41caff..70430d4 100644 --- a/src/ui/sources/dialog_settings.ui +++ b/src/ui/sources/dialog_settings.ui @@ -24,21 +24,14 @@ - - - - Leihdauer in Tagen - - - - + Datenbank - + @@ -93,32 +86,7 @@ - - - - Inaktive Nutzer -Löschen nach - - - - - - - 7 - - - - - - - 9999 - - - 365 - - - - + Qt::Horizontal @@ -128,14 +96,14 @@ Löschen nach - + Bericht - + @@ -206,6 +174,72 @@ Löschen nach + + + + + + 9999 + + + 365 + + + + + + + + 43 + 16777215 + + + + Tage(n) + + + + + + + + + Inaktive Nutzer +Löschen nach + + + + + + + + + 7 + + + + + + + + 43 + 16777215 + + + + Tage(n) + + + + + + + + + Leihdauer + + + diff --git a/src/ui/user.py b/src/ui/user.py index e28b2be..2076cd8 100644 --- a/src/ui/user.py +++ b/src/ui/user.py @@ -79,7 +79,6 @@ class UserUI(QtWidgets.QMainWindow, Ui_MainWindow): # print(signature) self.db.extendLoanDuration(signature, extendDate) self.userMedia = [] - break self.UserMediaTable.setRowCount(0) self.loadMedia() return diff --git a/src/utils/config.py b/src/utils/config.py deleted file mode 100644 index 67d004f..0000000 --- a/src/utils/config.py +++ /dev/null @@ -1,71 +0,0 @@ -from typing import Optional - -import omegaconf - -class Config: - _config: Optional[omegaconf.DictConfig] = None - - def __init__(self, config_path: str): - """ - Loads the configuration file and stores it for future access. - - Args: - config_path (str): Path to the YAML configuration file. - """ - self._config = omegaconf.OmegaConf.load(config_path) - - @property - def institution_name(self)->str: - if self._config is None: - raise RuntimeError("Configuration not loaded") - return self._config.institution_name - @property - def loan_duration(self)->int: - if self._config is None: - raise RuntimeError("Configuration not loaded") - return self._config.default_loan_duration - @property - def delete_inactive_user_duration(self)->int: - if self._config is None: - raise RuntimeError("Configuration not loaded") - return self._config.inactive_user_deletion - @property - def catalogue(self)->bool: - if self._config is None: - raise RuntimeError("Configuration not loaded") - return self._config.catalogue - @property - def database(self)->omegaconf.DictConfig: - if self._config is None: - raise RuntimeError("Configuration not loaded") - return self._config.database - - @property - def report(self)->omegaconf.DictConfig: - if self._config is None: - raise RuntimeError("Configuration not loaded") - return self._config.report - @property - def debug(self)->bool: - if self._config is None: - raise RuntimeError("Configuration not loaded") - return self._config.debug - @property - def log_debug(self)->bool: - if self._config is None: - raise RuntimeError("Configuration not loaded") - return self._config.log_debug - - - def updateValue(self, key: str, value: str): - self._config[key] = value - omegaconf.OmegaConf.save(self._config, "config/settings.yaml") - - - - -if __name__ == "__main__": - cfg = Config("config/settings.yaml") - print(cfg.database.path) - - #cfg.updateValue("database.path", "Test") \ No newline at end of file