fix report generation bug, change modality

This commit is contained in:
2025-01-28 14:17:01 +01:00
parent 1d213e1f6a
commit 2a451dc749
4 changed files with 8 additions and 6 deletions

View File

@@ -136,6 +136,7 @@ class MainUI(QtWidgets.QMainWindow, Ui_MainWindow):
def generateReport(self): def generateReport(self):
log.info("Generating Report") log.info("Generating Report")
report = ReportUi() report = ReportUi()
report.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal)
report.exec() report.exec()
def showLoanHistory(self): def showLoanHistory(self):

View File

@@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'c:\Users\aky547\GitHub\LibrarySystem\src\ui\sources\dialog_generateReport.ui' # Form implementation generated from reading ui file 'c:\Users\aky547\GitHub\LibrarySystem\src\ui\sources\dialog_generateReport.ui'
# #
# Created by: PyQt6 UI code generator 6.6.1 # Created by: PyQt6 UI code generator 6.7.1
# #
# WARNING: Any manual changes made to this file will be lost when pyuic6 is # WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing. # run again. Do not edit this file unless you know what you are doing.
@@ -12,6 +12,7 @@ from PyQt6 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object): class Ui_Dialog(object):
def setupUi(self, Dialog): def setupUi(self, Dialog):
Dialog.setObjectName("Dialog") Dialog.setObjectName("Dialog")
Dialog.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal)
Dialog.resize(375, 245) Dialog.resize(375, 245)
Dialog.setMinimumSize(QtCore.QSize(40, 0)) Dialog.setMinimumSize(QtCore.QSize(40, 0))
self.verticalLayout = QtWidgets.QVBoxLayout(Dialog) self.verticalLayout = QtWidgets.QVBoxLayout(Dialog)

View File

@@ -2,6 +2,9 @@
<ui version="4.0"> <ui version="4.0">
<class>Dialog</class> <class>Dialog</class>
<widget class="QDialog" name="Dialog"> <widget class="QDialog" name="Dialog">
<property name="windowModality">
<enum>Qt::NonModal</enum>
</property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>

View File

@@ -4,7 +4,6 @@ from src.logic import Database
from src.utils import stringToDate from src.utils import stringToDate
import sqlite3 as sql import sqlite3 as sql
class ReportThread(QThread): class ReportThread(QThread):
report_signal = pyqtSignal(str) report_signal = pyqtSignal(str)
report_progress_signal = pyqtSignal(int) report_progress_signal = pyqtSignal(int)
@@ -54,13 +53,11 @@ class ReportThread(QThread):
loan_action_date, loan_action_date,
] ]
) )
# # print(table)
# # wruitng the table to a file
if self.format == "tsv": if self.format == "tsv":
table = table.get_csv_string() table = table.get_csv_string()
tsv_table = table.replace(",", "\t") # .replace("Rückgabe", "Rückgabe") tsv_table = table.replace(",", "\t")
# write the file # write the file
with open("report.tsv", "w") as f: with open("report.tsv", "w", encoding="utf-8") as f:
f.write(tsv_table) f.write(tsv_table)
else: else:
with open("report.txt", "w", encoding="utf-8") as f: with open("report.txt", "w", encoding="utf-8") as f: