rework documentation launch, use generated files instead of pure mkdocs, add quiet handler for use with logging in terminal
This commit is contained in:
@@ -12,7 +12,7 @@ from typing import Any, Union
|
||||
import loguru
|
||||
from natsort import natsorted
|
||||
from PySide6 import QtCore, QtGui, QtWidgets
|
||||
from PySide6.QtCore import QThread
|
||||
from PySide6.QtCore import QThread, Qt
|
||||
from PySide6.QtGui import QRegularExpressionValidator
|
||||
|
||||
from src import LOG_DIR, Icon
|
||||
@@ -23,7 +23,6 @@ from src.backend.semester import Semester
|
||||
from src.logic import (
|
||||
APP_NRS,
|
||||
Apparat,
|
||||
# PROF_TITLES,
|
||||
ApparatData,
|
||||
BookData,
|
||||
Prof,
|
||||
@@ -118,7 +117,7 @@ class Ui(Ui_Semesterapparat):
|
||||
# Actions
|
||||
self.actionEinstellungen.triggered.connect(self.open_settings) # type:ignore
|
||||
Icon("settings", self.actionEinstellungen)
|
||||
self.actionDokumentation_lokal.triggered.connect(self.open_documentation) # type:ignore
|
||||
self.documentation_open = False
|
||||
Icon("offAction", self.actionBeenden)
|
||||
self.actionBeenden.triggered.connect(self.quit) # type:ignore
|
||||
self.actionAbout.triggered.connect(self.open_about) # type:ignore
|
||||
@@ -204,7 +203,7 @@ class Ui(Ui_Semesterapparat):
|
||||
self.add_medium.setEnabled(False)
|
||||
self.docu = DocumentationThread()
|
||||
|
||||
self.actionDokumentation_lokal.triggered.connect(self.open_documentation) # type:ignore
|
||||
self.actionDokumentation.triggered.connect(self.open_documentation) # type:ignore
|
||||
|
||||
# get all current apparats and cache them in a list
|
||||
self.apparats = self.get_apparats()
|
||||
@@ -329,10 +328,16 @@ class Ui(Ui_Semesterapparat):
|
||||
|
||||
def open_documentation(self):
|
||||
log.info("Opening Documentation")
|
||||
if not self.docu.isRunning():
|
||||
self.statusBar.showMessage("Dokumentation wird geöffnet", 5000)
|
||||
|
||||
if not self.documentation_open:
|
||||
# write "opening documentation in 5s into status bar"
|
||||
self.documentation_open = True
|
||||
self.docu.start()
|
||||
time.sleep(5)
|
||||
time.sleep(5)
|
||||
|
||||
webbrowser.open("http://localhost:8000")
|
||||
self.statusBar.showMessage("")
|
||||
|
||||
def update_calendar(self, data: list[dict[str, Any]]):
|
||||
self.calendarWidget.setMessages([data])
|
||||
@@ -1832,8 +1837,14 @@ def launch_gui():
|
||||
# #log.debug(aui.active_user)
|
||||
MainWindow.show()
|
||||
# atexit.register()
|
||||
app.aboutToQuit.connect(
|
||||
aui.validate_thread.quit
|
||||
) # if that thread uses an event loop
|
||||
app.aboutToQuit.connect(aui.docu.terminate) # our new slot
|
||||
app.aboutToQuit.connect(aui.docu.wait)
|
||||
atexit.register(tempdelete)
|
||||
atexit.register(aui.validate_thread.quit)
|
||||
# atexit.register(aui.validate_thread.quit)
|
||||
# atexit.register(aui.docu.quit)
|
||||
sys.exit(app.exec())
|
||||
|
||||
elif ui.lresult == 0:
|
||||
|
||||
Reference in New Issue
Block a user