eric6/Debugger/VariablesViewer.py

changeset 7332
49076c600903
parent 7251
bc5b1b00560a
child 7360
9190402e4505
equal deleted inserted replaced
7331:1fb70d1f8a39 7332:49076c600903
42 42
43 # Initialize regular expression for unprintable strings 43 # Initialize regular expression for unprintable strings
44 rx_nonprintable = QRegExp(r"""(\\x\d\d)+""") 44 rx_nonprintable = QRegExp(r"""(\\x\d\d)+""")
45 45
46 noOfItemsStr = QCoreApplication.translate("VariablesViewer", "{0} items") 46 noOfItemsStr = QCoreApplication.translate("VariablesViewer", "{0} items")
47 unsized = QCoreApplication.translate("VariablesViewer", "unsized")
47 48
48 arrayTypes = { 49 arrayTypes = {
49 'list', 'tuple', 'dict', 'set', 'frozenset', 'numpy.ndarray', 50 'list', 'tuple', 'dict', 'set', 'frozenset', 'numpy.ndarray',
50 'django.MultiValueDict', 'array.array', 'collections.defaultdict', 51 'django.MultiValueDict', 'array.array', 'collections.defaultdict',
51 "class 'dict_items'", "class 'dict_keys'", "class 'dict_values'", 52 "class 'dict_items'", "class 'dict_keys'", "class 'dict_values'",
176 self.indicator = '[<{0}>]'.format(typecode) 177 self.indicator = '[<{0}>]'.format(typecode)
177 else: 178 else:
178 self.indicator = VariableItem.Type2Indicators.get(dtype, '') 179 self.indicator = VariableItem.Type2Indicators.get(dtype, '')
179 180
180 if dtype == 'numpy.ndarray': 181 if dtype == 'numpy.ndarray':
181 self.childCount = int(dvalue.split('x')[0]) 182 if dvalue:
182 dvalue = VariableItem.noOfItemsStr.format(dvalue) 183 self.childCount = int(dvalue.split('x')[0])
184 dvalue = VariableItem.noOfItemsStr.format(dvalue)
185 else:
186 dvalue = VariableItem.unsized
183 self.hasChildren = True 187 self.hasChildren = True
184 elif dtype in VariableItem.arrayTypes: 188 elif dtype in VariableItem.arrayTypes:
185 self.childCount = int(dvalue) 189 self.childCount = int(dvalue)
186 dvalue = VariableItem.noOfItemsStr.format(dvalue) 190 dvalue = VariableItem.noOfItemsStr.format(dvalue)
187 self.hasChildren = True 191 self.hasChildren = True

eric ide

mercurial