Fix bug with utf-8 string value in VariablePanel
authorlaurent
Mon, 24 Oct 2011 02:00:34 +0200
changeset 580 ad996deb920e
parent 579 bc333e073aa3
child 581 c2d96ea9c14a
Fix bug with utf-8 string value in VariablePanel
VariablePanel.py
--- a/VariablePanel.py	Thu Oct 20 00:05:38 2011 +0200
+++ b/VariablePanel.py	Mon Oct 24 02:00:34 2011 +0200
@@ -25,7 +25,7 @@
 import os
 import wx, wx.grid
 
-from types import TupleType
+from types import TupleType, StringType, UnicodeType
 
 from plcopen.structures import LOCATIONDATATYPES, TestIdentifier, IEC_KEYWORDS
 from PLCControler import LOCATION_PLUGIN, LOCATION_MODULE, LOCATION_GROUP, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY
@@ -129,7 +129,8 @@
             if colname == "Type" and isinstance(value, TupleType):
                 if value[0] == "array":
                     return "ARRAY [%s] OF %s" % (",".join(map(lambda x : "..".join(x), value[2])), value[1])
-            value = str(value)
+            if not isinstance(value, (StringType, UnicodeType)):
+                value = str(value)
             if colname in ["Class", "Option"]:
                 return _(value)
             return value