PyLint/PyLintExecDialog.py

branch
eric5
changeset 37
6d16eddede1e
parent 33
b4cb9692bd3d
equal deleted inserted replaced
36:3d5dc11c8d8c 37:6d16eddede1e
35 This class starts a QProcess and displays a dialog that 35 This class starts a QProcess and displays a dialog that
36 shows the results of the PyLint command process. 36 shows the results of the PyLint command process.
37 """ 37 """
38 filenameRole = Qt.UserRole + 1 38 filenameRole = Qt.UserRole + 1
39 39
40 def __init__(self, parent=None): 40 def __init__(self, ui, parent=None):
41 """ 41 """
42 Constructor 42 Constructor
43 43
44 @param ui reference to the main window (UI.UserInterface)
44 @param parent parent widget of this dialog (QWidget) 45 @param parent parent widget of this dialog (QWidget)
45 """ 46 """
46 QWidget.__init__(self, parent) 47 QWidget.__init__(self, parent)
47 self.setupUi(self) 48 self.setupUi(self)
49
50 self.__ui = ui
48 51
49 self.saveButton = self.buttonBox.addButton( 52 self.saveButton = self.buttonBox.addButton(
50 self.trUtf8("Save Report..."), QDialogButtonBox.ActionRole) 53 self.trUtf8("Save Report..."), QDialogButtonBox.ActionRole)
51 self.saveButton.setToolTip( 54 self.saveButton.setToolTip(
52 self.trUtf8("Press to save the report to a file")) 55 self.trUtf8("Press to save the report to a file"))
341 lineno = int(itm.text(0)) 344 lineno = int(itm.text(0))
342 345
343 vm = e5App().getObject("ViewManager") 346 vm = e5App().getObject("ViewManager")
344 vm.openSourceFile(fn, lineno) 347 vm.openSourceFile(fn, lineno)
345 editor = vm.getOpenEditor(fn) 348 editor = vm.getOpenEditor(fn)
346 editor.toggleWarning( 349 if self.__ui.versionIsNewer("5.4.99", "20140101"):
347 lineno, True, 350 editor.toggleWarning(
348 "{0} | {1}".format(itm.text(1), itm.text(2))) 351 lineno, 0, True,
352 "{0} | {1}".format(itm.text(1), itm.text(2)))
353 else:
354 editor.toggleWarning(
355 lineno, True,
356 "{0} | {1}".format(itm.text(1), itm.text(2)))
349 else: 357 else:
350 fn = os.path.join(self.pathname, itm.data(0, self.filenameRole)) 358 fn = os.path.join(self.pathname, itm.data(0, self.filenameRole))
351 vm = e5App().getObject("ViewManager") 359 vm = e5App().getObject("ViewManager")
352 vm.openSourceFile(fn) 360 vm.openSourceFile(fn)
353 editor = vm.getOpenEditor(fn) 361 editor = vm.getOpenEditor(fn)
354 for index in range(itm.childCount()): 362 for index in range(itm.childCount()):
355 citm = itm.child(index) 363 citm = itm.child(index)
356 lineno = int(citm.text(0)) 364 lineno = int(citm.text(0))
357 editor.toggleWarning( 365 if self.__ui.versionIsNewer("5.4.99", "20140101"):
358 lineno, True, 366 editor.toggleWarning(
359 "{0} | {1}".format(citm.text(1), citm.text(2))) 367 lineno, 0, True,
368 "{0} | {1}".format(citm.text(1), citm.text(2)))
369 else:
370 editor.toggleWarning(
371 lineno, True,
372 "{0} | {1}".format(citm.text(1), citm.text(2)))
360 373
361 def __writeReport(self): 374 def __writeReport(self):
362 """ 375 """
363 Private slot to write the report to a report file. 376 Private slot to write the report to a report file.
364 """ 377 """

eric ide

mercurial