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 |
21 ##from Utilities import toUnicode |
22 |
22 |
23 import Preferences |
23 import Preferences |
24 |
24 |
25 |
25 |
26 class VariableItem(QTreeWidgetItem): |
26 class VariableItem(QTreeWidgetItem): |
513 if self.dvar_rx_array_element.exactMatch(dvar): |
513 if self.dvar_rx_array_element.exactMatch(dvar): |
514 return ArrayElementVarItem(parent, dvar, dvalue, dtype) |
514 return ArrayElementVarItem(parent, dvar, dvalue, dtype) |
515 else: |
515 else: |
516 return VariableItem(parent, dvar, dvalue, dtype) |
516 return VariableItem(parent, dvar, dvalue, dtype) |
517 |
517 |
518 def __unicode(self, s): |
518 ## def __unicode(self, s): |
519 """ |
519 ## """ |
520 Private method to convert a string to unicode. |
520 ## Private method to convert a string to unicode. |
521 |
521 ## |
522 @param s the string to be converted (string) |
522 ## @param s the string to be converted (string) |
523 @return unicode representation of s (unicode object) |
523 ## @return unicode representation of s (unicode object) |
524 """ |
524 ## """ |
525 # TODO: remove me |
525 ## # TODO: remove me |
526 if isinstance(s, type("")): |
526 ## if isinstance(s, type("")): |
527 return s |
527 ## return s |
528 try: |
528 ## try: |
529 u = str(s, self.loc) |
529 ## u = str(s, self.loc) |
530 except TypeError: |
530 ## except TypeError: |
531 u = str(s) |
531 ## u = str(s) |
532 except UnicodeError: |
532 ## except UnicodeError: |
533 u = toUnicode(s) |
533 ## u = toUnicode(s) |
534 return u |
534 ## return u |
535 |
535 ## |
536 def __addItem(self, parent, vtype, var, value): |
536 def __addItem(self, parent, vtype, var, value): |
537 """ |
537 """ |
538 Private method used to add an item to the list. |
538 Private method used to add an item to the list. |
539 |
539 |
540 If the item is of a type with subelements (i.e. list, dictionary, |
540 If the item is of a type with subelements (i.e. list, dictionary, |
566 else: |
566 else: |
567 try: |
567 try: |
568 sval = eval(value) |
568 sval = eval(value) |
569 except: |
569 except: |
570 sval = value |
570 sval = value |
571 itm = self.__generateItem(parent, dvar, self.__unicode(sval), dvtype) |
571 ## itm = self.__generateItem(parent, dvar, self.__unicode(sval), dvtype) |
|
572 itm = self.__generateItem(parent, dvar, str(sval), dvtype) |
572 |
573 |
573 else: |
574 else: |
574 itm = self.__generateItem(parent, dvar, value, dvtype) |
575 itm = self.__generateItem(parent, dvar, value, dvtype) |
575 |
576 |
576 return itm |
577 return itm |