6932 """ |
6933 """ |
6933 Public slot to clear all info warnings. |
6934 Public slot to clear all info warnings. |
6934 """ |
6935 """ |
6935 self.__clearTypedWarning(Editor.WarningInfo) |
6936 self.__clearTypedWarning(Editor.WarningInfo) |
6936 |
6937 |
|
6938 @pyqtSlot() |
|
6939 def clearErrorWarnings(self): |
|
6940 """ |
|
6941 Public slot to clear all error warnings. |
|
6942 """ |
|
6943 self.__clearTypedWarning(Editor.WarningError) |
|
6944 |
|
6945 @pyqtSlot() |
|
6946 def clearCodeWarnings(self): |
|
6947 """ |
|
6948 Public slot to clear all code warnings. |
|
6949 """ |
|
6950 self.__clearTypedWarning(Editor.WarningCode) |
|
6951 |
6937 def __clearTypedWarning(self, warningKind): |
6952 def __clearTypedWarning(self, warningKind): |
6938 """ |
6953 """ |
6939 Private method to clear warnings of a specific kind. |
6954 Private method to clear warnings of a specific kind. |
6940 |
6955 |
6941 @param warningKind kind of warning to clear (Editor.WarningCode, |
6956 @param warningKind kind of warning to clear (Editor.WarningCode, |
7070 for handle in self._warnings: |
7085 for handle in self._warnings: |
7071 if self.markerLine(handle) == line: |
7086 if self.markerLine(handle) == line: |
7072 for msg, warningType in self._warnings[handle]: |
7087 for msg, warningType in self._warnings[handle]: |
7073 if warningType == Editor.WarningInfo: |
7088 if warningType == Editor.WarningInfo: |
7074 infoAnnotations.append(self.tr("Info: {0}").format(msg)) |
7089 infoAnnotations.append(self.tr("Info: {0}").format(msg)) |
|
7090 elif warningType == Editor.WarningError: |
|
7091 errorAnnotations.append(self.tr("Error: {0}").format(msg)) |
7075 elif warningType == Editor.WarningStyle: |
7092 elif warningType == Editor.WarningStyle: |
7076 styleAnnotations.append(self.tr("Style: {0}").format(msg)) |
7093 styleAnnotations.append(self.tr("Style: {0}").format(msg)) |
7077 elif warningType == Editor.WarningPython: |
7094 elif warningType == Editor.WarningPython: |
7078 warningAnnotations.append(msg) |
7095 warningAnnotations.append(msg) |
7079 else: |
7096 else: |
7085 for handle in self.syntaxerrors: |
7102 for handle in self.syntaxerrors: |
7086 if self.markerLine(handle) == line: |
7103 if self.markerLine(handle) == line: |
7087 for msg, _ in self.syntaxerrors[handle]: |
7104 for msg, _ in self.syntaxerrors[handle]: |
7088 errorAnnotations.append(self.tr("Error: {0}").format(msg)) |
7105 errorAnnotations.append(self.tr("Error: {0}").format(msg)) |
7089 |
7106 |
|
7107 # step 3: assemble the annotation |
7090 annotations = [] |
7108 annotations = [] |
7091 if infoAnnotations: |
7109 if infoAnnotations: |
7092 annotationInfoTxt = "\n".join(infoAnnotations) |
7110 annotationInfoTxt = "\n".join(infoAnnotations) |
7093 if styleAnnotations or warningAnnotations or errorAnnotations: |
7111 if styleAnnotations or warningAnnotations or errorAnnotations: |
7094 annotationInfoTxt += "\n" |
7112 annotationInfoTxt += "\n" |