213 self.check() |
214 self.check() |
214 return |
215 return |
215 |
216 |
216 self.syntaxCheckService.syntaxCheck(None, self.filename, self.source) |
217 self.syntaxCheckService.syntaxCheck(None, self.filename, self.source) |
217 |
218 |
218 def __processResult( |
219 def __processResult(self, fn, problems): |
219 self, fn, nok, line, index, code, error, warnings): |
|
220 """ |
220 """ |
221 Slot to display the reported messages. |
221 Slot to display the reported messages. |
222 |
222 |
223 If checkFlakes is True, warnings contains a list of strings containing |
|
224 the warnings (marker, file name, line number, message) |
|
225 The values are only valid, if nok is False. |
|
226 |
|
227 @param fn filename of the checked file (str) |
223 @param fn filename of the checked file (str) |
228 @param nok flag if an error in the source was found (boolean) |
224 @param problems dictionary with the keys 'error' and 'warnings' which |
229 @param line number where the error occured (int) |
225 hold a list containing details about the error/ warnings |
230 @param index the column where the error occured (int) |
226 (file name, line number, column, codestring (only at syntax |
231 @param code the part of the code where the error occured (str) |
227 errors), the message) (dict) |
232 @param error the name of the error (str) |
|
233 @param warnings a list of strings containing the warnings |
|
234 (marker, file name, line number, col, message) |
|
235 """ |
228 """ |
236 # Check if it's the requested file, otherwise ignore signal |
229 # Check if it's the requested file, otherwise ignore signal |
237 if fn != self.filename: |
230 if fn != self.filename: |
238 return |
231 return |
239 |
232 |
240 if nok: |
233 error = problems.get('error') |
|
234 if error: |
241 self.noResults = False |
235 self.noResults = False |
242 self.__createResultItem( |
236 _fn, lineno, col, code, msg = error |
243 fn, line, index, error, code.strip(), False) |
237 self.__createResultItem(_fn, lineno, col, msg, code, False) |
244 else: |
238 |
|
239 warnings = problems.get('warnings', []) |
|
240 if warnings: |
245 source = self.source.splitlines() |
241 source = self.source.splitlines() |
246 for marker, _fn, lineno, col, msg in warnings: |
242 for _fn, lineno, col, code, msg in warnings: |
247 self.noResults = False |
243 self.noResults = False |
248 scr_line = source[lineno - 1].strip() |
244 scr_line = source[lineno - 1].strip() |
249 self.__createResultItem(_fn, lineno, col, msg, scr_line, True) |
245 self.__createResultItem(_fn, lineno, col, msg, scr_line, True) |
|
246 |
250 self.progress += 1 |
247 self.progress += 1 |
251 self.checkProgress.setValue(self.progress) |
248 self.checkProgress.setValue(self.progress) |
252 QApplication.processEvents() |
249 QApplication.processEvents() |
253 self.__resort() |
250 self.__resort() |
254 |
251 |
339 vm = e5App().getObject("ViewManager") |
336 vm = e5App().getObject("ViewManager") |
340 vm.openSourceFile(fn, lineno) |
337 vm.openSourceFile(fn, lineno) |
341 editor = vm.getOpenEditor(fn) |
338 editor = vm.getOpenEditor(fn) |
342 |
339 |
343 if itm.data(0, self.warningRole): |
340 if itm.data(0, self.warningRole): |
344 editor.toggleWarning(lineno, True, error) |
341 editor.toggleWarning(lineno, 0, True, error) |
345 else: |
342 else: |
346 editor.toggleSyntaxError(lineno, index, True, error, show=True) |
343 editor.toggleSyntaxError(lineno, index, True, error, show=True) |
347 else: |
344 else: |
348 fn = Utilities.normabspath(itm.data(0, self.filenameRole)) |
345 fn = Utilities.normabspath(itm.data(0, self.filenameRole)) |
349 vm = e5App().getObject("ViewManager") |
346 vm = e5App().getObject("ViewManager") |
353 citm = itm.child(index) |
350 citm = itm.child(index) |
354 lineno = citm.data(0, self.lineRole) |
351 lineno = citm.data(0, self.lineRole) |
355 index = citm.data(0, self.indexRole) |
352 index = citm.data(0, self.indexRole) |
356 error = citm.data(0, self.errorRole) |
353 error = citm.data(0, self.errorRole) |
357 if citm.data(0, self.warningRole): |
354 if citm.data(0, self.warningRole): |
358 editor.toggleWarning(lineno, True, error) |
355 editor.toggleWarning(lineno, 0, True, error) |
359 else: |
356 else: |
360 editor.toggleSyntaxError( |
357 editor.toggleSyntaxError( |
361 lineno, index, True, error, show=True) |
358 lineno, index, True, error, show=True) |
362 |
359 |
363 @pyqtSlot() |
360 @pyqtSlot() |
384 citm = itm.child(cindex) |
381 citm = itm.child(cindex) |
385 lineno = citm.data(0, self.lineRole) |
382 lineno = citm.data(0, self.lineRole) |
386 index = citm.data(0, self.indexRole) |
383 index = citm.data(0, self.indexRole) |
387 error = citm.data(0, self.errorRole) |
384 error = citm.data(0, self.errorRole) |
388 if citm.data(0, self.warningRole): |
385 if citm.data(0, self.warningRole): |
389 editor.toggleWarning(lineno, True, error) |
386 editor.toggleWarning(lineno, 0, True, error) |
390 else: |
387 else: |
391 editor.toggleSyntaxError( |
388 editor.toggleSyntaxError( |
392 lineno, index, True, error, show=True) |
389 lineno, index, True, error, show=True) |
393 |
390 |
394 # go through the list again to clear syntax error and |
391 # go through the list again to clear syntax error and |