ViewManager/ViewManager.py

changeset 2673
c62efb5f2d79
parent 2593
a2df0adce985
child 2677
3d4277929fb3
child 2769
8cbebde7a984
equal deleted inserted replaced
2672:c0c5fa05313f 2673:c62efb5f2d79
3633 self.__editProjectPWL) 3633 self.__editProjectPWL)
3634 self.__editProjectPelAct = self.__editSpellingMenu.addAction( 3634 self.__editProjectPelAct = self.__editSpellingMenu.addAction(
3635 QApplication.translate('ViewManager', "Project Exception List"), 3635 QApplication.translate('ViewManager', "Project Exception List"),
3636 self.__editProjectPEL) 3636 self.__editProjectPEL)
3637 self.__editSpellingMenu.addSeparator() 3637 self.__editSpellingMenu.addSeparator()
3638 self.__editSpellingMenu.addAction( 3638 self.__editUserPwlAct = self.__editSpellingMenu.addAction(
3639 QApplication.translate('ViewManager', "User Word List"), 3639 QApplication.translate('ViewManager', "User Word List"),
3640 self.__editUserPWL) 3640 self.__editUserPWL)
3641 self.__editSpellingMenu.addAction( 3641 self.__editUserPelAct = self.__editSpellingMenu.addAction(
3642 QApplication.translate('ViewManager', "User Exception List"), 3642 QApplication.translate('ViewManager', "User Exception List"),
3643 self.__editUserPEL) 3643 self.__editUserPEL)
3644 self.__editProjectPwlAct.setEnabled(False) 3644 self.__editSpellingMenu.aboutToShow.connect(self.__showEditSpellingMenu)
3645 self.__editProjectPelAct.setEnabled(False)
3646 3645
3647 menu.addAction(self.spellCheckAct) 3646 menu.addAction(self.spellCheckAct)
3648 menu.addAction(self.autoSpellCheckAct) 3647 menu.addAction(self.autoSpellCheckAct)
3649 menu.addMenu(self.__editSpellingMenu) 3648 menu.addMenu(self.__editSpellingMenu)
3650 menu.addSeparator() 3649 menu.addSeparator()
5426 5425
5427 ################################################################## 5426 ##################################################################
5428 ## Below are the action methods for the spell checking functions 5427 ## Below are the action methods for the spell checking functions
5429 ################################################################## 5428 ##################################################################
5430 5429
5430 def __showEditSpellingMenu(self):
5431 """
5432 Private method to set up the edit dictionaries menu.
5433 """
5434 proj = e5App().getObject("Project")
5435 projetOpen = proj.isOpen()
5436 pwl = e5App().getObject("Project").getProjectDictionaries()[0]
5437 self.__editProjectPwlAct.setEnabled(projetOpen and bool(pwl))
5438 pel = e5App().getObject("Project").getProjectDictionaries()[1]
5439 self.__editProjectPelAct.setEnabled(projetOpen and bool(pel))
5440
5441 from QScintilla.SpellChecker import SpellChecker
5442 pwl = SpellChecker.getUserDictionaryPath()
5443 self.__editUserPwlAct.setEnabled(bool(pwl))
5444 pel = SpellChecker.getUserDictionaryPath(True)
5445 self.__editUserPelAct.setEnabled(bool(pel))
5446
5431 def __setAutoSpellChecking(self): 5447 def __setAutoSpellChecking(self):
5432 """ 5448 """
5433 Private slot to set the automatic spell checking of all editors. 5449 Private slot to set the automatic spell checking of all editors.
5434 """ 5450 """
5435 enabled = self.autoSpellCheckAct.isChecked() 5451 enabled = self.autoSpellCheckAct.isChecked()
5448 def __editProjectPWL(self): 5464 def __editProjectPWL(self):
5449 """ 5465 """
5450 Private slot to edit the project word list. 5466 Private slot to edit the project word list.
5451 """ 5467 """
5452 pwl = e5App().getObject("Project").getProjectDictionaries()[0] 5468 pwl = e5App().getObject("Project").getProjectDictionaries()[0]
5453 if pwl: 5469 self.__editSpellingDictionary(pwl)
5454 self.__editSpellingDictionary(pwl)
5455 else:
5456 E5MessageBox.warning(self.ui,
5457 QApplication.translate('ViewManager', "Edit Project Word List"),
5458 QApplication.translate('ViewManager',
5459 """No word list defined for the current project."""))
5460 5470
5461 def __editProjectPEL(self): 5471 def __editProjectPEL(self):
5462 """ 5472 """
5463 Private slot to edit the project exception list. 5473 Private slot to edit the project exception list.
5464 """ 5474 """
5465 pel = e5App().getObject("Project").getProjectDictionaries()[1] 5475 pel = e5App().getObject("Project").getProjectDictionaries()[1]
5466 if pel: 5476 self.__editSpellingDictionary(pel)
5467 self.__editSpellingDictionary(pel)
5468 else:
5469 E5MessageBox.warning(self.ui,
5470 QApplication.translate('ViewManager', "Edit Project Exception List"),
5471 QApplication.translate('ViewManager',
5472 """No exception list defined for the current project."""))
5473 5477
5474 def __editUserPWL(self): 5478 def __editUserPWL(self):
5475 """ 5479 """
5476 Private slot to edit the user word list. 5480 Private slot to edit the user word list.
5477 """ 5481 """

eric ide

mercurial