Bug on DCF edition fixed
authorlbessard
Mon, 10 Dec 2007 16:25:18 +0100
changeset 336 42ab55532da8
parent 335 6052c980c3af
child 337 9aab477d8a8a
Bug on DCF edition fixed
objdictgen/networkedit.py
objdictgen/subindextable.py
--- a/objdictgen/networkedit.py	Mon Dec 10 16:08:58 2007 +0100
+++ b/objdictgen/networkedit.py	Mon Dec 10 16:25:18 2007 +0100
@@ -858,7 +858,7 @@
 
     def OpenMasterDCFDialog(self, node_id):
         self.NetworkNodes.SetSelection(0)
-        self.NetworkNodes.GetPage(0).OpenDCFDIalog(node_id)
+        self.NetworkNodes.GetPage(0).OpenDCFDialog(node_id)
 
 #-------------------------------------------------------------------------------
 #                               Exception Handler
--- a/objdictgen/subindextable.py	Mon Dec 10 16:08:58 2007 +0100
+++ b/objdictgen/subindextable.py	Mon Dec 10 16:25:18 2007 +0100
@@ -713,10 +713,21 @@
                     typeinfos = self.Manager.GetEntryInfos(subentry_infos["type"])
                     if typeinfos:
                         node_id = self.ParentWindow.GetCurrentNodeId()
-                        self.Manager.AddToMasterDCF(node_id, index, subindex, max(1, typeinfos["size"] / 8), int(self.Table.GetValueByName(subindex, "value"), 16))    
+                        value = self.Table.GetValueByName(subindex, "value")
+                        if value == "True":
+                            value = 0
+                        elif value == "False":
+                            value = 1
+                        elif value.isdigit():
+                            value = int(value)
+                        elif value.startswith("0x"):
+                            value = int(value, 16)
+                        else:
+                            value = int(value.encode("hex_codec"), 16)
+                        self.Manager.AddToMasterDCF(node_id, index, subindex, max(1, typeinfos["size"] / 8), value)    
                         self.ParentWindow.OpenMasterDCFDialog(node_id)
 
-    def OpenDCFDIalog(self, node_id):
+    def OpenDCFDialog(self, node_id):
         self.PartList.SetSelection(7)
         self.RefreshIndexList()
         self.IndexList.SetSelection(self.ListIndex.index(0x1F22))