From a51253c45c735556b70a125bd0145b0f80bdc6dc Mon Sep 17 00:00:00 2001 From: WorldTeacher <41587052+WorldTeacher@users.noreply.github.com> Date: Tue, 8 Oct 2024 10:15:10 +0200 Subject: [PATCH] make documentation toggleable by settings.yaml / cli --- src/ui/main_ui.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/ui/main_ui.py b/src/ui/main_ui.py index 208569e..c6d2603 100644 --- a/src/ui/main_ui.py +++ b/src/ui/main_ui.py @@ -87,7 +87,8 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow): self.activeUser = None self.activeState = "Rückgabe" self.docu = DocumentationThread() - self.docu.start() + if config.documentation: + self.docu.start() self.duedate.setDate(loanDate) # functions @@ -102,7 +103,8 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow): def shutdown(self, *args): #kill documentation thread log.info("Shutting down") - self.docu.terminate() + if config.documentation: + self.docu.terminate() sys.exit() @@ -139,6 +141,7 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow): settings = Settings() settings.exec() result = settings.result() + print(settings.settingschanged, settings.restart_required) if result == 1: #dialog to ask if program should be restarted dialog = QtWidgets.QMessageBox() @@ -165,7 +168,15 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow): def openDocumentation(self): log.info("Opening Documentation") - webbrowser.open("http://localhost:{}/".format(docport)) + if config.documentation: + webbrowser.open("http://localhost:{}/".format(docport)) + else: + dialog = QtWidgets.QMessageBox() + dialog.setWindowTitle("Dokumentation nicht verfügbar") + dialog.setIcon(QtWidgets.QMessageBox.Icon.Warning) + dialog.setWindowIcon(Icon("warning").icon) + dialog.setText("Dokumentation nicht verfügbar") + dialog.exec()