234 self.resultList.setUpdatesEnabled(False) |
234 self.resultList.setUpdatesEnabled(False) |
235 self.resultList.setSortingEnabled(False) |
235 self.resultList.setSortingEnabled(False) |
236 |
236 |
237 self.checkProgress.setMaximum(len(self.files)) |
237 self.checkProgress.setMaximum(len(self.files)) |
238 self.checkProgress.setVisible(len(self.files) > 1) |
238 self.checkProgress.setVisible(len(self.files) > 1) |
239 self.checkProgressLabel.setVisible(len(self.files) > 1) |
|
240 QApplication.processEvents() |
239 QApplication.processEvents() |
241 |
240 |
242 # now go through all the files |
241 # now go through all the files |
243 self.progress = 0 |
242 self.progress = 0 |
244 if len(self.files) == 1: |
243 if len(self.files) == 1: |
253 Public method to start a vulture check for one Python file. |
252 Public method to start a vulture check for one Python file. |
254 |
253 |
255 The results are reported to the __processResult slot. |
254 The results are reported to the __processResult slot. |
256 """ |
255 """ |
257 if not self.files: |
256 if not self.files: |
258 self.checkProgressLabel.setPath("") |
|
259 self.checkProgress.setMaximum(1) |
257 self.checkProgress.setMaximum(1) |
260 self.checkProgress.setValue(1) |
258 self.checkProgress.setValue(1) |
261 self.__finish() |
259 self.__finish() |
262 return |
260 return |
263 |
261 |
264 self.filename = self.files.pop(0) |
262 self.filename = self.files.pop(0) |
265 self.checkProgress.setValue(self.progress) |
263 self.checkProgress.setValue(self.progress) |
266 self.checkProgressLabel.setPath(self.filename) |
|
267 QApplication.processEvents() |
264 QApplication.processEvents() |
268 |
265 |
269 if self.cancelled: |
266 if self.cancelled: |
270 return |
267 return |
271 |
268 |
287 """ |
284 """ |
288 Public method to start a vulture check batch job. |
285 Public method to start a vulture check batch job. |
289 |
286 |
290 The results are reported to the __processResult slot. |
287 The results are reported to the __processResult slot. |
291 """ |
288 """ |
292 self.checkProgressLabel.setPath(self.tr("Preparing files...")) |
|
293 |
|
294 argumentsList = [] |
289 argumentsList = [] |
295 for progress, filename in enumerate(self.files, start=1): |
290 for progress, filename in enumerate(self.files, start=1): |
296 self.checkProgress.setValue(progress) |
291 self.checkProgress.setValue(progress) |
297 QApplication.processEvents() |
292 QApplication.processEvents() |
298 |
293 |
305 |
300 |
306 argumentsList.append((filename, source)) |
301 argumentsList.append((filename, source)) |
307 |
302 |
308 # reset the progress bar to the checked files |
303 # reset the progress bar to the checked files |
309 self.checkProgress.setValue(self.progress) |
304 self.checkProgress.setValue(self.progress) |
310 self.checkProgressLabel.setPath(self.tr("Transferring data...")) |
|
311 QApplication.processEvents() |
305 QApplication.processEvents() |
312 |
306 |
313 self.__finished = False |
307 self.__finished = False |
314 self.vultureService.vultureCheckBatch(argumentsList) |
308 self.vultureService.vultureCheckBatch(argumentsList) |
315 |
309 |
316 def __batchFinished(self): |
310 def __batchFinished(self): |
317 """ |
311 """ |
318 Private slot handling the completion of a batch job. |
312 Private slot handling the completion of a batch job. |
319 """ |
313 """ |
320 self.checkProgressLabel.setPath("") |
|
321 self.checkProgress.setMaximum(1) |
314 self.checkProgress.setMaximum(1) |
322 self.checkProgress.setValue(1) |
315 self.checkProgress.setValue(1) |
323 self.__finish() |
316 self.__finish() |
324 |
317 |
325 def __processError(self, fn, msg): |
318 def __processError(self, fn, msg): |
347 |
340 |
348 # Check if it's the requested file, otherwise ignore signal if not |
341 # Check if it's the requested file, otherwise ignore signal if not |
349 # in batch mode |
342 # in batch mode |
350 if not self.__batch and fn != self.filename: |
343 if not self.__batch and fn != self.filename: |
351 return |
344 return |
352 |
|
353 self.checkProgressLabel.setPath(self.__project.getRelativePath(fn)) |
|
354 QApplication.processEvents() |
|
355 |
345 |
356 if "error" in result: |
346 if "error" in result: |
357 self.__createErrorItem(fn, result["error"]) |
347 self.__createErrorItem(fn, result["error"]) |
358 else: |
348 else: |
359 self.__storeResult(result) |
349 self.__storeResult(result) |
395 self.resultList.header().setStretchLastSection(True) |
385 self.resultList.header().setStretchLastSection(True) |
396 self.resultList.header().setSectionResizeMode( |
386 self.resultList.header().setSectionResizeMode( |
397 QHeaderView.ResizeMode.Interactive) |
387 QHeaderView.ResizeMode.Interactive) |
398 |
388 |
399 self.checkProgress.setVisible(False) |
389 self.checkProgress.setVisible(False) |
400 self.checkProgressLabel.setVisible(False) |
|
401 |
390 |
402 if self.resultList.topLevelItemCount() == 0: |
391 if self.resultList.topLevelItemCount() == 0: |
403 itm = QTreeWidgetItem(self.resultList, |
392 itm = QTreeWidgetItem(self.resultList, |
404 [self.tr("No unused code found.")]) |
393 [self.tr("No unused code found.")]) |
405 itm.setFirstColumnSpanned(True) |
394 itm.setFirstColumnSpanned(True) |