Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py

changeset 3175
1a6638ccce9d
parent 3160
209a07d7e401
child 3178
f25fc1364c88
child 3190
a9a94491c4fd
equal deleted inserted replaced
3171:2c37b9a37b2d 3175:1a6638ccce9d
143 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) 143 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True)
144 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 144 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
145 self.checkProgress.setVisible(True) 145 self.checkProgress.setVisible(True)
146 QApplication.processEvents() 146 QApplication.processEvents()
147 147
148 self.__clearErrors()
149
150 if isinstance(fn, list): 148 if isinstance(fn, list):
151 files = fn 149 files = fn
152 elif os.path.isdir(fn): 150 elif os.path.isdir(fn):
153 files = [] 151 files = []
154 for ext in Preferences.getPython("Python3Extensions"): 152 for ext in Preferences.getPython("Python3Extensions"):
157 for ext in Preferences.getPython("PythonExtensions"): 155 for ext in Preferences.getPython("PythonExtensions"):
158 files.extend( 156 files.extend(
159 Utilities.direntries(fn, 1, '*{0}'.format(ext), 0)) 157 Utilities.direntries(fn, 1, '*{0}'.format(ext), 0))
160 else: 158 else:
161 files = [fn] 159 files = [fn]
160
161 self.__clearErrors(files)
162
162 py3files = [f for f in files 163 py3files = [f for f in files
163 if f.endswith( 164 if f.endswith(
164 tuple(Preferences.getPython("Python3Extensions")))] 165 tuple(Preferences.getPython("Python3Extensions")))]
165 py2files = [f for f in files 166 py2files = [f for f in files
166 if f.endswith( 167 if f.endswith(
290 291
291 if self.noResults: 292 if self.noResults:
292 QTreeWidgetItem(self.resultList, [self.trUtf8('No issues found.')]) 293 QTreeWidgetItem(self.resultList, [self.trUtf8('No issues found.')])
293 QApplication.processEvents() 294 QApplication.processEvents()
294 self.showButton.setEnabled(False) 295 self.showButton.setEnabled(False)
295 self.__clearErrors()
296 else: 296 else:
297 self.showButton.setEnabled(True) 297 self.showButton.setEnabled(True)
298 self.resultList.header().resizeSections(QHeaderView.ResizeToContents) 298 self.resultList.header().resizeSections(QHeaderView.ResizeToContents)
299 self.resultList.header().setStretchLastSection(True) 299 self.resultList.header().setStretchLastSection(True)
300 300
422 if not file in errorFiles: 422 if not file in errorFiles:
423 editor = vm.getOpenEditor(file) 423 editor = vm.getOpenEditor(file)
424 editor.clearSyntaxError() 424 editor.clearSyntaxError()
425 editor.clearFlakesWarnings() 425 editor.clearFlakesWarnings()
426 426
427 def __clearErrors(self): 427 def __clearErrors(self, files):
428 """ 428 """
429 Private method to clear all error markers of open editors. 429 Private method to clear all error and warning markers of
430 open editors to be checked.
431
432 @param files list of files to be checked (list of string)
430 """ 433 """
431 vm = e5App().getObject("ViewManager") 434 vm = e5App().getObject("ViewManager")
432 openFiles = vm.getOpenFilenames() 435 openFiles = vm.getOpenFilenames()
433 for file in openFiles: 436 for file in [f for f in openFiles if f in files]:
434 editor = vm.getOpenEditor(file) 437 editor = vm.getOpenEditor(file)
435 editor.clearSyntaxError() 438 editor.clearSyntaxError()
436 editor.clearFlakesWarnings() 439 editor.clearFlakesWarnings()

eric ide

mercurial