ui change, bugfix
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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"))
|
||||
|
||||
@@ -24,21 +24,14 @@
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="institution_name"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Leihdauer in Tagen</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Datenbank</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="5" column="1">
|
||||
<layout class="QGridLayout" name="databasesettings">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="database_name"/>
|
||||
@@ -93,32 +86,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Inaktive Nutzer
|
||||
Löschen nach</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="default_loan_duration">
|
||||
<property name="value">
|
||||
<number>7</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="delete_inactive_user_duration">
|
||||
<property name="maximum">
|
||||
<number>9999</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>365</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="7" column="1">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@@ -128,14 +96,14 @@ Löschen nach</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Bericht</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="6" column="1">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="2">
|
||||
<widget class="QToolButton" name="btn_select_report_path">
|
||||
@@ -206,6 +174,72 @@ Löschen nach</string>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="delete_inactive_user_duration">
|
||||
<property name="maximum">
|
||||
<number>9999</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>365</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>43</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Tage(n)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Inaktive Nutzer
|
||||
Löschen nach</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="default_loan_duration">
|
||||
<property name="value">
|
||||
<number>7</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>43</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Tage(n)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Leihdauer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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")
|
||||
Reference in New Issue
Block a user