Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py

branch
BgService
changeset 3413
5e63f809732a
parent 3228
f489068e51e8
child 3456
96232974dcdb
equal deleted inserted replaced
3412:9364dab2d472 3413:5e63f809732a
36 positionRole = Qt.UserRole + 3 36 positionRole = Qt.UserRole + 3
37 messageRole = Qt.UserRole + 4 37 messageRole = Qt.UserRole + 4
38 fixableRole = Qt.UserRole + 5 38 fixableRole = Qt.UserRole + 5
39 codeRole = Qt.UserRole + 6 39 codeRole = Qt.UserRole + 6
40 40
41 def __init__(self, parent=None): 41 def __init__(self, styleCheckService, parent=None):
42 """ 42 """
43 Constructor 43 Constructor
44 44
45 @param styleCheckService reference to the service
46 (CodeStyleCheckService)
45 @param parent reference to the parent widget (QWidget) 47 @param parent reference to the parent widget (QWidget)
46 """ 48 """
47 super(CodeStyleCheckerDialog, self).__init__(parent) 49 super(CodeStyleCheckerDialog, self).__init__(parent)
48 self.setupUi(self) 50 self.setupUi(self)
49 51
68 70
69 self.checkProgress.setVisible(False) 71 self.checkProgress.setVisible(False)
70 self.checkProgressLabel.setVisible(False) 72 self.checkProgressLabel.setVisible(False)
71 self.checkProgressLabel.setMaximumWidth(600) 73 self.checkProgressLabel.setMaximumWidth(600)
72 74
73 self.internalServices = e5App().getObject('InternalServices') 75 self.styleCheckService = styleCheckService
74 self.internalServices.styleChecked.connect(self.__processResult) 76 self.styleCheckService.styleChecked.connect(self.__processResult)
77 self.filename = None
75 78
76 self.noResults = True 79 self.noResults = True
77 self.cancelled = False 80 self.cancelled = False
78 self.__lastFileItem = None 81 self.__lastFileItem = None
79 82
390 errors.append(error) 393 errors.append(error)
391 self.__itms.append(itm) 394 self.__itms.append(itm)
392 395
393 eol = self.__getEol(self.filename) 396 eol = self.__getEol(self.filename)
394 args = self.__options + [errors, eol, encoding] 397 args = self.__options + [errors, eol, encoding]
395 self.internalServices.styleCheck( 398 self.styleCheckService.styleCheck(
396 self.filename, self.source, args) 399 None, self.filename, self.source, args)
397 400
398 def __processResult(self, fn, codeStyleCheckerStats, fixes, results): 401 def __processResult(self, fn, codeStyleCheckerStats, fixes, results):
399 """ 402 """
400 Privat slot called after perfoming a style check on one file. 403 Privat slot called after perfoming a style check on one file.
401 404
585 588
586 if code == "E901": 589 if code == "E901":
587 editor.toggleSyntaxError(lineno, 0, True, message, True) 590 editor.toggleSyntaxError(lineno, 0, True, message, True)
588 else: 591 else:
589 editor.toggleWarning( 592 editor.toggleWarning(
590 lineno, True, message, warningType=editor.WarningStyle) 593 lineno, 0, True, message, warningType=editor.WarningStyle)
591 594
592 @pyqtSlot() 595 @pyqtSlot()
593 def on_resultList_itemSelectionChanged(self): 596 def on_resultList_itemSelectionChanged(self):
594 """ 597 """
595 Private slot to change the dialog state depending on the selection. 598 Private slot to change the dialog state depending on the selection.
618 for cindex in range(itm.childCount()): 621 for cindex in range(itm.childCount()):
619 citm = itm.child(cindex) 622 citm = itm.child(cindex)
620 lineno = citm.data(0, self.lineRole) 623 lineno = citm.data(0, self.lineRole)
621 message = citm.data(0, self.messageRole) 624 message = citm.data(0, self.messageRole)
622 editor.toggleWarning( 625 editor.toggleWarning(
623 lineno, True, message, warningType=editor.WarningStyle) 626 lineno, 0, True, message, warningType=editor.WarningStyle)
624 627
625 # go through the list again to clear warning markers for files, 628 # go through the list again to clear warning markers for files,
626 # that are ok 629 # that are ok
627 openFiles = vm.getOpenFilenames() 630 openFiles = vm.getOpenFilenames()
628 errorFiles = [] 631 errorFiles = []

eric ide

mercurial