From: greg Date: Thu, 20 Nov 2008 06:51:14 +0000 (+0000) Subject: - Fix bug with relative path when node opened from command line X-Git-Url: http://rtime.felk.cvut.cz/gitweb/CanFestival-3.git/commitdiff_plain/0ac574e186aa6369c40ba104d4492e1a5bded047 - Fix bug with relative path when node opened from command line - Warning dialog when domain mapped variables not initialized --- diff --git a/objdictgen/gen_cfile.py b/objdictgen/gen_cfile.py index e87ccd8..14d88c9 100644 --- a/objdictgen/gen_cfile.py +++ b/objdictgen/gen_cfile.py @@ -67,7 +67,7 @@ def GetValidTypeInfos(typename, items=[]): 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 @@ def GenerateFileContent(Node, headerfilepath, pointers_dict = {}): 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 @@ def GenerateFileContent(Node, headerfilepath, pointers_dict = {}): 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: diff --git a/objdictgen/objdictedit.py b/objdictgen/objdictedit.py index 60cded3..ad8022b 100755 --- a/objdictgen/objdictedit.py +++ b/objdictgen/objdictedit.py @@ -26,7 +26,7 @@ import wx from types import * import os, re, platform, sys, time, traceback, getopt -__version__ = "$Revision: 1.45 $" +__version__ = "$Revision: 1.46 $" from node import OD_Subindex, OD_MultipleSubindexes, OD_IdenticalSubindexes, OD_IdenticalIndexes @@ -297,7 +297,7 @@ class objdictedit(wx.Frame): 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)