--- a/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py Fri Nov 04 22:07:05 2016 +0100 +++ b/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py Sun Nov 06 13:31:38 2016 +0100 @@ -32,10 +32,6 @@ except Exception: basestring = str # define for Python3 -NO_RESULTS = 0 -NO_FILES = 1 -HAS_RESULTS = 2 - class CodeStyleCheckerDialog(QDialog, Ui_CodeStyleCheckerDialog): """ @@ -53,6 +49,10 @@ 'division', 'absolute_import', 'with_statement', 'print_function', 'unicode_literals', 'generator_stop'] + noResults = 0 + noFiles = 1 + hasResults = 2 + def __init__(self, styleCheckService, parent=None): """ Constructor @@ -105,7 +105,7 @@ self.styleCheckService.error.connect(self.__processError) self.filename = None - self.results = NO_RESULTS + self.results = CodeStyleCheckerDialog.noResults self.cancelled = False self.__lastFileItem = None self.__batch = False @@ -447,7 +447,7 @@ self.__batch = True self.checkBatch() else: - self.results = NO_FILES + self.results = CodeStyleCheckerDialog.noFiles self.__finished = False self.__finish() @@ -508,7 +508,7 @@ self.filename) source = source.splitlines(True) except (UnicodeError, IOError) as msg: - self.results = HAS_RESULTS + self.results = CodeStyleCheckerDialog.hasResults self.__createResultItem( self.filename, 1, 1, self.tr("Error: {0}").format(str(msg)) @@ -559,7 +559,7 @@ filename) source = source.splitlines(True) except (UnicodeError, IOError) as msg: - self.results = HAS_RESULTS + self.results = CodeStyleCheckerDialog.hasResults self.__createResultItem( filename, 1, 1, self.tr("Error: {0}").format(str(msg)) @@ -656,7 +656,7 @@ text = self.tr("{0} (ignored)").format(text) else: continue - self.results = HAS_RESULTS + self.results = CodeStyleCheckerDialog.hasResults self.__createResultItem( fn, lineno, position, text, fixed, autofixing, ignored) @@ -699,8 +699,8 @@ self.showButton.setEnabled(True) self.startButton.setEnabled(True) - if self.results < HAS_RESULTS: - if self.results == NO_RESULTS: + if self.results != CodeStyleCheckerDialog.hasResults: + if self.results == CodeStyleCheckerDialog.noResults: QTreeWidgetItem( self.resultList, [self.tr('No issues found.')]) else: @@ -762,7 +762,7 @@ self.__data) self.resultList.clear() - self.results = NO_RESULTS + self.results = CodeStyleCheckerDialog.noResults self.cancelled = False self.start(self.__fileOrFileList) @@ -819,7 +819,7 @@ @param item reference to the activated item (QTreeWidgetItem) @param column column the item was activated in (integer) """ - if self.results < HAS_RESULTS: + if self.results != CodeStyleCheckerDialog.hasResults: return if item.parent():