96 self.fixIssuesSelectButton.setIcon( |
96 self.fixIssuesSelectButton.setIcon( |
97 UI.PixmapCache.getIcon("select.png")) |
97 UI.PixmapCache.getIcon("select.png")) |
98 self.noFixIssuesSelectButton.setIcon( |
98 self.noFixIssuesSelectButton.setIcon( |
99 UI.PixmapCache.getIcon("select.png")) |
99 UI.PixmapCache.getIcon("select.png")) |
100 |
100 |
101 self.docTypeComboBox.addItem(self.trUtf8("PEP-257"), "pep257") |
101 self.docTypeComboBox.addItem(self.tr("PEP-257"), "pep257") |
102 self.docTypeComboBox.addItem(self.trUtf8("Eric"), "eric") |
102 self.docTypeComboBox.addItem(self.tr("Eric"), "eric") |
103 |
103 |
104 self.statisticsButton = self.buttonBox.addButton( |
104 self.statisticsButton = self.buttonBox.addButton( |
105 self.trUtf8("Statistics..."), QDialogButtonBox.ActionRole) |
105 self.tr("Statistics..."), QDialogButtonBox.ActionRole) |
106 self.statisticsButton.setToolTip( |
106 self.statisticsButton.setToolTip( |
107 self.trUtf8("Press to show some statistics for the last run")) |
107 self.tr("Press to show some statistics for the last run")) |
108 self.statisticsButton.setEnabled(False) |
108 self.statisticsButton.setEnabled(False) |
109 self.showButton = self.buttonBox.addButton( |
109 self.showButton = self.buttonBox.addButton( |
110 self.trUtf8("Show"), QDialogButtonBox.ActionRole) |
110 self.tr("Show"), QDialogButtonBox.ActionRole) |
111 self.showButton.setToolTip( |
111 self.showButton.setToolTip( |
112 self.trUtf8("Press to show all files containing an issue")) |
112 self.tr("Press to show all files containing an issue")) |
113 self.showButton.setEnabled(False) |
113 self.showButton.setEnabled(False) |
114 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
114 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
115 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
115 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
116 |
116 |
117 self.resultList.headerItem().setText(self.resultList.columnCount(), "") |
117 self.resultList.headerItem().setText(self.resultList.columnCount(), "") |
408 source = source.splitlines(True) |
408 source = source.splitlines(True) |
409 except (UnicodeError, IOError) as msg: |
409 except (UnicodeError, IOError) as msg: |
410 self.noResults = False |
410 self.noResults = False |
411 self.__createResultItem( |
411 self.__createResultItem( |
412 file, "1", "1", |
412 file, "1", "1", |
413 self.trUtf8("Error: {0}").format(str(msg)) |
413 self.tr("Error: {0}").format(str(msg)) |
414 .rstrip()[1:-1], False, False) |
414 .rstrip()[1:-1], False, False) |
415 progress += 1 |
415 progress += 1 |
416 continue |
416 continue |
417 |
417 |
418 stats = {} |
418 stats = {} |
491 if fixer: |
491 if fixer: |
492 res, msg, id_ = fixer.fixIssue(lineno, |
492 res, msg, id_ = fixer.fixIssue(lineno, |
493 position, text) |
493 position, text) |
494 if res == 1: |
494 if res == 1: |
495 text += "\n" + \ |
495 text += "\n" + \ |
496 self.trUtf8("Fix: {0}").format(msg) |
496 self.tr("Fix: {0}").format(msg) |
497 self.__createResultItem( |
497 self.__createResultItem( |
498 fname, lineno, position, text, True, |
498 fname, lineno, position, text, True, |
499 True) |
499 True) |
500 elif res == 0: |
500 elif res == 0: |
501 self.__createResultItem( |
501 self.__createResultItem( |
515 for id_ in deferredResults: |
515 for id_ in deferredResults: |
516 fixed, msg = deferredResults[id_] |
516 fixed, msg = deferredResults[id_] |
517 itm = deferredFixes[id_] |
517 itm = deferredFixes[id_] |
518 if fixed == 1: |
518 if fixed == 1: |
519 text = "\n" + \ |
519 text = "\n" + \ |
520 self.trUtf8("Fix: {0}").format(msg) |
520 self.tr("Fix: {0}").format(msg) |
521 self.__modifyFixedResultItem(itm, text, True) |
521 self.__modifyFixedResultItem(itm, text, True) |
522 else: |
522 else: |
523 self.__modifyFixedResultItem(itm, "", False) |
523 self.__modifyFixedResultItem(itm, "", False) |
524 fixer.saveFile(encoding) |
524 fixer.saveFile(encoding) |
525 self.__updateStatistics(stats, fixer) |
525 self.__updateStatistics(stats, fixer) |
549 self.statisticsButton.setEnabled(True) |
549 self.statisticsButton.setEnabled(True) |
550 self.showButton.setEnabled(True) |
550 self.showButton.setEnabled(True) |
551 self.startButton.setEnabled(True) |
551 self.startButton.setEnabled(True) |
552 |
552 |
553 if self.noResults: |
553 if self.noResults: |
554 QTreeWidgetItem(self.resultList, [self.trUtf8('No issues found.')]) |
554 QTreeWidgetItem(self.resultList, [self.tr('No issues found.')]) |
555 QApplication.processEvents() |
555 QApplication.processEvents() |
556 self.statisticsButton.setEnabled(False) |
556 self.statisticsButton.setEnabled(False) |
557 self.showButton.setEnabled(False) |
557 self.showButton.setEnabled(False) |
558 else: |
558 else: |
559 self.statisticsButton.setEnabled(True) |
559 self.statisticsButton.setEnabled(True) |
876 (lineno, position, text), itm = error |
876 (lineno, position, text), itm = error |
877 if lineno > len(source): |
877 if lineno > len(source): |
878 lineno = len(source) |
878 lineno = len(source) |
879 fixed, msg, id_ = fixer.fixIssue(lineno, position, text) |
879 fixed, msg, id_ = fixer.fixIssue(lineno, position, text) |
880 if fixed == 1: |
880 if fixed == 1: |
881 text = "\n" + self.trUtf8("Fix: {0}").format(msg) |
881 text = "\n" + self.tr("Fix: {0}").format(msg) |
882 self.__modifyFixedResultItem(itm, text, True) |
882 self.__modifyFixedResultItem(itm, text, True) |
883 elif fixed == 0: |
883 elif fixed == 0: |
884 self.__modifyFixedResultItem(itm, "", False) |
884 self.__modifyFixedResultItem(itm, "", False) |
885 else: |
885 else: |
886 # remember item for the deferred fix |
886 # remember item for the deferred fix |
888 deferredResults = fixer.finalize() |
888 deferredResults = fixer.finalize() |
889 for id_ in deferredResults: |
889 for id_ in deferredResults: |
890 fixed, msg = deferredResults[id_] |
890 fixed, msg = deferredResults[id_] |
891 itm = deferredFixes[id_] |
891 itm = deferredFixes[id_] |
892 if fixed == 1: |
892 if fixed == 1: |
893 text = "\n" + self.trUtf8("Fix: {0}").format(msg) |
893 text = "\n" + self.tr("Fix: {0}").format(msg) |
894 self.__modifyFixedResultItem(itm, text, True) |
894 self.__modifyFixedResultItem(itm, text, True) |
895 else: |
895 else: |
896 self.__modifyFixedResultItem(itm, "", False) |
896 self.__modifyFixedResultItem(itm, "", False) |
897 fixer.saveFile(encoding) |
897 fixer.saveFile(encoding) |
898 |
898 |