48 # Initialize regular expression for unprintable strings |
48 # Initialize regular expression for unprintable strings |
49 rx_nonprintable = QRegExp(r"""(\\x\d\d)+""") |
49 rx_nonprintable = QRegExp(r"""(\\x\d\d)+""") |
50 |
50 |
51 noOfItemsStr = QCoreApplication.translate("VariablesViewer", "{0} items") |
51 noOfItemsStr = QCoreApplication.translate("VariablesViewer", "{0} items") |
52 |
52 |
53 arrayTypes = {'list', 'tuple', 'dict', 'set', 'frozenset', |
53 arrayTypes = { |
54 'numpy.ndarray', 'django.MultiValueDict', 'array.array', |
54 'list', 'tuple', 'dict', 'set', 'frozenset', 'numpy.ndarray', |
55 'collections.defaultdict', "class 'dict_items'", |
55 'django.MultiValueDict', 'array.array', 'collections.defaultdict', |
56 "class 'dict_keys'", "class 'dict_values'"} |
56 "class 'dict_items'", "class 'dict_keys'", "class 'dict_values'", |
|
57 } |
|
58 |
|
59 nonExpandableTypes = ( |
|
60 'method_descriptor', 'wrapper_descriptor', '', 'getset_descriptor', |
|
61 'method-wrapper', 'member_descriptor', |
|
62 ) |
57 |
63 |
58 def __init__(self, parent, dvar, dtype, dvalue): |
64 def __init__(self, parent, dvar, dtype, dvalue): |
59 """ |
65 """ |
60 Constructor |
66 Constructor |
61 |
67 |
133 @type str |
139 @type str |
134 """ |
140 """ |
135 # Python class? |
141 # Python class? |
136 if dtype.startswith('class '): |
142 if dtype.startswith('class '): |
137 dtype = dtype[7:-1] |
143 dtype = dtype[7:-1] |
138 if dtype not in ('method_descriptor', 'wrapper_descriptor'): |
|
139 self.hasChilds = True |
|
140 # Qt related stuff? |
144 # Qt related stuff? |
141 elif (dtype.startswith(ConfigQtNames) and |
145 elif (dtype.startswith(ConfigQtNames) and |
142 dtype.endswith(ConfigKnownQtTypes)): |
146 dtype.endswith(ConfigKnownQtTypes)): |
143 self.hasChilds = True |
147 self.hasChilds = True |
144 |
148 |
145 elif dtype in ('instance', 'class'): |
149 elif dtype in ('instance', 'class'): |
146 self.hasChilds = True |
150 self.hasChilds = True |
147 |
151 |
148 vtype = ConfigVarTypeDispStrings.get(dtype, dtype) |
152 vtype = ConfigVarTypeDispStrings.get(dtype, dtype) |
149 # Unkown types should be expandable by default |
153 # Unkown types should be expandable by default |
150 if (vtype is dtype and |
154 if vtype is dtype and dtype not in self.nonExpandableTypes: |
151 dtype not in ('method_descriptor', 'wrapper_descriptor')): |
|
152 self.hasChilds = True |
155 self.hasChilds = True |
153 self.type = QCoreApplication.translate("VariablesViewer", vtype) |
156 self.type = QCoreApplication.translate("VariablesViewer", vtype) |
154 |
157 |
155 def __getValue(self, dtype, dvalue): |
158 def __getValue(self, dtype, dvalue): |
156 """ |
159 """ |