17 from E4Gui.E4Application import e4App |
17 from E4Gui.E4Application import e4App |
18 |
18 |
19 from .Ui_SyntaxCheckerDialog import Ui_SyntaxCheckerDialog |
19 from .Ui_SyntaxCheckerDialog import Ui_SyntaxCheckerDialog |
20 |
20 |
21 import Utilities |
21 import Utilities |
|
22 import Preferences |
22 |
23 |
23 class SyntaxCheckerDialog(QDialog, Ui_SyntaxCheckerDialog): |
24 class SyntaxCheckerDialog(QDialog, Ui_SyntaxCheckerDialog): |
24 """ |
25 """ |
25 Class implementing a dialog to display the results of a syntax check run. |
26 Class implementing a dialog to display the results of a syntax check run. |
26 """ |
27 """ |
75 If this is given, file must be a single file name. |
76 If this is given, file must be a single file name. |
76 """ |
77 """ |
77 if isinstance(fn, list): |
78 if isinstance(fn, list): |
78 files = fn |
79 files = fn |
79 elif os.path.isdir(fn): |
80 elif os.path.isdir(fn): |
80 # TODO: make this dependant on configured extensions |
81 files = [] |
81 files = Utilities.direntries(fn, 1, '*.py', 0) |
82 for ext in Preferences.getPython("Python3Extensions"): |
82 files += Utilities.direntries(fn, 1, '*.pyw', 0) |
83 files.extend(Utilities.direntries(fn, 1, '*%s' % ext, 0)) |
83 files += Utilities.direntries(fn, 1, '*.ptl', 0) |
|
84 else: |
84 else: |
85 files = [fn] |
85 files = [fn] |
86 # TODO: make this dependant on configured extensions |
|
87 files = [f for f in files \ |
86 files = [f for f in files \ |
88 if f.endswith(".py") or f.endswith(".pyw") or f.endswith(".ptl")] |
87 if f.endswith(tuple(Preferences.getPython("Python3Extensions")))] |
89 |
88 |
90 if (codestring and len(files) == 1) or \ |
89 if (codestring and len(files) == 1) or \ |
91 (not codestring and len(files) > 0): |
90 (not codestring and len(files) > 0): |
92 self.checkProgress.setMaximum(len(files)) |
91 self.checkProgress.setMaximum(len(files)) |
93 QApplication.processEvents() |
92 QApplication.processEvents() |