25 QListWidgetItem, |
25 QListWidgetItem, |
26 QInputDialog, |
26 QInputDialog, |
27 QLineEdit, |
27 QLineEdit, |
28 ) |
28 ) |
29 |
29 |
30 from EricWidgets.EricApplication import ericApp |
30 from eric7.EricWidgets.EricApplication import ericApp |
31 |
31 |
32 from .Ui_CodeStyleCheckerDialog import Ui_CodeStyleCheckerDialog |
32 from .Ui_CodeStyleCheckerDialog import Ui_CodeStyleCheckerDialog |
33 |
33 |
34 import UI.PixmapCache |
34 from eric7.EricGui import EricPixmapCache |
35 import Preferences |
35 from eric7 import Preferences, Utilities |
36 import Utilities |
|
37 |
36 |
38 from . import pycodestyle |
37 from . import pycodestyle |
39 from . import CodeStyleCheckerUtilities |
38 from . import CodeStyleCheckerUtilities |
40 |
39 |
41 from .Miscellaneous.MiscellaneousDefaults import MiscellaneousCheckerDefaultArgs |
40 from .Miscellaneous.MiscellaneousDefaults import MiscellaneousCheckerDefaultArgs |
119 |
118 |
120 self.__project = project |
119 self.__project = project |
121 |
120 |
122 self.optionsTabWidget.setCurrentIndex(0) |
121 self.optionsTabWidget.setCurrentIndex(0) |
123 |
122 |
124 self.excludeMessagesSelectButton.setIcon(UI.PixmapCache.getIcon("select")) |
123 self.excludeMessagesSelectButton.setIcon(EricPixmapCache.getIcon("select")) |
125 self.includeMessagesSelectButton.setIcon(UI.PixmapCache.getIcon("select")) |
124 self.includeMessagesSelectButton.setIcon(EricPixmapCache.getIcon("select")) |
126 self.fixIssuesSelectButton.setIcon(UI.PixmapCache.getIcon("select")) |
125 self.fixIssuesSelectButton.setIcon(EricPixmapCache.getIcon("select")) |
127 self.noFixIssuesSelectButton.setIcon(UI.PixmapCache.getIcon("select")) |
126 self.noFixIssuesSelectButton.setIcon(EricPixmapCache.getIcon("select")) |
128 |
127 |
129 self.docTypeComboBox.addItem(self.tr("PEP-257"), "pep257") |
128 self.docTypeComboBox.addItem(self.tr("PEP-257"), "pep257") |
130 self.docTypeComboBox.addItem(self.tr("Eric"), "eric") |
129 self.docTypeComboBox.addItem(self.tr("Eric"), "eric") |
131 self.docTypeComboBox.addItem(self.tr("Eric (Blacked)"), "eric_black") |
130 self.docTypeComboBox.addItem(self.tr("Eric (Blacked)"), "eric_black") |
132 |
131 |
158 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(False) |
157 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(False) |
159 |
158 |
160 self.resultList.headerItem().setText(self.resultList.columnCount(), "") |
159 self.resultList.headerItem().setText(self.resultList.columnCount(), "") |
161 self.resultList.header().setSortIndicator(0, Qt.SortOrder.AscendingOrder) |
160 self.resultList.header().setSortIndicator(0, Qt.SortOrder.AscendingOrder) |
162 |
161 |
163 self.addBuiltinButton.setIcon(UI.PixmapCache.getIcon("plus")) |
162 self.addBuiltinButton.setIcon(EricPixmapCache.getIcon("plus")) |
164 self.deleteBuiltinButton.setIcon(UI.PixmapCache.getIcon("minus")) |
163 self.deleteBuiltinButton.setIcon(EricPixmapCache.getIcon("minus")) |
165 self.addWhitelistButton.setIcon(UI.PixmapCache.getIcon("plus")) |
164 self.addWhitelistButton.setIcon(EricPixmapCache.getIcon("plus")) |
166 self.deleteWhitelistButton.setIcon(UI.PixmapCache.getIcon("minus")) |
165 self.deleteWhitelistButton.setIcon(EricPixmapCache.getIcon("minus")) |
167 |
166 |
168 self.restartButton.setEnabled(False) |
167 self.restartButton.setEnabled(False) |
169 self.fixButton.setEnabled(False) |
168 self.fixButton.setEnabled(False) |
170 |
169 |
171 self.checkProgress.setVisible(False) |
170 self.checkProgress.setVisible(False) |
291 ) |
290 ) |
292 |
291 |
293 CodeStyleCheckerUtilities.setItemIcon(itm, 1, msgCode, result.get("severity")) |
292 CodeStyleCheckerUtilities.setItemIcon(itm, 1, msgCode, result.get("severity")) |
294 |
293 |
295 if result["fixed"]: |
294 if result["fixed"]: |
296 itm.setIcon(0, UI.PixmapCache.getIcon("issueFixed")) |
295 itm.setIcon(0, EricPixmapCache.getIcon("issueFixed")) |
297 elif ( |
296 elif ( |
298 msgCode in FixableCodeStyleIssues |
297 msgCode in FixableCodeStyleIssues |
299 and not result["autofixing"] |
298 and not result["autofixing"] |
300 and msgCode not in self.__noFixCodesList |
299 and msgCode not in self.__noFixCodesList |
301 ): |
300 ): |
302 itm.setIcon(0, UI.PixmapCache.getIcon("issueFixable")) |
301 itm.setIcon(0, EricPixmapCache.getIcon("issueFixable")) |
303 fixable = True |
302 fixable = True |
304 |
303 |
305 itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight) |
304 itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight) |
306 itm.setTextAlignment(1, Qt.AlignmentFlag.AlignHCenter) |
305 itm.setTextAlignment(1, Qt.AlignmentFlag.AlignHCenter) |
307 |
306 |
336 @param result dictionary containing check result data |
335 @param result dictionary containing check result data |
337 @type dict |
336 @type dict |
338 """ |
337 """ |
339 if result["fixed"]: |
338 if result["fixed"]: |
340 itm.setText(2, result["display"]) |
339 itm.setText(2, result["display"]) |
341 itm.setIcon(0, UI.PixmapCache.getIcon("issueFixed")) |
340 itm.setIcon(0, EricPixmapCache.getIcon("issueFixed")) |
342 |
341 |
343 itm.setData(0, self.messageRole, result["display"]) |
342 itm.setData(0, self.messageRole, result["display"]) |
344 else: |
343 else: |
345 itm.setIcon(0, QIcon()) |
344 itm.setIcon(0, QIcon()) |
346 itm.setData(0, self.fixableRole, False) |
345 itm.setData(0, self.fixableRole, False) |