4938 """ |
4938 """ |
4939 return self.fileName is not None and \ |
4939 return self.fileName is not None and \ |
4940 not self.autosaveManuallyDisabled and \ |
4940 not self.autosaveManuallyDisabled and \ |
4941 not self.isReadOnly() |
4941 not self.isReadOnly() |
4942 |
4942 |
4943 |
|
4944 def __autoSyntaxCheck(self): |
4943 def __autoSyntaxCheck(self): |
4945 """ |
4944 """ |
4946 Private method to perform an automatic syntax check of the file. |
4945 Private method to perform an automatic syntax check of the file. |
4947 """ |
4946 """ |
4948 isPy2 = self.isPy2File() |
4947 isPy2 = self.isPy2File() |
4949 if (isPy2 or self.isPy3File()) == False: |
4948 if (isPy2 or self.isPy3File()) is False: |
4950 return |
4949 return |
4951 |
4950 |
4952 if Preferences.getEditor("AutoCheckSyntax"): |
4951 if Preferences.getEditor("AutoCheckSyntax"): |
4953 if Preferences.getEditor("OnlineSyntaxCheck"): |
4952 if Preferences.getEditor("OnlineSyntaxCheck"): |
4954 self.__onlineSyntaxCheckTimer.stop() |
4953 self.__onlineSyntaxCheckTimer.stop() |
4955 self.clearSyntaxError() |
4954 self.clearSyntaxError() |
4956 self.clearFlakesWarnings() |
4955 self.clearFlakesWarnings() |
4957 |
4956 |
4958 syntaxError, _fn, errorline, errorindex, _code, _error, warnings = \ |
4957 syntaxError, _fn, errorline, errorindex, _code, _error, warnings =\ |
4959 Utilities.compile(self.fileName or "(Unnamed)", self.text(), isPy2) |
4958 Utilities.compile( |
|
4959 self.fileName or "(Unnamed)", self.text(), isPy2) |
4960 if syntaxError: |
4960 if syntaxError: |
4961 self.toggleSyntaxError(errorline, errorindex, True, _error) |
4961 self.toggleSyntaxError(errorline, errorindex, True, _error) |
4962 else: |
4962 else: |
4963 for warning in warnings: |
4963 for warning in warnings: |
4964 self.toggleFlakesWarning( |
4964 self.toggleFlakesWarning( |
4965 warning[2], True, warning[3]) |
4965 warning[2], True, warning[3]) |
4966 |
|
4967 |
4966 |
4968 def __initOnlineSyntaxCheck(self): |
4967 def __initOnlineSyntaxCheck(self): |
4969 """ |
4968 """ |
4970 Private slot to initialize the online syntax check. |
4969 Private slot to initialize the online syntax check. |
4971 """ |
4970 """ |