--- a/QScintilla/Editor.py Sun Oct 02 15:57:38 2011 +0200 +++ b/QScintilla/Editor.py Sun Oct 02 20:06:38 2011 +0200 @@ -407,6 +407,9 @@ # connect signals after loading the text self.textChanged.connect(self.__textChanged) + + # create the online syntax check timer + self.__initOnlineSyntaxCheck() def __registerImages(self): """ @@ -3416,6 +3419,13 @@ self.__markOccurrencesTimer.stop() self.clearSearchIndicators() + if Preferences.getEditor("OnlineSyntaxCheck"): + self.__onlineSyntaxCheckTimer.setInterval( + Preferences.getEditor("OnlineSyntaxCheckInterval") * 1000) + else: + self.__onlineSyntaxCheckTimer.stop() + + # refresh the annotations display self.__refreshAnnotations() @@ -4463,6 +4473,25 @@ self.toggleFlakesWarning( int(warning[1]), True, warning[2]) + def __initOnlineSyntaxCheck(self): + """ + Private slot to initialize the online syntax check. + """ + self.__onlineSyntaxCheckTimer = QTimer(self) + self.__onlineSyntaxCheckTimer.setSingleShot(True) + self.__onlineSyntaxCheckTimer.setInterval( + Preferences.getEditor("OnlineSyntaxCheckInterval") * 1000) + self.__onlineSyntaxCheckTimer.timeout.connect(self.__autoSyntaxCheck) + self.textChanged.connect(self.__resetOnlineSyntaxCheckTimer) + + def __resetOnlineSyntaxCheckTimer(self): + """ + Private method to reset the online syntax check timer. + """ + if Preferences.getEditor("OnlineSyntaxCheck"): + self.__onlineSyntaxCheckTimer.stop() + self.__onlineSyntaxCheckTimer.start() + def __showCodeMetrics(self): """ Private method to handle the code metrics context menu action.