117 QApplication.processEvents() |
117 QApplication.processEvents() |
118 |
118 |
119 # now go through all the files |
119 # now go through all the files |
120 progress = 0 |
120 progress = 0 |
121 for file in files: |
121 for file in files: |
|
122 self.checkProgress.setValue(progress) |
|
123 QApplication.processEvents() |
|
124 self.__resort() |
|
125 |
122 if self.cancelled: |
126 if self.cancelled: |
123 return |
127 return |
124 |
128 |
125 nok, fname, line, error = Tabnanny.check(file) |
129 try: |
|
130 source = Utilities.readEncodedFile(file)[0] |
|
131 # convert eols |
|
132 source = Utilities.convertLineEnds(source, "\n") |
|
133 except (UnicodeError, IOError) as msg: |
|
134 self.noResults = False |
|
135 self.__createResultItem(file, "1", |
|
136 "Error: {0}".format(str(msg)).rstrip()[1:-1]) |
|
137 progress += 1 |
|
138 continue |
|
139 |
|
140 flags = Utilities.extractFlags(source) |
|
141 if "FileType" in flags and flags["FileType"] != "Python3": |
|
142 # skip non Python 3 files |
|
143 progress += 1 |
|
144 continue |
|
145 |
|
146 nok, fname, line, error = Tabnanny.check(file, source) |
126 if nok: |
147 if nok: |
127 self.noResults = False |
148 self.noResults = False |
128 self.__createResultItem(fname, line, error.rstrip()[1:-1]) |
149 self.__createResultItem(fname, line, error.rstrip()[1:-1]) |
129 progress += 1 |
150 progress += 1 |
130 self.checkProgress.setValue(progress) |
151 |
131 QApplication.processEvents() |
152 self.checkProgress.setValue(progress) |
132 self.__resort() |
153 QApplication.processEvents() |
|
154 self.__resort() |
133 else: |
155 else: |
134 self.checkProgress.setMaximum(1) |
156 self.checkProgress.setMaximum(1) |
135 self.checkProgress.setValue(1) |
157 self.checkProgress.setValue(1) |
136 self.__finish() |
158 self.__finish() |
137 |
159 |
178 for filter in filterList: |
200 for filter in filterList: |
179 fileList = \ |
201 fileList = \ |
180 [f for f in fileList if not fnmatch.fnmatch(f, filter.strip())] |
202 [f for f in fileList if not fnmatch.fnmatch(f, filter.strip())] |
181 |
203 |
182 self.resultList.clear() |
204 self.resultList.clear() |
|
205 self.noResults = True |
|
206 self.cancelled = False |
183 self.start(fileList) |
207 self.start(fileList) |
184 |
208 |
185 def on_resultList_itemActivated(self, itm, col): |
209 def on_resultList_itemActivated(self, itm, col): |
186 """ |
210 """ |
187 Private slot to handle the activation of an item. |
211 Private slot to handle the activation of an item. |