Make sure no menu items crashes the app when there is no project open

This commit is contained in:
Veronica K. B. Olsen
2019-06-08 15:57:22 +02:00
parent 5ff56a2b4b
commit 07244045cc
4 changed files with 58 additions and 30 deletions
+10 -5
View File
@@ -81,8 +81,9 @@ class GuiMainMenu(QMenuBar):
return
def updateSpellCheck(self):
self.toolsSpellCheck.setChecked(self.theProject.spellCheck)
logger.verbose("Spell check is set to %s" % str(self.theProject.spellCheck))
if self.theParent.hasProject:
self.toolsSpellCheck.setChecked(self.theProject.spellCheck)
logger.verbose("Spell check is set to %s" % str(self.theProject.spellCheck))
return
##
@@ -94,9 +95,12 @@ class GuiMainMenu(QMenuBar):
return
def _toggleSpellCheck(self):
self.theProject.setSpellCheck(self.toolsSpellCheck.isChecked())
self.theParent.docEditor.setSpellCheck(self.toolsSpellCheck.isChecked())
logger.verbose("Spell check is set to %s" % str(self.theProject.spellCheck))
if self.theParent.hasProject:
self.theProject.setSpellCheck(self.toolsSpellCheck.isChecked())
self.theParent.docEditor.setSpellCheck(self.toolsSpellCheck.isChecked())
logger.verbose("Spell check is set to %s" % str(self.theProject.spellCheck))
else:
self.toolsSpellCheck.setChecked(False)
return True
def _showAbout(self):
@@ -167,6 +171,7 @@ class GuiMainMenu(QMenuBar):
# Project > Project Settings
menuItem = QAction(QIcon.fromTheme("document-properties"), "Project Settings", self)
menuItem.setStatusTip("Project settings")
menuItem.setShortcut("Ctrl+Shift+,")
menuItem.triggered.connect(self.theParent.editProjectDialog)
self.projMenu.addAction(menuItem)