4 Commits

Author SHA1 Message Date
Veronica Berglyd Olsen 2b00831465 Fix linting error and move spell check update slot to the correct location 2025-10-28 20:09:38 +01:00
Reproog ad34d45d0b Update novelwriter/guimain.py
Co-authored-by: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com>
2025-10-28 16:14:30 +01:00
Reproog df77fb67c6 Update novelwriter/gui/mainmenu.py
added above def updateSpellCheckLanguages(self) -> None:
    @pyqtSlot()

Co-authored-by: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com>
2025-10-28 16:14:17 +01:00
Reproog e3168163c2 Put loading functions in a separate Method and called it, when Add Dictionaries Window is closed. 2025-10-28 13:50:20 +01:00
2 changed files with 19 additions and 8 deletions
+13 -7
View File
@@ -91,6 +91,18 @@ class GuiMainMenu(QMenuBar):
"""Forward spell check check state to its action."""
self.aSpellCheck.setChecked(state)
@pyqtSlot()
def updateSpellCheckLanguages(self) -> None:
"""Update the list of available spell check languages."""
self.mSelectLanguage.clear()
languages = SHARED.spelling.listDictionaries()
languages.insert(0, ("None", self.tr("Default")))
for tag, language in languages:
aSpell = QAction(self.mSelectLanguage)
aSpell.setText(language)
aSpell.triggered.connect(qtLambda(self._changeSpelling, tag))
self.mSelectLanguage.addAction(aSpell)
##
# Private Slots
##
@@ -944,13 +956,7 @@ class GuiMainMenu(QMenuBar):
self.mainGui.addAction(self.aSpellCheck)
self.mSelectLanguage = qtAddMenu(self.toolsMenu, self.tr("Spell Check Language"))
languages = SHARED.spelling.listDictionaries()
languages.insert(0, ("None", self.tr("Default")))
for tag, language in languages:
aSpell = QAction(self.mSelectLanguage)
aSpell.setText(language)
aSpell.triggered.connect(qtLambda(self._changeSpelling, tag))
self.mSelectLanguage.addAction(aSpell)
self.updateSpellCheckLanguages()
# Tools > Re-Run Spell Check
self.aReRunSpell = qtAddAction(self.toolsMenu, self.tr("Re-Run Spell Check"))
+6 -1
View File
@@ -824,12 +824,17 @@ class GuiMain(QMainWindow):
@pyqtSlot()
def showDictionariesDialog(self) -> None:
"""Show the download dictionaries dialog."""
"""Show the download dictionaries dialog and update language
list when closed.
"""
dialog = GuiDictionaries(self)
dialog.activateDialog()
if not dialog.initDialog():
dialog.close()
SHARED.error(self.tr("Could not initialise the dialog."))
return
dialog.finished.connect(self.mainMenu.updateSpellCheckLanguages)
##
# Main Window Actions