21 ) |
21 ) |
22 from PyQt6.QtGui import QBrush, QFontMetrics |
22 from PyQt6.QtGui import QBrush, QFontMetrics |
23 from PyQt6.QtWidgets import QAbstractItemView, QMenu, QToolTip, QTreeView |
23 from PyQt6.QtWidgets import QAbstractItemView, QMenu, QToolTip, QTreeView |
24 |
24 |
25 from eric7 import Preferences, Utilities |
25 from eric7 import Preferences, Utilities |
|
26 from eric7.DebugClients.Python.DebugConfig import UnknownAttributeValueMarker |
26 from eric7.EricWidgets.EricApplication import ericApp |
27 from eric7.EricWidgets.EricApplication import ericApp |
27 |
28 |
28 from .Config import ConfigVarTypeDispStrings |
29 from .Config import ConfigVarTypeDispStrings |
29 |
30 |
30 SORT_ROLE = Qt.ItemDataRole.UserRole |
31 SORT_ROLE = Qt.ItemDataRole.UserRole |
162 return |
163 return |
163 |
164 |
164 if VariableItem.rx_nonprintable.search(dvalue) is None: |
165 if VariableItem.rx_nonprintable.search(dvalue) is None: |
165 with contextlib.suppress(Exception): # secok |
166 with contextlib.suppress(Exception): # secok |
166 dvalue = ast.literal_eval(dvalue) |
167 dvalue = ast.literal_eval(dvalue) |
|
168 |
|
169 if dvalue.startswith(UnknownAttributeValueMarker): |
|
170 self.value = QCoreApplication.translate( |
|
171 "VariablesViewer", "[unknown attribute value]" |
|
172 ) |
|
173 self.valueShort = self.value |
|
174 self.tooltip = QCoreApplication.translate( |
|
175 "VariablesViewer", |
|
176 "The attribute value could not be determined.\nReason: {0}", |
|
177 ).format(dvalue.replace(UnknownAttributeValueMarker, "")) |
|
178 return |
167 |
179 |
168 dvalue = str(dvalue) |
180 dvalue = str(dvalue) |
169 self.value = dvalue |
181 self.value = dvalue |
170 |
182 |
171 if len(dvalue) > 2048: # 2 kB |
183 if len(dvalue) > 2048: # 2 kB |