Plugins/CheckerPlugins/Tabnanny/TabnannyDialog.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2680
110ac646a3a0
parent 3004
c4bf32c791d0
child 3058
0a02c433f52d
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
2 2
3 # Copyright (c) 2003 - 2013 Detlev Offenbach <detlev@die-offenbachs.de> 3 # Copyright (c) 2003 - 2013 Detlev Offenbach <detlev@die-offenbachs.de>
4 # 4 #
5 5
6 """ 6 """
7 Module implementing a dialog to show the output of the tabnanny command process. 7 Module implementing a dialog to show the output of the tabnanny command
8 process.
8 """ 9 """
9 10
10 from __future__ import unicode_literals # __IGNORE_WARNING__ 11 from __future__ import unicode_literals # __IGNORE_WARNING__
11 try: 12 try:
12 str = unicode # __IGNORE_WARNING__ 13 str = unicode # __IGNORE_WARNING__
15 16
16 import os 17 import os
17 import fnmatch 18 import fnmatch
18 19
19 from PyQt4.QtCore import pyqtSlot, Qt 20 from PyQt4.QtCore import pyqtSlot, Qt
20 from PyQt4.QtGui import QDialog, QDialogButtonBox, QTreeWidgetItem, QApplication, \ 21 from PyQt4.QtGui import QDialog, QDialogButtonBox, QTreeWidgetItem, \
21 QHeaderView 22 QApplication, QHeaderView
22 23
23 from E5Gui.E5Application import e5App 24 from E5Gui.E5Application import e5App
24 25
25 from .Ui_TabnannyDialog import Ui_TabnannyDialog 26 from .Ui_TabnannyDialog import Ui_TabnannyDialog
26 27
56 57
57 def __resort(self): 58 def __resort(self):
58 """ 59 """
59 Private method to resort the tree. 60 Private method to resort the tree.
60 """ 61 """
61 self.resultList.sortItems(self.resultList.sortColumn(), 62 self.resultList.sortItems(
62 self.resultList.header().sortIndicatorOrder()) 63 self.resultList.sortColumn(),
64 self.resultList.header().sortIndicatorOrder())
63 65
64 def __createResultItem(self, file, line, sourcecode): 66 def __createResultItem(self, file, line, sourcecode):
65 """ 67 """
66 Private method to create an entry in the result list. 68 Private method to create an entry in the result list.
67 69
117 elif os.path.isdir(fn): 119 elif os.path.isdir(fn):
118 files = [] 120 files = []
119 extensions = set(Preferences.getPython("PythonExtensions") + 121 extensions = set(Preferences.getPython("PythonExtensions") +
120 Preferences.getPython("Python3Extensions")) 122 Preferences.getPython("Python3Extensions"))
121 for ext in extensions: 123 for ext in extensions:
122 files.extend(Utilities.direntries(fn, True, '*{0}'.format(ext), 0)) 124 files.extend(
125 Utilities.direntries(fn, True, '*{0}'.format(ext), 0))
123 else: 126 else:
124 files = [fn] 127 files = [fn]
125 128
126 if len(files) > 0: 129 if len(files) > 0:
127 self.checkProgress.setMaximum(len(files)) 130 self.checkProgress.setMaximum(len(files))
170 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) 173 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True)
171 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) 174 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False)
172 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) 175 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True)
173 176
174 if self.noResults: 177 if self.noResults:
175 self.__createResultItem(self.trUtf8('No indentation errors found.'), "", "") 178 self.__createResultItem(
179 self.trUtf8('No indentation errors found.'), "", "")
176 QApplication.processEvents() 180 QApplication.processEvents()
177 self.resultList.header().resizeSections(QHeaderView.ResizeToContents) 181 self.resultList.header().resizeSections(QHeaderView.ResizeToContents)
178 self.resultList.header().setStretchLastSection(True) 182 self.resultList.header().setStretchLastSection(True)
179 183
180 def on_buttonBox_clicked(self, button): 184 def on_buttonBox_clicked(self, button):

eric ide

mercurial