Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py

changeset 4235
81278aff6af9
parent 4221
c9fdc07753a7
child 4236
8d4e498a7af8
equal deleted inserted replaced
4234:40741c858639 4235:81278aff6af9
10 from __future__ import unicode_literals 10 from __future__ import unicode_literals
11 11
12 import os 12 import os
13 import fnmatch 13 import fnmatch
14 14
15 from PyQt5.QtCore import pyqtSlot, Qt 15 from PyQt5.QtCore import pyqtSlot, Qt, QTimer
16 from PyQt5.QtGui import QIcon 16 from PyQt5.QtGui import QIcon
17 from PyQt5.QtWidgets import QDialog, QTreeWidgetItem, QAbstractButton, \ 17 from PyQt5.QtWidgets import QDialog, QTreeWidgetItem, QAbstractButton, \
18 QDialogButtonBox, QApplication, QHeaderView 18 QDialogButtonBox, QApplication, QHeaderView
19 19
20 from E5Gui.E5Application import e5App 20 from E5Gui.E5Application import e5App
568 def __finish(self): 568 def __finish(self):
569 """ 569 """
570 Private slot called when the code style check finished or the user 570 Private slot called when the code style check finished or the user
571 pressed the cancel button. 571 pressed the cancel button.
572 """ 572 """
573 self.__finished = True 573 if not self.__finished:
574 574 self.__finished = True
575 self.cancelled = True 575
576 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) 576 self.cancelled = True
577 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) 577 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True)
578 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) 578 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False)
579 self.statisticsButton.setEnabled(True) 579 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True)
580 self.showButton.setEnabled(True) 580 self.statisticsButton.setEnabled(True)
581 self.startButton.setEnabled(True)
582
583 if self.noResults:
584 QTreeWidgetItem(self.resultList, [self.tr('No issues found.')])
585 QApplication.processEvents()
586 self.showButton.setEnabled(False)
587 else:
588 self.showButton.setEnabled(True) 581 self.showButton.setEnabled(True)
589 self.resultList.header().resizeSections(QHeaderView.ResizeToContents) 582 self.startButton.setEnabled(True)
590 self.resultList.header().setStretchLastSection(True) 583
591 584 if self.noResults:
592 self.checkProgress.setVisible(False) 585 QTreeWidgetItem(self.resultList, [self.tr('No issues found.')])
593 self.checkProgressLabel.setVisible(False) 586 QApplication.processEvents()
587 self.showButton.setEnabled(False)
588 else:
589 self.showButton.setEnabled(True)
590 self.resultList.header().resizeSections(QHeaderView.ResizeToContents)
591 self.resultList.header().setStretchLastSection(True)
592
593 self.checkProgress.setVisible(False)
594 self.checkProgressLabel.setVisible(False)
594 595
595 def __getEol(self, fn): 596 def __getEol(self, fn):
596 """ 597 """
597 Private method to get the applicable eol string. 598 Private method to get the applicable eol string.
598 599
850 if button == self.buttonBox.button(QDialogButtonBox.Close): 851 if button == self.buttonBox.button(QDialogButtonBox.Close):
851 self.close() 852 self.close()
852 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): 853 elif button == self.buttonBox.button(QDialogButtonBox.Cancel):
853 if self.__batch: 854 if self.__batch:
854 self.styleCheckService.cancelStyleBatchCheck() 855 self.styleCheckService.cancelStyleBatchCheck()
856 QTimer.singleShot(1000, self.__finish)
855 else: 857 else:
856 self.__finish() 858 self.__finish()
857 elif button == self.showButton: 859 elif button == self.showButton:
858 self.on_showButton_clicked() 860 self.on_showButton_clicked()
859 elif button == self.statisticsButton: 861 elif button == self.statisticsButton:

eric ide

mercurial