Bugs corrected on objdictedit and networkdict
authorgreg
Tue, 29 May 2007 12:02:18 +0200
changeset 206 6787754b251b
parent 205 dac0f9b4e3f8
child 207 b6572d0336c3
Bugs corrected on objdictedit and networkdict
objdictgen/commondialogs.py
objdictgen/eds_utils.py
objdictgen/networkedit.py
objdictgen/objdictedit.py
objdictgen/subindextable.py
--- a/objdictgen/commondialogs.py	Mon May 28 18:08:24 2007 +0200
+++ b/objdictgen/commondialogs.py	Tue May 29 12:02:18 2007 +0200
@@ -792,7 +792,7 @@
 
         self._init_sizers()
 
-    def __init__(self, parent):
+    def __init__(self, parent, cwd):
         self._init_ctrls(parent)
         self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL)
         self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_CENTER)
@@ -803,7 +803,7 @@
         self.Description.SetValue("")
         self.ListProfile = {"None" : ""}
         self.Profile.Append("None")
-        self.Directory = os.path.join(ScriptDirectory, "config")
+        self.Directory = os.path.join(cwd, "config")
         listfiles = os.listdir(self.Directory)
         listfiles.sort()
         for item in listfiles:
--- a/objdictgen/eds_utils.py	Mon May 28 18:08:24 2007 +0200
+++ b/objdictgen/eds_utils.py	Tue May 29 12:02:18 2007 +0200
@@ -48,8 +48,8 @@
 ACCESS_TRANSLATE = {"ro" : "ro", "wo" : "wo", "rw" : "rw", "rwr" : "rw", "rww" : "rw", "const" : "ro"}
 
 # Function for verifying data values
-is_integer = lambda x: type(x) == IntType
-is_string = lambda x: type(x) == StringType
+is_integer = lambda x: type(x) in (IntType, LongType)
+is_string = lambda x: type(x) in (StringType, UnicodeType)
 is_boolean = lambda x: x in (0, 1)
 
 # Define checking of value for each attribute
--- a/objdictgen/networkedit.py	Mon May 28 18:08:24 2007 +0200
+++ b/objdictgen/networkedit.py	Tue May 29 12:02:18 2007 +0200
@@ -435,7 +435,7 @@
         dialog = wxDirDialog(self , "Choose a project", defaultpath, wxDD_NEW_DIR_BUTTON)
         if dialog.ShowModal() == wxID_OK:
             projectpath = dialog.GetPath()
-            if os.path.isdir(projectpath) and len(os.path.listdir(projectpath)) == 0:
+            if os.path.isdir(projectpath) and len(os.listdir(projectpath)) == 0:
                 manager = NodeManager(ScriptDirectory)
                 nodelist = NodeList(manager)
                 result = nodelist.LoadProject(projectpath)
--- a/objdictgen/objdictedit.py	Mon May 28 18:08:24 2007 +0200
+++ b/objdictgen/objdictedit.py	Tue May 29 12:02:18 2007 +0200
@@ -31,6 +31,8 @@
 
 __version__ = "$Revision$"
 
+from node import OD_Subindex, OD_MultipleSubindexes, OD_IdenticalSubindexes, OD_IdenticalIndexes
+
 from nodemanager import *
 from subindextable import *
 from commondialogs import *
@@ -596,7 +598,7 @@
 
     def OnNewMenu(self, event):
         self.FilePath = ""
-        dialog = CreateNodeDialog(self)
+        dialog = CreateNodeDialog(self, ScriptDirectory)
         if dialog.ShowModal() == wxID_OK:
             name, id, nodetype, description = dialog.GetValues()
             profile, filepath = dialog.GetProfile()
--- a/objdictgen/subindextable.py	Mon May 28 18:08:24 2007 +0200
+++ b/objdictgen/subindextable.py	Tue May 29 12:02:18 2007 +0200
@@ -28,6 +28,7 @@
 
 from types import *
 
+from node import OD_Subindex, OD_MultipleSubindexes, OD_IdenticalSubindexes, OD_IdenticalIndexes
 
 ColSizes = [75, 250, 150, 125, 100, 60, 250]
 ColAlignements = [wxALIGN_CENTER, wxALIGN_LEFT, wxALIGN_CENTER, wxALIGN_RIGHT, wxALIGN_CENTER, wxALIGN_CENTER, wxALIGN_LEFT]