ViewManager/ViewManager.py

branch
5_3_x
changeset 2675
3215c3dc3bfa
parent 2485
05b056d48e28
child 2887
9b6d993bf7c2
equal deleted inserted replaced
2668:4c5320acf00d 2675:3215c3dc3bfa
3589 self.__editProjectPWL) 3589 self.__editProjectPWL)
3590 self.__editProjectPelAct = self.__editSpellingMenu.addAction( 3590 self.__editProjectPelAct = self.__editSpellingMenu.addAction(
3591 QApplication.translate('ViewManager', "Project Exception List"), 3591 QApplication.translate('ViewManager', "Project Exception List"),
3592 self.__editProjectPEL) 3592 self.__editProjectPEL)
3593 self.__editSpellingMenu.addSeparator() 3593 self.__editSpellingMenu.addSeparator()
3594 self.__editSpellingMenu.addAction( 3594 self.__editUserPwlAct = self.__editSpellingMenu.addAction(
3595 QApplication.translate('ViewManager', "User Word List"), 3595 QApplication.translate('ViewManager', "User Word List"),
3596 self.__editUserPWL) 3596 self.__editUserPWL)
3597 self.__editSpellingMenu.addAction( 3597 self.__editUserPelAct = self.__editSpellingMenu.addAction(
3598 QApplication.translate('ViewManager', "User Exception List"), 3598 QApplication.translate('ViewManager', "User Exception List"),
3599 self.__editUserPEL) 3599 self.__editUserPEL)
3600 self.__editProjectPwlAct.setEnabled(False) 3600 self.__editSpellingMenu.aboutToShow.connect(self.__showEditSpellingMenu)
3601 self.__editProjectPelAct.setEnabled(False)
3602 3601
3603 menu.addAction(self.spellCheckAct) 3602 menu.addAction(self.spellCheckAct)
3604 menu.addAction(self.autoSpellCheckAct) 3603 menu.addAction(self.autoSpellCheckAct)
3605 menu.addMenu(self.__editSpellingMenu) 3604 menu.addMenu(self.__editSpellingMenu)
3606 menu.addSeparator() 3605 menu.addSeparator()
5334 5333
5335 ################################################################## 5334 ##################################################################
5336 ## Below are the action methods for the spell checking functions 5335 ## Below are the action methods for the spell checking functions
5337 ################################################################## 5336 ##################################################################
5338 5337
5338 def __showEditSpellingMenu(self):
5339 """
5340 Private method to set up the edit dictionaries menu.
5341 """
5342 proj = e5App().getObject("Project")
5343 projetOpen = proj.isOpen()
5344 pwl = e5App().getObject("Project").getProjectDictionaries()[0]
5345 self.__editProjectPwlAct.setEnabled(projetOpen and bool(pwl))
5346 pel = e5App().getObject("Project").getProjectDictionaries()[1]
5347 self.__editProjectPelAct.setEnabled(projetOpen and bool(pel))
5348
5349 from QScintilla.SpellChecker import SpellChecker
5350 pwl = SpellChecker.getUserDictionaryPath()
5351 self.__editUserPwlAct.setEnabled(bool(pwl))
5352 pel = SpellChecker.getUserDictionaryPath(True)
5353 self.__editUserPelAct.setEnabled(bool(pel))
5354
5339 def __setAutoSpellChecking(self): 5355 def __setAutoSpellChecking(self):
5340 """ 5356 """
5341 Private slot to set the automatic spell checking of all editors. 5357 Private slot to set the automatic spell checking of all editors.
5342 """ 5358 """
5343 enabled = self.autoSpellCheckAct.isChecked() 5359 enabled = self.autoSpellCheckAct.isChecked()
5356 def __editProjectPWL(self): 5372 def __editProjectPWL(self):
5357 """ 5373 """
5358 Private slot to edit the project word list. 5374 Private slot to edit the project word list.
5359 """ 5375 """
5360 pwl = e5App().getObject("Project").getProjectDictionaries()[0] 5376 pwl = e5App().getObject("Project").getProjectDictionaries()[0]
5361 if pwl: 5377 self.__editSpellingDictionary(pwl)
5362 self.__editSpellingDictionary(pwl)
5363 else:
5364 E5MessageBox.warning(self.ui,
5365 QApplication.translate('ViewManager', "Edit Project Word List"),
5366 QApplication.translate('ViewManager',
5367 """No word list defined for the current project."""))
5368 5378
5369 def __editProjectPEL(self): 5379 def __editProjectPEL(self):
5370 """ 5380 """
5371 Private slot to edit the project exception list. 5381 Private slot to edit the project exception list.
5372 """ 5382 """
5373 pel = e5App().getObject("Project").getProjectDictionaries()[1] 5383 pel = e5App().getObject("Project").getProjectDictionaries()[1]
5374 if pel: 5384 self.__editSpellingDictionary(pel)
5375 self.__editSpellingDictionary(pel)
5376 else:
5377 E5MessageBox.warning(self.ui,
5378 QApplication.translate('ViewManager', "Edit Project Exception List"),
5379 QApplication.translate('ViewManager',
5380 """No exception list defined for the current project."""))
5381 5385
5382 def __editUserPWL(self): 5386 def __editUserPWL(self):
5383 """ 5387 """
5384 Private slot to edit the user word list. 5388 Private slot to edit the user word list.
5385 """ 5389 """

eric ide

mercurial