UI: changes to new edition UIs
This commit is contained in:
@@ -4,9 +4,8 @@ import loguru
|
||||
from PySide6 import QtCore, QtWidgets
|
||||
|
||||
from src import LOG_DIR
|
||||
from src.backend.database import Database
|
||||
from src.backend.catalogue import Catalogue
|
||||
|
||||
from src.backend.database import Database
|
||||
from src.ui.dialogs.mail import Mail_Dialog
|
||||
|
||||
from .dialog_sources.order_neweditions_ui import Ui_Dialog
|
||||
@@ -33,8 +32,9 @@ class NewEditionDialog(QtWidgets.QDialog, Ui_Dialog):
|
||||
def populateTable(self):
|
||||
for book in self.books:
|
||||
signature = book.signature
|
||||
if signature is None or signature == "None":
|
||||
signature = self.catalogue.get_signature(book.ppn)
|
||||
# if signature is None or signature == "None" and book.ppn is not None:
|
||||
# signature = self.catalogue.get_signature(f"kid:{book.ppn}")
|
||||
# book.signature = signature
|
||||
link_label = QtWidgets.QLabel()
|
||||
link = (
|
||||
book.link
|
||||
@@ -52,8 +52,10 @@ class NewEditionDialog(QtWidgets.QDialog, Ui_Dialog):
|
||||
self.tableWidget.insertRow(0)
|
||||
# first column is checkbox for ordering
|
||||
checkbox = QtWidgets.QCheckBox()
|
||||
|
||||
checkbox.setChecked(False)
|
||||
checked = True if not book.signature else False
|
||||
if book.library_location is not None:
|
||||
checked = True if "hb" in book.library_location else checked
|
||||
checkbox.setChecked(checked)
|
||||
self.tableWidget.setCellWidget(0, 0, checkbox)
|
||||
self.tableWidget.setItem(
|
||||
0,
|
||||
@@ -63,12 +65,17 @@ class NewEditionDialog(QtWidgets.QDialog, Ui_Dialog):
|
||||
),
|
||||
)
|
||||
self.tableWidget.setItem(0, 2, QtWidgets.QTableWidgetItem(book.title))
|
||||
self.tableWidget.setItem(
|
||||
0, 3, QtWidgets.QTableWidgetItem(",".join(book.isbn))
|
||||
isbn = (
|
||||
book.isbn[0]
|
||||
if isinstance(book.isbn, list) and len(book.isbn) > 0
|
||||
else book.isbn
|
||||
)
|
||||
self.tableWidget.setItem(0, 3, QtWidgets.QTableWidgetItem(isbn))
|
||||
self.tableWidget.setItem(0, 4, QtWidgets.QTableWidgetItem(book.author))
|
||||
self.tableWidget.setItem(0, 5, QtWidgets.QTableWidgetItem(book.edition))
|
||||
self.tableWidget.setItem(0, 6, QtWidgets.QTableWidgetItem(book.library_location))
|
||||
self.tableWidget.setItem(
|
||||
0, 6, QtWidgets.QTableWidgetItem(book.library_location)
|
||||
)
|
||||
self.tableWidget.setCellWidget(0, 7, link_label)
|
||||
|
||||
def orderBooks(self):
|
||||
@@ -82,11 +89,12 @@ class NewEditionDialog(QtWidgets.QDialog, Ui_Dialog):
|
||||
if book.link != "SWB"
|
||||
else f"https://www.lehmanns.de/search/quick?mediatype_id=&q={book.isbn[0]}"
|
||||
)
|
||||
print(f"Bestelle Neuauflage für {book.title} ({book.edition})")
|
||||
# print(f"Bestelle Neuauflage für {book.title} ({book.edition})")
|
||||
book.isbn = [book.isbn] if isinstance(book.isbn, str) else book.isbn
|
||||
ordered_books.append(book)
|
||||
# Process ordered_books as needed
|
||||
# editionId = self.db.getNewEditionId(book)
|
||||
# self.db.setOrdered(editionId)
|
||||
# Process ordered_books as needed
|
||||
editionId = self.db.getNewEditionId(book)
|
||||
self.db.setOrdered(editionId)
|
||||
|
||||
self.mail = Mail_Dialog(
|
||||
app_id=self.mail_data.get("app_nr"),
|
||||
|
||||
Reference in New Issue
Block a user