Wed, 24 Jun 2020 17:32:41 +0200
Introduced colors for dark color themes.
--- a/ChangeLog Tue Jun 23 19:05:32 2020 +0200 +++ b/ChangeLog Wed Jun 24 17:32:41 2020 +0200 @@ -1,5 +1,8 @@ ChangeLog --------- +Version 3.0.1: +- introduced colors for dark color themes + Version 3.0.0: - removed support for Python2
--- a/PluginMetricsRadon.py Tue Jun 23 19:05:32 2020 +0200 +++ b/PluginMetricsRadon.py Wed Jun 24 17:32:41 2020 +0200 @@ -26,7 +26,7 @@ author = "Detlev Offenbach <detlev@die-offenbachs.de>" autoactivate = True deactivateable = True -version = "3.0.0" +version = "3.0.1" className = "RadonMetricsPlugin" packageName = "RadonMetrics" shortDescription = "Code metrics plugin using radon package"
--- a/RadonMetrics/CyclomaticComplexityDialog.py Tue Jun 23 19:05:32 2020 +0200 +++ b/RadonMetrics/CyclomaticComplexityDialog.py Wed Jun 24 17:32:41 2020 +0200 @@ -15,6 +15,7 @@ sys.path.insert(0, os.path.dirname(__file__)) from PyQt5.QtCore import pyqtSlot, qVersion, Qt, QTimer, QLocale +from PyQt5.QtGui import QColor from PyQt5.QtWidgets import ( QDialog, QDialogButtonBox, QAbstractButton, QHeaderView, QTreeWidgetItem, QApplication, QMenu @@ -106,19 +107,42 @@ "function": "F", "method": "M", } - self.__typeColors = { - "class": Qt.blue, - "function": Qt.darkCyan, - "method": Qt.magenta, - } - self.__rankColors = { - "A": Qt.green, - "B": Qt.green, - "C": Qt.yellow, - "D": Qt.yellow, - "E": Qt.red, - "F": Qt.red, - } + + try: + usesDarkPalette = e5App().usesDarkPalette() + except AttributeError: + from PyQt5.QtGui import QPalette + palette = e5App().palette() + lightness = palette.color(QPalette.Window).lightness() + usesDarkPalette = lightness <= 128 + if usesDarkPalette: + self.__typeColors = { + "class": QColor("#ffe480"), + "function": QColor("#99ffff"), + "method": QColor("#ff99ff"), + } + self.__rankColors = { + "A": QColor("#308030"), + "B": QColor("#308030"), + "C": QColor("#808030"), + "D": QColor("#808030"), + "E": QColor("#803030"), + "F": QColor("#803030"), + } + else: + self.__typeColors = { + "class": QColor("#0000ff"), + "function": QColor("#008080"), + "method": QColor("#ff00ff"), + } + self.__rankColors = { + "A": QColor("#00ff00"), + "B": QColor("#00ff00"), + "C": QColor("#ffff00"), + "D": QColor("#ffff00"), + "E": QColor("#ff0000"), + "F": QColor("#ff0000"), + } self.__menu = QMenu(self) self.__menu.addAction(self.tr("Collapse all"),
--- a/RadonMetrics/MaintainabilityIndexDialog.py Tue Jun 23 19:05:32 2020 +0200 +++ b/RadonMetrics/MaintainabilityIndexDialog.py Wed Jun 24 17:32:41 2020 +0200 @@ -11,6 +11,7 @@ import fnmatch from PyQt5.QtCore import pyqtSlot, qVersion, Qt, QTimer, QLocale +from PyQt5.QtGui import QColor from PyQt5.QtWidgets import ( QDialog, QDialogButtonBox, QAbstractButton, QHeaderView, QTreeWidgetItem, QApplication @@ -72,11 +73,26 @@ "<tr><td><b>C</b></td><td>9 - 0</td><td>extremely low</td></tr>" "</table>" )) - self.__rankColors = { - "A": Qt.green, - "B": Qt.yellow, - "C": Qt.red, - } + + try: + usesDarkPalette = e5App().usesDarkPalette() + except AttributeError: + from PyQt5.QtGui import QPalette + palette = e5App().palette() + lightness = palette.color(QPalette.Window).lightness() + usesDarkPalette = lightness <= 128 + if usesDarkPalette: + self.__rankColors = { + "A": QColor("#308030"), + "B": QColor("#808030"), + "C": QColor("#803030"), + } + else: + self.__rankColors = { + "A": QColor("#00ff00"), + "B": QColor("#ffff00"), + "C": QColor("#ff0000"), + } def __resizeResultColumns(self): """