13 import sys |
13 import sys |
14 |
14 |
15 sys.path.insert(0, os.path.dirname(__file__)) |
15 sys.path.insert(0, os.path.dirname(__file__)) |
16 |
16 |
17 from PyQt5.QtCore import pyqtSlot, qVersion, Qt, QTimer, QLocale |
17 from PyQt5.QtCore import pyqtSlot, qVersion, Qt, QTimer, QLocale |
|
18 from PyQt5.QtGui import QColor |
18 from PyQt5.QtWidgets import ( |
19 from PyQt5.QtWidgets import ( |
19 QDialog, QDialogButtonBox, QAbstractButton, QHeaderView, QTreeWidgetItem, |
20 QDialog, QDialogButtonBox, QAbstractButton, QHeaderView, QTreeWidgetItem, |
20 QApplication, QMenu |
21 QApplication, QMenu |
21 ) |
22 ) |
22 |
23 |
104 self.__mappedType = { |
105 self.__mappedType = { |
105 "class": "C", |
106 "class": "C", |
106 "function": "F", |
107 "function": "F", |
107 "method": "M", |
108 "method": "M", |
108 } |
109 } |
109 self.__typeColors = { |
110 |
110 "class": Qt.blue, |
111 try: |
111 "function": Qt.darkCyan, |
112 usesDarkPalette = e5App().usesDarkPalette() |
112 "method": Qt.magenta, |
113 except AttributeError: |
113 } |
114 from PyQt5.QtGui import QPalette |
114 self.__rankColors = { |
115 palette = e5App().palette() |
115 "A": Qt.green, |
116 lightness = palette.color(QPalette.Window).lightness() |
116 "B": Qt.green, |
117 usesDarkPalette = lightness <= 128 |
117 "C": Qt.yellow, |
118 if usesDarkPalette: |
118 "D": Qt.yellow, |
119 self.__typeColors = { |
119 "E": Qt.red, |
120 "class": QColor("#ffe480"), |
120 "F": Qt.red, |
121 "function": QColor("#99ffff"), |
121 } |
122 "method": QColor("#ff99ff"), |
|
123 } |
|
124 self.__rankColors = { |
|
125 "A": QColor("#308030"), |
|
126 "B": QColor("#308030"), |
|
127 "C": QColor("#808030"), |
|
128 "D": QColor("#808030"), |
|
129 "E": QColor("#803030"), |
|
130 "F": QColor("#803030"), |
|
131 } |
|
132 else: |
|
133 self.__typeColors = { |
|
134 "class": QColor("#0000ff"), |
|
135 "function": QColor("#008080"), |
|
136 "method": QColor("#ff00ff"), |
|
137 } |
|
138 self.__rankColors = { |
|
139 "A": QColor("#00ff00"), |
|
140 "B": QColor("#00ff00"), |
|
141 "C": QColor("#ffff00"), |
|
142 "D": QColor("#ffff00"), |
|
143 "E": QColor("#ff0000"), |
|
144 "F": QColor("#ff0000"), |
|
145 } |
122 |
146 |
123 self.__menu = QMenu(self) |
147 self.__menu = QMenu(self) |
124 self.__menu.addAction(self.tr("Collapse all"), |
148 self.__menu.addAction(self.tr("Collapse all"), |
125 self.__resultCollapse) |
149 self.__resultCollapse) |
126 self.__menu.addAction(self.tr("Expand all"), self.__resultExpand) |
150 self.__menu.addAction(self.tr("Expand all"), self.__resultExpand) |