Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py

changeset 4235
81278aff6af9
parent 4234
40741c858639
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.QtWidgets import QDialog, QDialogButtonBox, QTreeWidgetItem, \ 16 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QTreeWidgetItem, \
17 QApplication, QHeaderView 17 QApplication, QHeaderView
18 18
19 from E5Gui.E5Application import e5App 19 from E5Gui.E5Application import e5App
20 20
329 def __finish(self): 329 def __finish(self):
330 """ 330 """
331 Private slot called when the syntax check finished or the user 331 Private slot called when the syntax check finished or the user
332 pressed the button. 332 pressed the button.
333 """ 333 """
334 self.__finished = True 334 if not self.__finished:
335 335 self.__finished = True
336 self.cancelled = True 336
337 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) 337 self.cancelled = True
338 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) 338 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True)
339 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) 339 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False)
340 340 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True)
341 if self.noResults: 341
342 QTreeWidgetItem(self.resultList, [self.tr('No issues found.')]) 342 if self.noResults:
343 QApplication.processEvents() 343 QTreeWidgetItem(self.resultList, [self.tr('No issues found.')])
344 self.showButton.setEnabled(False) 344 QApplication.processEvents()
345 else: 345 self.showButton.setEnabled(False)
346 self.showButton.setEnabled(True) 346 else:
347 self.resultList.header().resizeSections(QHeaderView.ResizeToContents) 347 self.showButton.setEnabled(True)
348 self.resultList.header().setStretchLastSection(True) 348 self.resultList.header().resizeSections(QHeaderView.ResizeToContents)
349 349 self.resultList.header().setStretchLastSection(True)
350 self.checkProgress.setVisible(False) 350
351 self.checkProgressLabel.setVisible(False) 351 self.checkProgress.setVisible(False)
352 self.checkProgressLabel.setVisible(False)
352 353
353 def on_buttonBox_clicked(self, button): 354 def on_buttonBox_clicked(self, button):
354 """ 355 """
355 Private slot called by a button of the button box clicked. 356 Private slot called by a button of the button box clicked.
356 357
359 if button == self.buttonBox.button(QDialogButtonBox.Close): 360 if button == self.buttonBox.button(QDialogButtonBox.Close):
360 self.close() 361 self.close()
361 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): 362 elif button == self.buttonBox.button(QDialogButtonBox.Cancel):
362 if self.__batch: 363 if self.__batch:
363 self.syntaxCheckService.cancelSyntaxBatchCheck() 364 self.syntaxCheckService.cancelSyntaxBatchCheck()
365 QTimer.singleShot(1000, self.__finish)
364 else: 366 else:
365 self.__finish() 367 self.__finish()
366 elif button == self.showButton: 368 elif button == self.showButton:
367 self.on_showButton_clicked() 369 self.on_showButton_clicked()
368 370

eric ide

mercurial