enable documentation, add docport, fix newentry bug

This commit is contained in:
WorldTeacher
2024-10-07 08:30:04 +02:00
parent a1bb56597c
commit d67b2e0cdd

View File

@@ -1,9 +1,8 @@
import os
import sys
import atexit
import datetime
import webbrowser
from src import config, __email__
from src import config, __email__, docport
from src.logic import Database, Catalogue, Backup
from src.utils import stringToDate, Icon, Log
from src.utils import debugMessage as dbg
@@ -18,8 +17,7 @@ from .settings import Settings
from .newBook import NewBook
from .loans import LoanWindow
from .reportUi import ReportUi
from src.utils import launch_documentation
from PyQt6 import QtCore, QtWidgets, QtGui
from PyQt6 import QtCore, QtWidgets
from omegaconf import OmegaConf
from src.logic.documentation_thread import DocumentationThread
backup = Backup()
@@ -89,7 +87,7 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
self.activeUser = None
self.activeState = "Rückgabe"
self.docu = DocumentationThread()
# self.docu.start()
self.docu.start()
self.duedate.setDate(loanDate)
# functions
@@ -146,6 +144,7 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
dialog = QtWidgets.QMessageBox()
dialog.setWindowTitle("Einstellungen geändert")
dialog.setIcon(QtWidgets.QMessageBox.Icon.Information)
dialog.setWindowIcon(Icon("settings").icon)
dialog.setText("Einstellungen wurden geändert\nProgramm neu starten?")
dialog.setStandardButtons(
QtWidgets.QMessageBox.StandardButton.Yes
@@ -166,7 +165,7 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
def openDocumentation(self):
log.info("Opening Documentation")
webbrowser.open("http://localhost:6543")
webbrowser.open("http://localhost:{}/".format(docport))
@@ -277,6 +276,7 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
# set user to active user
self.setUserData()
self.activateLoanMode()
self.input_file_ident.setPlaceholderText("Buchidentifikation eingeben")
self.input_file_ident.setFocus()
@@ -421,15 +421,16 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
return
newentry = NewEntry([book_id[0]])
newentry.exec()
self.setStatusTipMessage("Neues Exemplar hinzugefügt")
#print(created_ids)
self.input_file_ident.setEnabled(True)
newentries = newentry.newIds
if newentries:
for entry in newentries:
book = self.db.getMedia(entry)
self.loanMedia(user_id, [entry], book)
dbg("inserted duplicated book into database")
if newentry.result() == 1: # only create dialog if new entry was created
self.setStatusTipMessage("Neues Exemplar hinzugefügt")
#print(created_ids)
self.input_file_ident.setEnabled(True)
newentries = newentry.newIds
if newentries:
for entry in newentries:
book = self.db.getMedia(entry)
self.loanMedia(user_id, [entry], book)
dbg("inserted duplicated book into database")
return
else:
#print("Book not loaned, loaning now")