- Fix bug with relative path when node opened from command line
authorgreg
Thu, 20 Nov 2008 07:51:14 +0100
changeset 527 7d5c74cc8f91
parent 526 1607d4afce20
child 528 0a30e161d63c
- Fix bug with relative path when node opened from command line
- Warning dialog when domain mapped variables not initialized
objdictgen/gen_cfile.py
objdictgen/objdictedit.py
--- a/objdictgen/gen_cfile.py	Wed Nov 19 12:32:06 2008 +0100
+++ b/objdictgen/gen_cfile.py	Thu Nov 20 07:51:14 2008 +0100
@@ -67,7 +67,7 @@
                     size = max(size, int(values[1]))
                 typeinfos = ("UNS8", size, "visible_string", False)
             elif values[0] == "DOMAIN":
-                size = default_string_size
+                size = 0
                 for item in items:
                     size = max(size, len(item))
                 typeinfos = ("UNS8", size, "domain", False)
@@ -188,6 +188,9 @@
             subentry_infos = Node.GetSubentryInfos(index, 0)
             typename = Node.GetTypeName(subentry_infos["type"])
             typeinfos = GetValidTypeInfos(typename, [values])
+            if typename is "DOMAIN" and index in variablelist:
+                if not typeinfos[1]:
+                    raise ValueError("\nDomain variable not initialized\nindex : 0x%04X\nsubindex 0x00"%index)
             texts["subIndexType"] = typeinfos[0]
             if typeinfos[1] is not None:
                 texts["suffixe"] = "[%d]"%typeinfos[1]
@@ -235,6 +238,8 @@
                             if subIndex == len(values)-1:
                                 sep = ""
                             value, comment = ComputeValue(typeinfos[2], value)
+                            if len(value) is 2 and typename is "DOMAIN":
+                                raise ValueError("\nDomain variable not initialized\nindex : 0x%04X\nsubindex 0x%02X"%(index, subIndex))
                             mappedVariableContent += "    %s%s%s\n"%(value, sep, comment)
                     mappedVariableContent += "  };\n"
                 else:
--- a/objdictgen/objdictedit.py	Wed Nov 19 12:32:06 2008 +0100
+++ b/objdictgen/objdictedit.py	Thu Nov 20 07:51:14 2008 +0100
@@ -297,7 +297,7 @@
         if self.ModeSolo:
             self.Manager = NodeManager()
             for filepath in filesOpen:
-                result = self.Manager.OpenFileInCurrent(filepath)
+                result = self.Manager.OpenFileInCurrent(os.path.abspath(filepath))
                 if isinstance(result, (IntType, LongType)):
                     new_editingpanel = EditingPanel(self.FileOpened, self, self.Manager)
                     new_editingpanel.SetIndex(result)