eric7/EricWidgets/EricSpellCheckedTextEdit.py

branch
eric7
changeset 8629
1b58dc890b87
parent 8432
074407b4c107
child 8639
71cc2b932ff6
equal deleted inserted replaced
8628:dcdf0074ad39 8629:1b58dc890b87
322 322
323 @param act reference to the selected action 323 @param act reference to the selected action
324 @type QAction 324 @type QAction
325 """ 325 """
326 language = act.data() 326 language = act.data()
327 self.__highlighter.setDict(enchant.Dict( 327 self.setLanguage(language)
328 language,
329 SpellCheckMixin.DefaultUserWordList,
330 SpellCheckMixin.DefaultUserExceptionList
331 ))
332 328
333 @pyqtSlot(QAction) 329 @pyqtSlot(QAction)
334 def __setFormat(self, act): 330 def __setFormat(self, act):
335 """ 331 """
336 Private slot to set the selected document format. 332 Private slot to set the selected document format.
369 365
370 @param spellDict reference to the spell-check dictionary 366 @param spellDict reference to the spell-check dictionary
371 @type emchant.Dict 367 @type emchant.Dict
372 """ 368 """
373 self.__highlighter.setDict(spellDict) 369 self.__highlighter.setDict(spellDict)
370
371 @pyqtSlot(str)
372 def setLanguage(self, language):
373 """
374 Public slot to set the spellchecker language.
375
376 @param language language to be set
377 @type str
378 """
379 epwl = self.dict().pwl
380 pwl = (
381 epwl.provider.file
382 if isinstance(epwl, enchant.Dict) else
383 None
384 )
385
386 epel = self.dict().pel
387 pel = (
388 epel.provider.file
389 if isinstance(epel, enchant.Dict) else
390 None
391 )
392 self.setLanguageWithPWL(language, pwl, pel)
393
394 @pyqtSlot(str, str, str)
395 def setLanguageWithPWL(self, language, pwl, pel):
396 """
397 Public slot to set the spellchecker language and associated user
398 word lists.
399
400 @param language language to be set
401 @type str
402 @param pwl file name of the personal word list
403 @type str
404 @param pel file name of the personal exclude list
405 @type str
406 """
407 self.__highlighter.setDict(
408 enchant.DictWithPWL(language, pwl, pel)
409 )
374 410
375 @classmethod 411 @classmethod
376 def setDefaultLanguage(cls, language, pwl=None, pel=None): 412 def setDefaultLanguage(cls, language, pwl=None, pel=None):
377 """ 413 """
378 Class method to set the default spell-check language. 414 Class method to set the default spell-check language.

eric ide

mercurial