Add book title to read dialog
This commit is contained in:
@@ -67,6 +67,7 @@ class ReadDialog(QDialog, Ui_Dialog):
|
||||
# End overrides
|
||||
#
|
||||
self.load_book(self.person_id)
|
||||
self.titleLbl.setText(self.book_title)
|
||||
blockNumber = self.block
|
||||
self.paraEdit.setReadOnly(True)
|
||||
self.paraEdit.document().setDefaultStyleSheet(styleSheet)
|
||||
@@ -298,10 +299,12 @@ class ReadDialog(QDialog, Ui_Dialog):
|
||||
def load_book(self, person_id: int) -> None:
|
||||
query = QSqlQuery()
|
||||
query.prepare(
|
||||
"SELECT pb.* FROM people p "
|
||||
"SELECT pb.*,b.title FROM people p "
|
||||
"LEFT JOIN person_book pb "
|
||||
"ON (p.book_id = pb.book_id "
|
||||
"AND p.person_id = pb.person_id) "
|
||||
"LEFT JOIN books b "
|
||||
"ON (p.book_id = b.book_id) "
|
||||
"WHERE p.person_id = :person_id"
|
||||
)
|
||||
query.bindValue(":person_id", person_id)
|
||||
@@ -310,6 +313,7 @@ class ReadDialog(QDialog, Ui_Dialog):
|
||||
if not query.next():
|
||||
self.done(0)
|
||||
self.book_id = query.value("book_id")
|
||||
self.book_title = query.value("title")
|
||||
self.section_id = query.value("section_id")
|
||||
self.block = query.value("block")
|
||||
self.sections = []
|
||||
|
||||
@@ -21,9 +21,10 @@ class Ui_Dialog(object):
|
||||
self.page.setObjectName("page")
|
||||
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.page)
|
||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||
self.label = QtWidgets.QLabel(parent=self.page)
|
||||
self.label.setObjectName("label")
|
||||
self.verticalLayout_2.addWidget(self.label)
|
||||
self.titleLbl = QtWidgets.QLabel(parent=self.page)
|
||||
self.titleLbl.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
|
||||
self.titleLbl.setObjectName("titleLbl")
|
||||
self.verticalLayout_2.addWidget(self.titleLbl)
|
||||
self.paraEdit = QtWidgets.QTextEdit(parent=self.page)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("OpenDyslexic")
|
||||
@@ -85,7 +86,7 @@ class Ui_Dialog(object):
|
||||
def retranslateUi(self, Dialog):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
Dialog.setWindowTitle(_translate("Dialog", "Reader"))
|
||||
self.label.setText(_translate("Dialog", "TextLabel"))
|
||||
self.titleLbl.setText(_translate("Dialog", "TextLabel"))
|
||||
self.defineBtn.setText(_translate("Dialog", "Show Def"))
|
||||
self.returnBtn.setText(_translate("Dialog", "Return"))
|
||||
self.playBtn.setText(_translate("Dialog", "Play"))
|
||||
|
||||
@@ -22,10 +22,13 @@
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QLabel" name="titleLbl">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
Reference in New Issue
Block a user