Fix linting error and move spell check update slot to the correct location
This commit is contained in:
+12
-12
@@ -91,6 +91,18 @@ class GuiMainMenu(QMenuBar):
|
|||||||
"""Forward spell check check state to its action."""
|
"""Forward spell check check state to its action."""
|
||||||
self.aSpellCheck.setChecked(state)
|
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
|
# Private Slots
|
||||||
##
|
##
|
||||||
@@ -993,18 +1005,6 @@ class GuiMainMenu(QMenuBar):
|
|||||||
self.aPreferences.triggered.connect(self.mainGui.showPreferencesDialog)
|
self.aPreferences.triggered.connect(self.mainGui.showPreferencesDialog)
|
||||||
self.mainGui.addAction(self.aPreferences)
|
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:
|
def _buildHelpMenu(self) -> None:
|
||||||
"""Assemble the Help menu."""
|
"""Assemble the Help menu."""
|
||||||
# Help
|
# Help
|
||||||
|
|||||||
@@ -824,14 +824,16 @@ class GuiMain(QMainWindow):
|
|||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def showDictionariesDialog(self) -> None:
|
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 = GuiDictionaries(self)
|
||||||
dialog.activateDialog()
|
dialog.activateDialog()
|
||||||
if not dialog.initDialog():
|
if not dialog.initDialog():
|
||||||
dialog.close()
|
dialog.close()
|
||||||
SHARED.error(self.tr("Could not initialise the dialog."))
|
SHARED.error(self.tr("Could not initialise the dialog."))
|
||||||
return
|
return
|
||||||
|
|
||||||
dialog.finished.connect(self.mainMenu.updateSpellCheckLanguages)
|
dialog.finished.connect(self.mainMenu.updateSpellCheckLanguages)
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|||||||
Reference in New Issue
Block a user