Remove unused imports and clean up code structure across multiple files
This commit is contained in:
@@ -13,7 +13,7 @@ from loguru import logger as log
|
||||
|
||||
logger = log
|
||||
logger.remove()
|
||||
logger.add("logs/application.log", rotation="1 week", enqueue=True)
|
||||
logger.add("logs/application.log", rotation="1 week", retention="1 month", enqueue=True)
|
||||
log.add("logs/searchPage.log", enqueue=True)
|
||||
|
||||
# logger.add(sys.stderr, format="{time} {level} {message}", level="INFO")
|
||||
@@ -46,7 +46,6 @@ class SearchStatisticPage(QtWidgets.QDialog, Ui_Dialog):
|
||||
self.statistics_table.doubleClicked.connect(self.display_detailed_data)
|
||||
self.tabWidget_2.currentChanged.connect(self.tabW2_changed)
|
||||
self.btn_search.clicked.connect(self.statistics)
|
||||
self.book_search.clicked.connect(self.search_book)
|
||||
self.tableWidget.customContextMenuRequested.connect(
|
||||
self.statistics_table_context_menu
|
||||
)
|
||||
@@ -69,6 +68,8 @@ class SearchStatisticPage(QtWidgets.QDialog, Ui_Dialog):
|
||||
# set tableWidget column 0 to be 50px wide
|
||||
self.tableWidget.setColumnWidth(0, 50)
|
||||
self.semester = Semester().value
|
||||
self.search_by_signature.returnPressed.connect(self.search_book)
|
||||
self.search_by_title.returnPressed.connect(self.search_book)
|
||||
self.populate_tab()
|
||||
|
||||
def restore_apparat(self):
|
||||
@@ -143,7 +144,7 @@ class SearchStatisticPage(QtWidgets.QDialog, Ui_Dialog):
|
||||
|
||||
def search_book(self):
|
||||
self.book_search_result.setRowCount(0)
|
||||
signature = self.seach_by_signature.text()
|
||||
signature = self.search_by_signature.text()
|
||||
title = self.search_by_title.text()
|
||||
params = {
|
||||
"signature": signature if signature != "" else None,
|
||||
@@ -155,6 +156,7 @@ class SearchStatisticPage(QtWidgets.QDialog, Ui_Dialog):
|
||||
if retdata is None:
|
||||
return
|
||||
for book in retdata:
|
||||
logger.debug(book)
|
||||
self.book_search_result.insertRow(0)
|
||||
self.book_search_result.setItem(
|
||||
0, 0, QtWidgets.QTableWidgetItem(book[0].title)
|
||||
@@ -166,7 +168,12 @@ class SearchStatisticPage(QtWidgets.QDialog, Ui_Dialog):
|
||||
self.book_search_result.setItem(
|
||||
0,
|
||||
2,
|
||||
QtWidgets.QTableWidgetItem(self.db.getApparatName(book[1], book[2])),
|
||||
QtWidgets.QTableWidgetItem(
|
||||
self.db.fetch_one(
|
||||
"SELECT semesterapparat.appnr || ' (' || semesterapparat.name || ')' AS formatted_result from semesterapparat WHERE semesterapparat.appnr = ?",
|
||||
(book[1],),
|
||||
)[0],
|
||||
),
|
||||
)
|
||||
|
||||
def notify_for_deletion(self):
|
||||
|
||||
Reference in New Issue
Block a user