diff --git a/lib/read.py b/lib/read.py
index a0e1594..9b2b4c0 100644
--- a/lib/read.py
+++ b/lib/read.py
@@ -73,22 +73,9 @@ class EditDialog(QDialog, Ui_Dialog):
self.paraEdit.verticalScrollBar().valueChanged.connect(self.scrollSlot)
return
- def defToHtml(self, word: str, definition) -> str:
- html = f'
{word}
' + "\n"
- try:
- html += f"{definition['phonetic']}
" + "\n"
- except Exception:
- pass
- html += '' + "\n"
- for meaning in definition["meanings"]:
- html += f"- {meaning['partOfSpeech']}"
- html += '
'
- for a_def in meaning["definitions"]:
- html += f"- {a_def['definition']}
\n"
- html += "
\n"
- html += "
\n\n"
- return html
-
+ #
+ # slots
+ #
@pyqtSlot()
def printAction(self) -> None:
html = "\n\n\n"
@@ -189,6 +176,53 @@ class EditDialog(QDialog, Ui_Dialog):
self.update()
return
+ @pyqtSlot()
+ def nextAction(self) -> None:
+ if self.stackedWidget.currentIndex() == 1:
+ print("Next Definition")
+ self.nextDefinition()
+ elif self.paragraphs:
+ self.nextParagraph()
+ else:
+ self.nextSection()
+ return
+
+ @pyqtSlot()
+ def prevAction(self) -> None:
+ if self.stackedWidget.currentIndex() == 1:
+ print("Previous Definition")
+ self.prevDefinition()
+ elif self.paragraphs:
+ self.prevParagraph()
+ else:
+ self.prevSection()
+ return
+
+ @pyqtSlot()
+ def defineAction(self) -> None:
+ print("defineAction")
+ if self.paragraphs:
+ self.showDefinition()
+ else:
+ self.addWord()
+ return
+
+ def defToHtml(self, word: str, definition) -> str:
+ html = f'{word}
' + "\n"
+ try:
+ html += f"{definition['phonetic']}
" + "\n"
+ except Exception:
+ pass
+ html += '' + "\n"
+ for meaning in definition["meanings"]:
+ html += f"- {meaning['partOfSpeech']}"
+ html += '
'
+ for a_def in meaning["definitions"]:
+ html += f"- {a_def['definition']}
\n"
+ html += "
\n"
+ html += "
\n\n"
+ return html
+
def load_book(self, person_id: int) -> None:
query = QSqlQuery()
query.prepare(
@@ -329,28 +363,6 @@ class EditDialog(QDialog, Ui_Dialog):
painter.fillPath(path, brush)
return
- @pyqtSlot()
- def nextAction(self) -> None:
- if self.stackedWidget.currentIndex() == 1:
- print("Next Definition")
- self.nextDefinition()
- elif self.paragraphs:
- self.nextParagraph()
- else:
- self.nextSection()
- return
-
- @pyqtSlot()
- def prevAction(self) -> None:
- if self.stackedWidget.currentIndex() == 1:
- print("Previous Definition")
- self.prevDefinition()
- elif self.paragraphs:
- self.prevParagraph()
- else:
- self.prevSection()
- return
-
def nextParagraph(self) -> None:
self.block += 1
if self.block >= self.paraEdit.document().blockCount():
@@ -367,15 +379,6 @@ class EditDialog(QDialog, Ui_Dialog):
self.savePosition()
return
- @pyqtSlot()
- def defineAction(self) -> None:
- print("defineAction")
- if self.paragraphs:
- self.showDefinition()
- else:
- self.addWord()
- return
-
def addWord(self) -> None:
#
# Find the word