4 # |
4 # |
5 |
5 |
6 """ |
6 """ |
7 Module implementing the variables viewer widget. |
7 Module implementing the variables viewer widget. |
8 """ |
8 """ |
|
9 |
|
10 from __future__ import unicode_literals # __IGNORE_WARNING__ |
9 |
11 |
10 from PyQt4.QtCore import Qt, QRegExp, qVersion |
12 from PyQt4.QtCore import Qt, QRegExp, qVersion |
11 from PyQt4.QtGui import QTreeWidget, QTreeWidgetItem, QApplication, QAbstractItemView, \ |
13 from PyQt4.QtGui import QTreeWidget, QTreeWidgetItem, QApplication, QAbstractItemView, \ |
12 QMenu |
14 QMenu |
13 from PyQt4.QtGui import QTextDocument # __IGNORE_WARNING__ |
15 from PyQt4.QtGui import QTextDocument # __IGNORE_WARNING__ |
83 @param role data role (Qt.ItemDataRole) |
85 @param role data role (Qt.ItemDataRole) |
84 @return requested data |
86 @return requested data |
85 """ |
87 """ |
86 if column == 1 and role == Qt.ToolTipRole: |
88 if column == 1 and role == Qt.ToolTipRole: |
87 return self.__tooltip |
89 return self.__tooltip |
88 return super().data(column, role) |
90 return super(VariableItem, self).data(column, role) |
89 |
91 |
90 def attachDummy(self): |
92 def attachDummy(self): |
91 """ |
93 """ |
92 Public method to attach a dummy sub item to allow for lazy population. |
94 Public method to attach a dummy sub item to allow for lazy population. |
93 """ |
95 """ |
275 Constructor |
277 Constructor |
276 |
278 |
277 @param parent the parent (QWidget) |
279 @param parent the parent (QWidget) |
278 @param scope flag indicating global (1) or local (0) variables |
280 @param scope flag indicating global (1) or local (0) variables |
279 """ |
281 """ |
280 super().__init__(parent) |
282 super(VariablesViewer, self).__init__(parent) |
281 |
283 |
282 self.indicators = {'list': '[]', 'tuple': '()', 'dict': '{}', # Python types |
284 self.indicators = {'list': '[]', 'tuple': '()', 'dict': '{}', # Python types |
283 'Array': '[]', 'Hash': '{}'} # Ruby types |
285 'Array': '[]', 'Hash': '{}'} # Ruby types |
284 |
286 |
285 self.rx_class = QRegExp('<.*(instance|object) at 0x.*>') |
287 self.rx_class = QRegExp('<.*(instance|object) at 0x.*>') |
712 self.openItems.remove(pathlist) |
714 self.openItems.remove(pathlist) |
713 |
715 |
714 try: |
716 try: |
715 parentItem.collapse() |
717 parentItem.collapse() |
716 except AttributeError: |
718 except AttributeError: |
717 super().collapseItem(parentItem) |
719 super(VariablesViewer, self).collapseItem(parentItem) |
718 |
720 |
719 def __resort(self): |
721 def __resort(self): |
720 """ |
722 """ |
721 Private method to resort the tree. |
723 Private method to resort the tree. |
722 """ |
724 """ |