42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
from .dialog_sources.Ui_elsa_generator_confirm import Ui_Dialog
|
|
from PyQt6 import QtWidgets
|
|
|
|
|
|
class ElsaGenConfirm(QtWidgets.QDialog, Ui_Dialog):
|
|
def __init__(self, parent=None, data=None):
|
|
super(ElsaGenConfirm, self).__init__(parent)
|
|
self.setupUi(self)
|
|
self.setWindowTitle("Daten überprüfen")
|
|
self.chapter_title.setText(data["chapter"])
|
|
self.bookauthor.setText(data["book_author"])
|
|
self.book_title.setText(data["title"])
|
|
self.pages.setText(data["pages"])
|
|
self.chapter_authors.setText(data["text_author"])
|
|
self.buttonBox.button(
|
|
QtWidgets.QDialogButtonBox.StandardButton.Ok
|
|
).clicked.connect(self.send)
|
|
self.buttonBox.button(
|
|
QtWidgets.QDialogButtonBox.StandardButton.Cancel
|
|
).clicked.connect(self.close)
|
|
self.confirmed_data = None
|
|
|
|
def send(self):
|
|
data = {
|
|
"chapter": self.chapter_title.text(),
|
|
"book_author": self.bookauthor.text(),
|
|
"title": self.book_title.text(),
|
|
"pages": self.pages.text(),
|
|
"text_author": self.chapter_authors.text(),
|
|
}
|
|
# return data and close dialog
|
|
self.confirmed_data = data
|
|
self.accept()
|
|
|
|
|
|
def launch(data):
|
|
app = QtWidgets.QApplication([])
|
|
dialog = ElsaGenConfirm(data=data)
|
|
dialog.show()
|
|
app.exec()
|
|
return dialog.confirmed_data
|