314 |
314 |
315 # set the text display |
315 # set the text display |
316 self.__setTextDisplay() |
316 self.__setTextDisplay() |
317 |
317 |
318 # initialize the online syntax check timer |
318 # initialize the online syntax check timer |
319 # TODO: add code to handle a KeyError here (i.e. service is not loaded) |
319 try: |
320 self.syntaxCheckService = e5App().getObject('SyntaxCheckService') |
320 self.syntaxCheckService = e5App().getObject('SyntaxCheckService') |
321 self.syntaxCheckService.syntaxChecked.connect(self.__processResult) |
321 self.syntaxCheckService.syntaxChecked.connect(self.__processResult) |
322 self.__initOnlineSyntaxCheck() |
322 self.__initOnlineSyntaxCheck() |
|
323 except KeyError: |
|
324 self.syntaxCheckService = None |
323 |
325 |
324 self.isResourcesFile = False |
326 self.isResourcesFile = False |
325 if editor is None: |
327 if editor is None: |
326 if self.fileName is not None: |
328 if self.fileName is not None: |
327 if (QFileInfo(self.fileName).size() // 1024) > \ |
329 if (QFileInfo(self.fileName).size() // 1024) > \ |
5072 |
5074 |
5073 def checkSyntax(self): |
5075 def checkSyntax(self): |
5074 """ |
5076 """ |
5075 Public method to perform an automatic syntax check of the file. |
5077 Public method to perform an automatic syntax check of the file. |
5076 """ |
5078 """ |
5077 if self.filetype not in self.syntaxCheckService.getLanguages(): |
5079 if self.syntaxCheckService is None or \ |
|
5080 self.filetype not in self.syntaxCheckService.getLanguages(): |
5078 return |
5081 return |
5079 |
5082 |
5080 if Preferences.getEditor("AutoCheckSyntax"): |
5083 if Preferences.getEditor("AutoCheckSyntax"): |
5081 if Preferences.getEditor("OnlineSyntaxCheck"): |
5084 if Preferences.getEditor("OnlineSyntaxCheck"): |
5082 self.__onlineSyntaxCheckTimer.stop() |
5085 self.__onlineSyntaxCheckTimer.stop() |
6043 self.breakpointModel.dataChanged.disconnect( |
6046 self.breakpointModel.dataChanged.disconnect( |
6044 self.__changeBreakPoints) |
6047 self.__changeBreakPoints) |
6045 self.breakpointModel.rowsInserted.disconnect( |
6048 self.breakpointModel.rowsInserted.disconnect( |
6046 self.__addBreakPoints) |
6049 self.__addBreakPoints) |
6047 |
6050 |
6048 self.syntaxCheckService.syntaxChecked.disconnect(self.__processResult) |
6051 if self.syntaxCheckService is not None: |
|
6052 self.syntaxCheckService.syntaxChecked.disconnect( |
|
6053 self.__processResult) |
6049 |
6054 |
6050 if self.spell: |
6055 if self.spell: |
6051 self.spell.stopIncrementalCheck() |
6056 self.spell.stopIncrementalCheck() |
6052 |
6057 |
6053 try: |
6058 try: |