16 |
16 |
17 from E4Gui.E4Application import e4App |
17 from E4Gui.E4Application import e4App |
18 |
18 |
19 from .Config import ConfigVarTypeDispStrings, ConfigVarTypeStrings |
19 from .Config import ConfigVarTypeDispStrings, ConfigVarTypeStrings |
20 from .VariableDetailDialog import VariableDetailDialog |
20 from .VariableDetailDialog import VariableDetailDialog |
21 ##from Utilities import toUnicode |
|
22 |
21 |
23 import Preferences |
22 import Preferences |
24 |
23 |
25 |
24 |
26 class VariableItem(QTreeWidgetItem): |
25 class VariableItem(QTreeWidgetItem): |
513 if self.dvar_rx_array_element.exactMatch(dvar): |
512 if self.dvar_rx_array_element.exactMatch(dvar): |
514 return ArrayElementVarItem(parent, dvar, dvalue, dtype) |
513 return ArrayElementVarItem(parent, dvar, dvalue, dtype) |
515 else: |
514 else: |
516 return VariableItem(parent, dvar, dvalue, dtype) |
515 return VariableItem(parent, dvar, dvalue, dtype) |
517 |
516 |
518 ## def __unicode(self, s): |
|
519 ## """ |
|
520 ## Private method to convert a string to unicode. |
|
521 ## |
|
522 ## @param s the string to be converted (string) |
|
523 ## @return unicode representation of s (unicode object) |
|
524 ## """ |
|
525 ## if isinstance(s, type("")): |
|
526 ## return s |
|
527 ## try: |
|
528 ## u = str(s, self.loc) |
|
529 ## except TypeError: |
|
530 ## u = str(s) |
|
531 ## except UnicodeError: |
|
532 ## u = toUnicode(s) |
|
533 ## return u |
|
534 ## |
|
535 def __addItem(self, parent, vtype, var, value): |
517 def __addItem(self, parent, vtype, var, value): |
536 """ |
518 """ |
537 Private method used to add an item to the list. |
519 Private method used to add an item to the list. |
538 |
520 |
539 If the item is of a type with subelements (i.e. list, dictionary, |
521 If the item is of a type with subelements (i.e. list, dictionary, |
565 else: |
547 else: |
566 try: |
548 try: |
567 sval = eval(value) |
549 sval = eval(value) |
568 except: |
550 except: |
569 sval = value |
551 sval = value |
570 ## itm = self.__generateItem(parent, dvar, self.__unicode(sval), dvtype) |
|
571 itm = self.__generateItem(parent, dvar, str(sval), dvtype) |
552 itm = self.__generateItem(parent, dvar, str(sval), dvtype) |
572 |
553 |
573 else: |
554 else: |
574 itm = self.__generateItem(parent, dvar, value, dvtype) |
555 itm = self.__generateItem(parent, dvar, value, dvtype) |
575 |
556 |