From 2b00831465e1027764c7b1ac7594b271c0ebf5f0 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Tue, 28 Oct 2025 20:09:38 +0100 Subject: [PATCH] Fix linting error and move spell check update slot to the correct location --- novelwriter/gui/mainmenu.py | 24 ++++++++++++------------ novelwriter/guimain.py | 6 ++++-- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/novelwriter/gui/mainmenu.py b/novelwriter/gui/mainmenu.py index 8090492b..b7ae27fc 100644 --- a/novelwriter/gui/mainmenu.py +++ b/novelwriter/gui/mainmenu.py @@ -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 ## @@ -993,18 +1005,6 @@ class GuiMainMenu(QMenuBar): self.aPreferences.triggered.connect(self.mainGui.showPreferencesDialog) self.mainGui.addAction(self.aPreferences) - @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) - def _buildHelpMenu(self) -> None: """Assemble the Help menu.""" # Help diff --git a/novelwriter/guimain.py b/novelwriter/guimain.py index 8e3a1ef5..8f95ff67 100644 --- a/novelwriter/guimain.py +++ b/novelwriter/guimain.py @@ -824,14 +824,16 @@ class GuiMain(QMainWindow): @pyqtSlot() def showDictionariesDialog(self) -> None: - """Show the download dictionaries dialog and update language list when closed.""" + """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) ##