RadonMetrics/MaintainabilityIndexDialog.py

changeset 71
1e69db534be1
parent 69
cdf51e6abaee
child 73
4613ae4283ed
equal deleted inserted replaced
70:b599bc89e7a1 71:1e69db534be1
9 9
10 import os 10 import os
11 import fnmatch 11 import fnmatch
12 12
13 from PyQt5.QtCore import pyqtSlot, qVersion, Qt, QTimer, QLocale 13 from PyQt5.QtCore import pyqtSlot, qVersion, Qt, QTimer, QLocale
14 from PyQt5.QtGui import QColor
14 from PyQt5.QtWidgets import ( 15 from PyQt5.QtWidgets import (
15 QDialog, QDialogButtonBox, QAbstractButton, QHeaderView, QTreeWidgetItem, 16 QDialog, QDialogButtonBox, QAbstractButton, QHeaderView, QTreeWidgetItem,
16 QApplication 17 QApplication
17 ) 18 )
18 19
70 "<tr><td><b>A</b></td><td>100 - 20</td><td>very high</td></tr>" 71 "<tr><td><b>A</b></td><td>100 - 20</td><td>very high</td></tr>"
71 "<tr><td><b>B</b></td><td>19 - 10</td><td>medium</td></tr>" 72 "<tr><td><b>B</b></td><td>19 - 10</td><td>medium</td></tr>"
72 "<tr><td><b>C</b></td><td>9 - 0</td><td>extremely low</td></tr>" 73 "<tr><td><b>C</b></td><td>9 - 0</td><td>extremely low</td></tr>"
73 "</table>" 74 "</table>"
74 )) 75 ))
75 self.__rankColors = { 76
76 "A": Qt.green, 77 try:
77 "B": Qt.yellow, 78 usesDarkPalette = e5App().usesDarkPalette()
78 "C": Qt.red, 79 except AttributeError:
79 } 80 from PyQt5.QtGui import QPalette
81 palette = e5App().palette()
82 lightness = palette.color(QPalette.Window).lightness()
83 usesDarkPalette = lightness <= 128
84 if usesDarkPalette:
85 self.__rankColors = {
86 "A": QColor("#308030"),
87 "B": QColor("#808030"),
88 "C": QColor("#803030"),
89 }
90 else:
91 self.__rankColors = {
92 "A": QColor("#00ff00"),
93 "B": QColor("#ffff00"),
94 "C": QColor("#ff0000"),
95 }
80 96
81 def __resizeResultColumns(self): 97 def __resizeResultColumns(self):
82 """ 98 """
83 Private method to resize the list columns. 99 Private method to resize the list columns.
84 """ 100 """

eric ide

mercurial