QScintilla/SpellChecker.py

changeset 3591
2f2a4a76dd22
parent 3539
0c2dc1446ebf
child 3592
eb4db8e3bcaa
equal deleted inserted replaced
3590:5280e37405b8 3591:2f2a4a76dd22
62 self.__replaceWords = {} 62 self.__replaceWords = {}
63 63
64 @classmethod 64 @classmethod
65 def getAvailableLanguages(cls): 65 def getAvailableLanguages(cls):
66 """ 66 """
67 Public classmethod to get all available languages. 67 Class method to get all available languages.
68 68
69 @return list of available languages (list of strings) 69 @return list of available languages (list of strings)
70 """ 70 """
71 try: 71 try:
72 return enchant.list_languages() 72 return enchant.list_languages()
75 return [] 75 return []
76 76
77 @classmethod 77 @classmethod
78 def isAvailable(cls): 78 def isAvailable(cls):
79 """ 79 """
80 Public classmethod to check, if spellchecking is available. 80 Class method to check, if spellchecking is available.
81 81
82 @return flag indicating availability (boolean) 82 @return flag indicating availability (boolean)
83 """ 83 """
84 if Preferences.getEditor("SpellCheckingEnabled"): 84 if Preferences.getEditor("SpellCheckingEnabled"):
85 try: 85 try:
157 return d 157 return d
158 158
159 @classmethod 159 @classmethod
160 def setDefaultLanguage(cls, language): 160 def setDefaultLanguage(cls, language):
161 """ 161 """
162 Public classmethod to set the default language. 162 Class method to set the default language.
163 163
164 @param language the language to be used as the default (string). 164 @param language the language to be used as the default (string).
165 The string should be in language locale format (e.g. en_US, de). 165 The string should be in language locale format (e.g. en_US, de).
166 """ 166 """
167 cls._spelling_lang = language 167 cls._spelling_lang = language
394 """ 394 """
395 self.lastCheckedLine = -1 395 self.lastCheckedLine = -1
396 396
397 def checkSelection(self): 397 def checkSelection(self):
398 """ 398 """
399 Private method to check the current selection. 399 Public method to check the current selection.
400 """ 400 """
401 selStartLine, selStartIndex, selEndLine, selEndIndex = \ 401 selStartLine, selStartIndex, selEndLine, selEndIndex = \
402 self.editor.getSelection() 402 self.editor.getSelection()
403 self.__checkDocumentPart( 403 self.__checkDocumentPart(
404 self.editor.positionFromLineIndex(selStartLine, selStartIndex), 404 self.editor.positionFromLineIndex(selStartLine, selStartIndex),
405 self.editor.positionFromLineIndex(selEndLine, selEndIndex) 405 self.editor.positionFromLineIndex(selEndLine, selEndIndex)
406 ) 406 )
407 407
408 def checkCurrentPage(self): 408 def checkCurrentPage(self):
409 """ 409 """
410 Private method to check the currently visible page. 410 Public method to check the currently visible page.
411 """ 411 """
412 startLine = self.editor.firstVisibleLine() 412 startLine = self.editor.firstVisibleLine()
413 endLine = startLine + self.editor.linesOnScreen() 413 endLine = startLine + self.editor.linesOnScreen()
414 self.checkLines(startLine, endLine) 414 self.checkLines(startLine, endLine)
415 415
501 ## Methods below implement the iterator protocol 501 ## Methods below implement the iterator protocol
502 ################################################################## 502 ##################################################################
503 503
504 def __iter__(self): 504 def __iter__(self):
505 """ 505 """
506 Private method to create an iterator. 506 Special method to create an iterator.
507 507
508 @return self 508 @return self
509 """ 509 """
510 return self 510 return self
511 511
512 def __next__(self): 512 def __next__(self):
513 """ 513 """
514 Public method to advance to the next error. 514 Special method to advance to the next error.
515 515
516 @return self 516 @return self
517 @exception StopIteration raised to indicate the end of the iteration 517 @exception StopIteration raised to indicate the end of the iteration
518 """ 518 """
519 spell = self._spelling_dict 519 spell = self._spelling_dict

eric ide

mercurial