Plugins/CheckerPlugins/Pep8/Pep8Dialog.py

changeset 2947
bd95f61c4f96
parent 2929
28ab0bc63d69
child 2958
ed0a8d4304a8
child 3056
9986ec0e559a
equal deleted inserted replaced
2946:987b6368dbae 2947:bd95f61c4f96
104 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) 104 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
105 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 105 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
106 106
107 self.resultList.headerItem().setText(self.resultList.columnCount(), "") 107 self.resultList.headerItem().setText(self.resultList.columnCount(), "")
108 self.resultList.header().setSortIndicator(0, Qt.AscendingOrder) 108 self.resultList.header().setSortIndicator(0, Qt.AscendingOrder)
109
110 self.checkProgress.setVisible(False)
111 self.checkProgressLabel.setVisible(False)
112 self.checkProgressLabel.setMaximumWidth(600)
109 113
110 self.noResults = True 114 self.noResults = True
111 self.cancelled = False 115 self.cancelled = False
112 self.__lastFileItem = None 116 self.__lastFileItem = None
113 117
309 self.showButton.setEnabled(False) 313 self.showButton.setEnabled(False)
310 self.fixButton.setEnabled(False) 314 self.fixButton.setEnabled(False)
311 self.startButton.setEnabled(False) 315 self.startButton.setEnabled(False)
312 if repeat is not None: 316 if repeat is not None:
313 self.repeatCheckBox.setChecked(repeat) 317 self.repeatCheckBox.setChecked(repeat)
318 self.checkProgress.setVisible(True)
314 QApplication.processEvents() 319 QApplication.processEvents()
315 320
316 self.__resetStatistics() 321 self.__resetStatistics()
317 322
318 if save: 323 if save:
348 if f.endswith( 353 if f.endswith(
349 tuple(Preferences.getPython("PythonExtensions")))] 354 tuple(Preferences.getPython("PythonExtensions")))]
350 355
351 if len(py3files) + len(py2files) > 0: 356 if len(py3files) + len(py2files) > 0:
352 self.checkProgress.setMaximum(len(py3files) + len(py2files)) 357 self.checkProgress.setMaximum(len(py3files) + len(py2files))
358 self.checkProgressLabel.setVisible(
359 len(py3files) + len(py2files) > 1)
353 QApplication.processEvents() 360 QApplication.processEvents()
354 361
355 # extract the configuration values 362 # extract the configuration values
356 excludeMessages = self.excludeMessagesEdit.text() 363 excludeMessages = self.excludeMessagesEdit.text()
357 includeMessages = self.includeMessagesEdit.text() 364 includeMessages = self.includeMessagesEdit.text()
369 self.resultList.setUpdatesEnabled(False) 376 self.resultList.setUpdatesEnabled(False)
370 self.resultList.setSortingEnabled(False) 377 self.resultList.setSortingEnabled(False)
371 378
372 # now go through all the files 379 # now go through all the files
373 progress = 0 380 progress = 0
374 for file in py3files + py2files: 381 for file in sorted(py3files + py2files):
375 self.checkProgress.setValue(progress) 382 self.checkProgress.setValue(progress)
383 self.checkProgressLabel.setPath(file)
376 QApplication.processEvents() 384 QApplication.processEvents()
377 385
378 if self.cancelled: 386 if self.cancelled:
379 self.__resort() 387 self.__resort()
380 return 388 return
410 self.__project.isOpen() and \ 418 self.__project.isOpen() and \
411 self.__project.isProjectFile(file) and \ 419 self.__project.isProjectFile(file) and \
412 self.__project.getProjectLanguage() in ["Python", 420 self.__project.getProjectLanguage() in ["Python",
413 "Python2"]): 421 "Python2"]):
414 from .Pep8Checker import Pep8Py2Checker 422 from .Pep8Checker import Pep8Py2Checker
415 # TODO: add the docType into the Py2 variant
416 report = Pep8Py2Checker(file, [], 423 report = Pep8Py2Checker(file, [],
417 repeat=repeatMessages, 424 repeat=repeatMessages,
418 select=includeMessages, 425 select=includeMessages,
419 ignore=excludeMessages, 426 ignore=excludeMessages,
420 max_line_length=maxLineLength, 427 max_line_length=maxLineLength,
498 finally: 505 finally:
499 # reenable updates of the list 506 # reenable updates of the list
500 self.resultList.setSortingEnabled(True) 507 self.resultList.setSortingEnabled(True)
501 self.resultList.setUpdatesEnabled(True) 508 self.resultList.setUpdatesEnabled(True)
502 self.checkProgress.setValue(progress) 509 self.checkProgress.setValue(progress)
510 self.checkProgressLabel.setPath("")
503 QApplication.processEvents() 511 QApplication.processEvents()
504 self.__resort() 512 self.__resort()
505 else: 513 else:
506 self.checkProgress.setMaximum(1) 514 self.checkProgress.setMaximum(1)
507 self.checkProgress.setValue(1) 515 self.checkProgress.setValue(1)
529 else: 537 else:
530 self.statisticsButton.setEnabled(True) 538 self.statisticsButton.setEnabled(True)
531 self.showButton.setEnabled(True) 539 self.showButton.setEnabled(True)
532 self.resultList.header().resizeSections(QHeaderView.ResizeToContents) 540 self.resultList.header().resizeSections(QHeaderView.ResizeToContents)
533 self.resultList.header().setStretchLastSection(True) 541 self.resultList.header().setStretchLastSection(True)
542
543 self.checkProgress.setVisible(False)
544 self.checkProgressLabel.setVisible(False)
534 545
535 @pyqtSlot() 546 @pyqtSlot()
536 def on_startButton_clicked(self): 547 def on_startButton_clicked(self):
537 """ 548 """
538 Private slot to start a PEP 8 check run. 549 Private slot to start a PEP 8 check run.

eric ide

mercurial