Adding program for network management
authorlbessard
Mon, 28 May 2007 18:08:24 +0200
changeset 205 dac0f9b4e3f8
parent 204 44ce74232ccb
child 206 6787754b251b
Adding program for network management
Improving objdictedit for handling bug on Notebook in wxPython 2.6.3.3
objdictgen/.cvsignore
objdictgen/commondialogs.py
objdictgen/eds_utils.py
objdictgen/networkedit.py
objdictgen/node.py
objdictgen/nodelist.py
objdictgen/nodemanager.py
objdictgen/objdictedit.py
objdictgen/subindextable.py
--- a/objdictgen/.cvsignore	Fri May 25 23:57:17 2007 +0200
+++ b/objdictgen/.cvsignore	Mon May 28 18:08:24 2007 +0200
@@ -5,4 +5,5 @@
 *.od
 *.pyc
 *.c
-*.h
\ No newline at end of file
+*.h
+*.eds
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/objdictgen/commondialogs.py	Mon May 28 18:08:24 2007 +0200
@@ -0,0 +1,1051 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+#This file is part of CanFestival, a library implementing CanOpen Stack. 
+#
+#Copyright (C): Edouard TISSERANT, Francis DUPIN and Laurent BESSARD
+#
+#See COPYING file for copyrights details.
+#
+#This library is free software; you can redistribute it and/or
+#modify it under the terms of the GNU Lesser General Public
+#License as published by the Free Software Foundation; either
+#version 2.1 of the License, or (at your option) any later version.
+#
+#This library is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#Lesser General Public License for more details.
+#
+#You should have received a copy of the GNU Lesser General Public
+#License along with this library; if not, write to the Free Software
+#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+from wxPython.wx import *
+from wxPython.grid import *
+import wx
+
+import os
+
+#-------------------------------------------------------------------------------
+#                          Editing Communication Dialog
+#-------------------------------------------------------------------------------
+
+
+[wxID_COMMUNICATIONDIALOG, wxID_COMMUNICATIONDIALOGMAINPANEL,
+ wxID_COMMUNICATIONDIALOGPOSSIBLEINDEXES, wxID_COMMUNICATIONDIALOGCURRENTINDEXES,
+ wxID_COMMUNICATIONDIALOGSELECT, wxID_COMMUNICATIONDIALOGUNSELECT, 
+ wxID_COMMUNICATIONDIALOGSTATICTEXT1, wxID_COMMUNICATIONDIALOGSTATICTEXT2
+] = [wx.NewId() for _init_ctrls in range(8)]
+
+class CommunicationDialog(wx.Dialog):
+    def _init_coll_flexGridSizer1_Items(self, parent):
+        # generated method, don't edit
+
+        parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
+
+    def _init_sizers(self):
+        # generated method, don't edit
+        self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
+
+        self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
+
+        self.SetSizer(self.flexGridSizer1)
+
+    def _init_ctrls(self, prnt):
+        # generated method, don't edit
+        wx.Dialog.__init__(self, id=wxID_COMMUNICATIONDIALOG,
+              name='CommunicationDialog', parent=prnt, pos=wx.Point(234, 216),
+              size=wx.Size(726, 437), style=wx.DEFAULT_DIALOG_STYLE,
+              title='Edit Communication Profile')
+        self.SetClientSize(wx.Size(726, 437))
+
+        self.MainPanel = wx.Panel(id=wxID_COMMUNICATIONDIALOGMAINPANEL,
+              name='MainPanel', parent=self, pos=wx.Point(0, 0),
+              size=wx.Size(688, 382), style=wx.TAB_TRAVERSAL)
+        self.MainPanel.SetAutoLayout(True)
+
+        self.PossibleIndexes = wx.ListBox(choices=[],
+              id=wxID_COMMUNICATIONDIALOGPOSSIBLEINDEXES,
+              name='PossibleIndexes', parent=self.MainPanel, pos=wx.Point(40,
+              48), size=wx.Size(280, 320), style=wxLB_EXTENDED)
+        self.PossibleIndexes.Bind(wx.EVT_LEFT_DCLICK, self.OnPossibleIndexesDClick,
+              id=wxID_COMMUNICATIONDIALOGPOSSIBLEINDEXES)
+
+        self.CurrentIndexes = wx.ListBox(choices=[],
+              id=wxID_COMMUNICATIONDIALOGCURRENTINDEXES, name='CurrentIndexes',
+              parent=self.MainPanel, pos=wx.Point(400, 48), size=wx.Size(280,
+              320), style=wxLB_EXTENDED)
+        self.CurrentIndexes.Bind(wx.EVT_LEFT_DCLICK, self.OnCurrentIndexesDClick,
+              id=wxID_COMMUNICATIONDIALOGCURRENTINDEXES)
+
+        self.Select = wx.Button(id=wxID_COMMUNICATIONDIALOGSELECT, label='>>',
+              name='Select', parent=self.MainPanel, pos=wx.Point(345, 136),
+              size=wx.Size(32, 32), style=0)
+        self.Select.Bind(wx.EVT_BUTTON, self.OnSelectButton,
+              id=wxID_COMMUNICATIONDIALOGSELECT)
+
+        self.Unselect = wx.Button(id=wxID_COMMUNICATIONDIALOGUNSELECT,
+              label='<<', name='Unselect', parent=self.MainPanel,
+              pos=wx.Point(345, 216), size=wx.Size(32, 30), style=0)
+        self.Unselect.Bind(wx.EVT_BUTTON, self.OnUnselectButton,
+              id=wxID_COMMUNICATIONDIALOGUNSELECT)
+
+        self.staticText1 = wx.StaticText(id=wxID_COMMUNICATIONDIALOGSTATICTEXT1,
+              label='Possible Profile Indexes:', name='staticText1',
+              parent=self.MainPanel, pos=wx.Point(40, 24), size=wx.Size(156,
+              17), style=0)
+
+        self.staticText2 = wx.StaticText(id=wxID_COMMUNICATIONDIALOGSTATICTEXT2,
+              label='Current Profile Indexes:', name='staticText2',
+              parent=self.MainPanel, pos=wx.Point(400, 24), size=wx.Size(152,
+              17), style=0)
+
+        self._init_sizers()
+
+    def __init__(self, parent):
+        self._init_ctrls(parent)
+        self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL)
+        self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_CENTER)
+        self.AllList = []
+        self.CurrentList = []
+        self.IndexDictionary = {}
+
+    def SetIndexDictionary(self, dictionary):
+        self.IndexDictionary = dictionary
+        
+    def SetCurrentList(self, list):
+        self.CurrentList = []
+        self.CurrentList.extend(list)
+        self.CurrentList.sort()
+        
+    def GetCurrentList(self):
+        return self.CurrentList
+        
+    def RefreshLists(self):
+        self.PossibleIndexes.Clear()
+        self.CurrentIndexes.Clear()
+        self.AllList = []
+        for index in self.IndexDictionary.iterkeys():
+            if index not in self.CurrentList:
+                self.AllList.append(index)
+        self.AllList.sort()
+        for index in self.AllList:
+            self.PossibleIndexes.Append("0x%04X   %s"%(index, self.IndexDictionary[index][0]))
+        for index in self.CurrentList:
+            if index in self.IndexDictionary:
+                self.CurrentIndexes.Append("0x%04X   %s"%(index, self.IndexDictionary[index][0]))
+
+    def OnPossibleIndexesDClick(self, event):
+        self.SelectPossible()
+        event.Skip()
+
+    def OnCurrentIndexesDClick(self, event):
+        self.UnselectCurrent()
+        event.Skip()
+
+    def OnSelectButton(self, event):
+        self.SelectPossible()
+        event.Skip()
+
+    def OnUnselectButton(self, event):
+        self.UnselectCurrent()
+        event.Skip()
+
+    def SelectPossible(self):
+        selected = self.PossibleIndexes.GetSelections()
+        for i in selected:
+            self.CurrentList.append(self.AllList[i])
+        self.CurrentList.sort()
+        self.RefreshLists()
+
+    def UnselectCurrent(self):
+        selected = self.CurrentIndexes.GetSelections()
+        for i in selected:
+            if not self.IndexDictionary[self.CurrentList[i]][1]:
+                self.CurrentList.pop(i)
+        self.CurrentList.sort()
+        self.RefreshLists()
+
+
+
+#-------------------------------------------------------------------------------
+#                          Create Map Variable Dialog
+#-------------------------------------------------------------------------------
+
+
+[wxID_MAPVARIABLEDIALOG, wxID_MAPVARIABLEDIALOGINDEX, 
+ wxID_MAPVARIABLEDIALOGINDEXNAME, wxID_MAPVARIABLEDIALOGMAINPANEL, 
+ wxID_MAPVARIABLEDIALOGNUMBER, wxID_MAPVARIABLEDIALOGRADIOBUTTON1, 
+ wxID_MAPVARIABLEDIALOGRADIOBUTTON2, wxID_MAPVARIABLEDIALOGRADIOBUTTON3, 
+ wxID_MAPVARIABLEDIALOGSTATICTEXT1, wxID_MAPVARIABLEDIALOGSTATICTEXT2, 
+ wxID_MAPVARIABLEDIALOGSTATICTEXT3, wxID_MAPVARIABLEDIALOGSTATICTEXT4, 
+] = [wx.NewId() for _init_ctrls in range(12)]
+
+class MapVariableDialog(wx.Dialog):
+    def _init_coll_flexGridSizer1_Items(self, parent):
+        # generated method, don't edit
+
+        parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
+
+    def _init_sizers(self):
+        # generated method, don't edit
+        self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
+
+        self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
+
+        self.SetSizer(self.flexGridSizer1)
+
+    def _init_ctrls(self, prnt):
+        # generated method, don't edit
+        wx.Dialog.__init__(self, id=wxID_MAPVARIABLEDIALOG,
+              name='CommunicationDialog', parent=prnt, pos=wx.Point(376, 223),
+              size=wx.Size(444, 186), style=wx.DEFAULT_DIALOG_STYLE,
+              title='Add Map Variable')
+        self.SetClientSize(wx.Size(444, 186))
+
+        self.MainPanel = wx.Panel(id=wxID_MAPVARIABLEDIALOGMAINPANEL,
+              name='MainPanel', parent=self, pos=wx.Point(0, 0),
+              size=wx.Size(431, 142), style=wx.TAB_TRAVERSAL)
+        self.MainPanel.SetAutoLayout(True)
+
+        self.staticText1 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT1,
+              label='Index:', name='staticText1', parent=self.MainPanel,
+              pos=wx.Point(24, 24), size=wx.Size(156, 17), style=0)
+
+        self.Index = wx.TextCtrl(id=wxID_MAPVARIABLEDIALOGINDEX, name='Index',
+              parent=self.MainPanel, pos=wx.Point(24, 48), size=wx.Size(152,
+              25), style=0, value='0x2000')
+
+        self.staticText3 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT3,
+              label='Name:', name='staticText3', parent=self.MainPanel,
+              pos=wx.Point(24, 80), size=wx.Size(47, 17), style=0)
+
+        self.IndexName = wx.TextCtrl(id=wxID_MAPVARIABLEDIALOGINDEXNAME,
+              name='IndexName', parent=self.MainPanel, pos=wx.Point(24, 104),
+              size=wx.Size(152, 24), style=0, value='Undefined')
+
+        self.staticText2 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT2,
+              label='Type:', name='staticText2', parent=self.MainPanel,
+              pos=wx.Point(208, 24), size=wx.Size(38, 17), style=0)
+
+        self.radioButton1 = wx.RadioButton(id=wxID_MAPVARIABLEDIALOGRADIOBUTTON1,
+              label='VAR', name='radioButton1', parent=self.MainPanel,
+              pos=wx.Point(208, 48), size=wx.Size(72, 24), style=wxRB_GROUP)
+        self.radioButton1.SetValue(True)
+        self.radioButton1.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton1Click,
+              id=wxID_MAPVARIABLEDIALOGRADIOBUTTON1)
+
+        self.radioButton2 = wx.RadioButton(id=wxID_MAPVARIABLEDIALOGRADIOBUTTON2,
+              label='ARRAY', name='radioButton2', parent=self.MainPanel,
+              pos=wx.Point(208, 72), size=wx.Size(80, 24), style=wxRB_SINGLE)
+        self.radioButton2.SetValue(False)
+        self.radioButton2.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton2Click,
+              id=wxID_MAPVARIABLEDIALOGRADIOBUTTON2)
+
+        self.radioButton3 = wx.RadioButton(id=wxID_MAPVARIABLEDIALOGRADIOBUTTON3,
+              label='REC', name='radioButton3', parent=self.MainPanel,
+              pos=wx.Point(208, 96), size=wx.Size(96, 24), style=wxRB_SINGLE)
+        self.radioButton3.SetValue(False)
+        self.radioButton3.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton3Click,
+              id=wxID_MAPVARIABLEDIALOGRADIOBUTTON3)
+
+        self.staticText4 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT4,
+              label='Number:', name='staticText4', parent=self.MainPanel,
+              pos=wx.Point(312, 80), size=wx.Size(88, 16), style=0)
+
+        self.Number = wx.TextCtrl(id=wxID_MAPVARIABLEDIALOGNUMBER,
+              name='Number', parent=self.MainPanel, pos=wx.Point(312, 104),
+              size=wx.Size(112, 24), style=wx.TE_RIGHT, value='0')
+
+        self._init_sizers()
+
+    def __init__(self, parent):
+        self._init_ctrls(parent)
+        self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL)
+        self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_CENTER)
+        self.staticText4.Enable(False)
+        self.Number.Enable(False)
+        
+        EVT_BUTTON(self, self.ButtonSizer.GetAffirmativeButton().GetId(), self.OnOK)
+
+    def SetIndex(self, index):
+        self.Index.SetValue("0x%04X"%index)
+
+    def OnOK(self, event):
+        error = []
+        try:
+            int(self.Index.GetValue(), 16)
+        except:
+            error.append("Index")
+        if self.radioButton2.GetValue() or self.radioButton3.GetValue():
+            try:
+                int(self.Number.GetValue())
+            except:
+                error.append("Number")
+        if len(error) > 0:
+            text = ""
+            if len(error) > 1:
+                suffix = "s"
+            else:
+                suffix = ""
+            for i, item in enumerate(error):
+                if i == 0:
+                    text += item
+                elif i == len(error) - 1:
+                    text += " and %s"%item
+                else:
+                    text += ", %s"%item
+            message = wxMessageDialog(self, "Form isn't valid. %s must be integer%s!"%(text,suffix), "Error", wxOK|wxICON_ERROR)
+            message.ShowModal()
+            message.Destroy()
+        else:
+            self.EndModal(wxID_OK)
+
+    def GetValues(self):
+        name = self.IndexName.GetValue()
+        index = int(self.Index.GetValue(), 16)
+        if self.radioButton1.GetValue():
+            struct = 1
+            number = None
+        elif self.radioButton2.GetValue():
+            struct = 3
+            number = int(self.Number.GetValue())
+        elif self.radioButton3.GetValue():
+            struct = 7
+            number = int(self.Number.GetValue())
+        return index, name, struct, number
+
+    def OnRadioButton1Click(self, event):
+        self.EnableNumberTyping(False)
+        event.Skip()
+
+    def OnRadioButton2Click(self, event):
+        self.EnableNumberTyping(True)
+        event.Skip()
+
+    def OnRadioButton3Click(self, event):
+        self.EnableNumberTyping(True)
+        event.Skip()
+
+    def EnableNumberTyping(self, enable):
+        self.staticText4.Enable(enable)
+        self.Number.Enable(enable)
+
+
+#-------------------------------------------------------------------------------
+#                          Create User Type Dialog
+#-------------------------------------------------------------------------------
+
+
+[wxID_USERTYPEDIALOG, wxID_USERTYPEDIALOGLENGTH, wxID_USERTYPEDIALOGMAINPANEL, 
+ wxID_USERTYPEDIALOGMAX, wxID_USERTYPEDIALOGMIN, 
+ wxID_USERTYPEDIALOGSTATICBOX1, wxID_USERTYPEDIALOGSTATICTEXT1, 
+ wxID_USERTYPEDIALOGSTATICTEXT2, wxID_USERTYPEDIALOGSTATICTEXT3, 
+ wxID_USERTYPEDIALOGSTATICTEXT4, wxID_USERTYPEDIALOGTYPE, 
+] = [wx.NewId() for _init_ctrls in range(11)]
+
+class UserTypeDialog(wx.Dialog):
+    def _init_coll_flexGridSizer1_Items(self, parent):
+        # generated method, don't edit
+
+        parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
+
+    def _init_sizers(self):
+        # generated method, don't edit
+        self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
+
+        self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
+
+        self.SetSizer(self.flexGridSizer1)
+
+    def _init_ctrls(self, prnt):
+        # generated method, don't edit
+        wx.Dialog.__init__(self, id=wxID_USERTYPEDIALOG, name='UserTypeDialog',
+              parent=prnt, pos=wx.Point(376, 223), size=wx.Size(444, 228),
+              style=wx.DEFAULT_DIALOG_STYLE, title='Add User Type')
+        self.SetClientSize(wx.Size(444, 228))
+
+        self.MainPanel = wx.Panel(id=wxID_USERTYPEDIALOGMAINPANEL,
+              name='MainPanel', parent=self, pos=wx.Point(0, 0),
+              size=wx.Size(431, 182), style=wx.TAB_TRAVERSAL)
+        self.MainPanel.SetAutoLayout(True)
+
+        self.staticText1 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT1,
+              label='Type:', name='staticText1', parent=self.MainPanel,
+              pos=wx.Point(24, 24), size=wx.Size(156, 17), style=0)
+
+        self.Type = wx.Choice(choices=[], id=wxID_USERTYPEDIALOGTYPE,
+              name='Type', parent=self.MainPanel, pos=wx.Point(24, 48),
+              size=wx.Size(160, 24), style=0)
+        self.Type.Bind(wx.EVT_CHOICE, self.OnTypeChoice,
+              id=wxID_USERTYPEDIALOGTYPE)
+
+        self.staticBox1 = wx.StaticBox(id=wxID_USERTYPEDIALOGSTATICBOX1,
+              label='Values', name='staticBox1', parent=self.MainPanel,
+              pos=wx.Point(200, 24), size=wx.Size(224, 144), style=0)
+
+        self.staticText2 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT2,
+              label='Minimum:', name='staticText2', parent=self.MainPanel,
+              pos=wx.Point(216, 48), size=wx.Size(67, 17), style=0)
+
+        self.Min = wx.TextCtrl(id=wxID_USERTYPEDIALOGMIN, name='Min',
+              parent=self.MainPanel, pos=wx.Point(296, 48), size=wx.Size(112,
+              24), style=wx.TE_RIGHT, value='0')
+
+        self.staticText3 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT3,
+              label='Maximum:', name='staticText3', parent=self.MainPanel,
+              pos=wx.Point(216, 88), size=wx.Size(71, 17), style=0)
+
+        self.Max = wx.TextCtrl(id=wxID_USERTYPEDIALOGMAX, name='Max',
+              parent=self.MainPanel, pos=wx.Point(296, 88), size=wx.Size(112,
+              25), style=wx.TE_RIGHT, value='0')
+
+        self.staticText4 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT4,
+              label='Length:', name='staticText4', parent=self.MainPanel,
+              pos=wx.Point(216, 128), size=wx.Size(52, 17), style=0)
+
+        self.Length = wx.TextCtrl(id=wxID_USERTYPEDIALOGLENGTH, name='Length',
+              parent=self.MainPanel, pos=wx.Point(296, 128), size=wx.Size(112,
+              25), style=wx.TE_RIGHT, value='0')
+
+        self._init_sizers()
+
+    def __init__(self, parent):
+        self._init_ctrls(parent)
+        self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL)
+        self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_CENTER)
+        self.TypeDictionary = {}
+
+        EVT_BUTTON(self, self.ButtonSizer.GetAffirmativeButton().GetId(), self.OnOK)
+
+    def OnOK(self, event):
+        error = []
+        good = True
+        firstmessage = ""
+        secondmessage = ""
+        name = self.Type.GetStringSelection()
+        if name != "":
+            valuetype = self.TypeDictionary[name][1]
+            if valuetype == 0:
+                try:
+                    int(self.Min.GetValue(), 16)
+                except:
+                    error.append("Minimum")
+                    good = False
+                try:
+                    int(self.Max.GetValue(), 16)
+                except:
+                    error.append("Maximum")
+                    good = False
+            elif valuetype == 1:
+                try:
+                    int(self.Length.GetValue(), 16)
+                except:
+                    error.append("Length")
+                    good = False
+            if len(error) > 0:
+                secondmessage = ". "
+                for i, item in enumerate(error):
+                    if i == 0:
+                        secondmessage += item
+                    elif i == len(error) - 1:
+                        secondmessage += " and %s"%item
+                    else:
+                        secondmessage += ", %s"%item
+                secondmessage += " must be integer"
+                if len(error) > 1:
+                    secondmessage += "s"
+        else:
+            firstmessage = ". A type must be selected"
+            good = False
+        if not good:
+            message = wxMessageDialog(self, "Form isn't valid%s%s%s!"%(firstmessage,secondmessage), "Error", wxOK|wxICON_ERROR)
+            message.ShowModal()
+            message.Destroy()
+            self.Name.SetFocus()
+        else:
+            self.EndModal(wxID_OK)
+
+    def SetValues(self, min = None, max = None, length = None):
+        if min != None:
+            self.Min.SetValue(str(min))
+        if max != None:
+            self.Max.SetValue(str(max))
+        if length != None:
+            self.Length.SetValue(str(length))
+
+    def SetTypeList(self, typedic, type = None):
+        self.Type.Clear()
+        list = []
+        for index, (name, valuetype) in typedic.iteritems():
+            self.TypeDictionary[name] = (index, valuetype)
+            list.append((index, name))
+        list.sort()
+        for index, name in list:
+            self.Type.Append(name)
+        if type != None:
+            self.Type.SetStringSelection(typedic[type][0])
+        self.RefreshValues()
+
+    def OnTypeChoice(self, event):
+        self.RefreshValues()
+        event.Skip()
+    
+    def RefreshValues(self):
+        name = self.Type.GetStringSelection()
+        if name != "":
+            valuetype = self.TypeDictionary[name][1]
+            if valuetype == 0:
+                self.staticText2.Enable(True)
+                self.staticText3.Enable(True)
+                self.staticText4.Enable(False)
+                self.Min.Enable(True)
+                self.Max.Enable(True)
+                self.Length.Enable(False)
+            elif valuetype == 1:
+                self.staticText2.Enable(False)
+                self.staticText3.Enable(False)
+                self.staticText4.Enable(True)
+                self.Min.Enable(False)
+                self.Max.Enable(False)
+                self.Length.Enable(True)
+        else:
+            self.staticText2.Enable(False)
+            self.staticText3.Enable(False)
+            self.staticText4.Enable(False)
+            self.Min.Enable(False)
+            self.Max.Enable(False)
+            self.Length.Enable(False)
+
+    def GetValues(self):
+        name = self.Type.GetStringSelection()
+        type = self.TypeDictionary[name][0]
+        min = int(self.Min.GetValue())
+        max = int(self.Max.GetValue())
+        length = int(self.Length.GetValue())
+        return type, min, max, length
+
+
+
+#-------------------------------------------------------------------------------
+#                          Editing Node Infos Dialog
+#-------------------------------------------------------------------------------
+
+
+[wxID_NODEINFOSDIALOG, wxID_NODEINFOSDIALOGMAINPANEL, 
+ wxID_NODEINFOSDIALOGNAME, wxID_NODEINFOSDIALOGNODEID, 
+ wxID_NODEINFOSDIALOGDESCRIPTION, wxID_NODEINFOSDIALOGSTATICTEXT1, 
+ wxID_NODEINFOSDIALOGSTATICTEXT2, wxID_NODEINFOSDIALOGSTATICTEXT3, 
+ wxID_NODEINFOSDIALOGSTATICTEXT4, wxID_NODEINFOSDIALOGTYPE, 
+] = [wx.NewId() for _init_ctrls in range(10)]
+
+class NodeInfosDialog(wx.Dialog):
+    def _init_coll_flexGridSizer1_Items(self, parent):
+        # generated method, don't edit
+
+        parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
+
+    def _init_sizers(self):
+        # generated method, don't edit
+        self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
+
+        self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
+
+        self.SetSizer(self.flexGridSizer1)
+
+    def _init_ctrls(self, prnt):
+        # generated method, don't edit
+        wx.Dialog.__init__(self, id=wxID_NODEINFOSDIALOG,
+              name='NodeInfosDialog', parent=prnt, pos=wx.Point(376, 223),
+              size=wx.Size(300, 300), style=wx.DEFAULT_DIALOG_STYLE,
+              title='Node Infos')
+        self.SetClientSize(wx.Size(300, 300))
+
+        self.MainPanel = wx.Panel(id=wxID_NODEINFOSDIALOGMAINPANEL,
+              name='MainPanel', parent=self, pos=wx.Point(0, 0),
+              size=wx.Size(280, 264), style=wx.TAB_TRAVERSAL)
+        self.MainPanel.SetAutoLayout(True)
+
+        self.staticText1 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT1,
+              label='Name:', 
+              name='staticText1', parent=self.MainPanel,
+              pos=wx.Point(24, 24), size=wx.Size(156, 17), style=0)
+
+        self.Name = wx.TextCtrl(id=wxID_NODEINFOSDIALOGNAME, name='Name',
+              parent=self.MainPanel, pos=wx.Point(24, 48), size=wx.Size(250,
+              25), style=0, value='')
+
+        self.staticText2 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT2,
+              label='Node ID:', name='staticText2', parent=self.MainPanel,
+              pos=wx.Point(24, 80), size=wx.Size(67, 17), style=0)
+
+        self.NodeID = wx.TextCtrl(id=wxID_NODEINFOSDIALOGNODEID, name='NodeID',
+              parent=self.MainPanel, pos=wx.Point(24, 104), size=wx.Size(250,
+              25), style=wx.TE_RIGHT, value='')
+
+        self.staticText3 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT3,
+              label='Type:', name='staticText3', parent=self.MainPanel,
+              pos=wx.Point(24, 136), size=wx.Size(71, 17), style=0)
+
+        self.Type = wx.Choice(choices=[], id=wxID_NODEINFOSDIALOGTYPE,
+              name='Type', parent=self.MainPanel, pos=wx.Point(24, 160),
+              size=wx.Size(250, 25), style=0)
+
+        self.staticText4 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT4,
+              label='Description:', name='staticText4', parent=self.MainPanel,
+              pos=wx.Point(24, 192), size=wx.Size(71, 17), style=0)
+
+        self.Description = wx.TextCtrl(id=wxID_NODEINFOSDIALOGDESCRIPTION, 
+              name='Description', parent=self.MainPanel, pos=wx.Point(24, 216), 
+              size=wx.Size(250, 25), style=0, value='')
+
+        self._init_sizers()
+
+    def __init__(self, parent):
+        self._init_ctrls(parent)
+        self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL)
+        self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_CENTER)
+        self.Type.Append("master")
+        self.Type.Append("slave")
+
+        EVT_BUTTON(self, self.ButtonSizer.GetAffirmativeButton().GetId(), self.OnOK)
+
+    def OnOK(self, event):
+        name = self.Name.GetValue()
+        message = ""
+        if name != "":
+            good = not name[0].isdigit()
+            for item in name.split("_"):
+                good &= item.isalnum()
+            if not good:
+                message = "Node name can't be undefined or start with a digit and must be composed of alphanumerical characters or underscore!"
+        if message != "":
+            try:
+                nodeid = int(self.NodeID.GetValue(), 16)
+            except:
+                message = "Node ID must be integer!"
+        if message != "":
+            message = wxMessageDialog(self, message, "ERROR", wxOK|wxICON_ERROR)
+            message.ShowModal()
+            message.Destroy()
+            self.Name.SetFocus()
+        else:
+            self.EndModal(wxID_OK)
+    
+    def SetValues(self, name, id, type, description):
+        self.Name.SetValue(name)
+        self.NodeID.SetValue("0x%02X"%id)
+        self.Type.SetStringSelection(type)
+        self.Description.SetValue(description)
+
+    def GetValues(self):
+        name = self.Name.GetValue()
+        nodeid = int(self.NodeID.GetValue(), 16)
+        type = self.Type.GetStringSelection()
+        description = self.Description.GetValue()
+        return name, nodeid, type, description
+
+
+
+#-------------------------------------------------------------------------------
+#                          Create New Node Dialog
+#-------------------------------------------------------------------------------
+
+
+[wxID_CREATENODEDIALOG, wxID_CREATENODEDIALOGEMERGENCY, 
+ wxID_CREATENODEDIALOGGENSYNC, wxID_CREATENODEDIALOGMAINPANEL, 
+ wxID_CREATENODEDIALOGNAME, wxID_CREATENODEDIALOGNMT_HEARTBEAT, 
+ wxID_CREATENODEDIALOGNMT_NODEGUARDING, wxID_CREATENODEDIALOGNMT_NONE, 
+ wxID_CREATENODEDIALOGNODEID, wxID_CREATENODEDIALOGPROFILE, 
+ wxID_CREATENODEDIALOGSAVECONFIG, wxID_CREATENODEDIALOGSTATICTEXT1, 
+ wxID_CREATENODEDIALOGSTATICTEXT2, wxID_CREATENODEDIALOGSTATICTEXT3, 
+ wxID_CREATENODEDIALOGSTATICTEXT4, wxID_CREATENODEDIALOGSTATICTEXT5, 
+ wxID_CREATENODEDIALOGSTATICTEXT6, wxID_CREATENODEDIALOGSTATICTEXT7,
+ wxID_CREATENODEDIALOGSTOREEDS, wxID_CREATENODEDIALOGDESCRIPTION,
+ wxID_CREATENODEDIALOGTYPE, 
+] = [wx.NewId() for _init_ctrls in range(21)]
+
+class CreateNodeDialog(wx.Dialog):
+    def _init_coll_flexGridSizer1_Items(self, parent):
+        # generated method, don't edit
+
+        parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
+
+    def _init_sizers(self):
+        # generated method, don't edit
+        self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
+
+        self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
+
+        self.SetSizer(self.flexGridSizer1)
+
+    def _init_ctrls(self, prnt):
+        # generated method, don't edit
+        wx.Dialog.__init__(self, id=wxID_CREATENODEDIALOG,
+              name='CreateNodeDialog', parent=prnt, pos=wx.Point(376, 223),
+              size=wx.Size(451, 376), style=wx.DEFAULT_DIALOG_STYLE,
+              title='Create a new Node')
+        self.SetClientSize(wx.Size(451, 376))
+
+        self.MainPanel = wx.Panel(id=wxID_CREATENODEDIALOGMAINPANEL,
+              name='MainPanel', parent=self, pos=wx.Point(0, 0),
+              size=wx.Size(440, 278), style=wx.TAB_TRAVERSAL)
+        self.MainPanel.SetAutoLayout(True)
+
+        self.staticText1 = wx.StaticText(id=wxID_CREATENODEDIALOGSTATICTEXT1,
+              label='Name:', name='staticText1', parent=self.MainPanel,
+              pos=wx.Point(24, 24), size=wx.Size(156, 17), style=0)
+
+        self.staticText2 = wx.StaticText(id=wxID_CREATENODEDIALOGSTATICTEXT2,
+              label='Node ID:', name='staticText2', parent=self.MainPanel,
+              pos=wx.Point(24, 80), size=wx.Size(67, 17), style=0)
+
+        self.staticText3 = wx.StaticText(id=wxID_CREATENODEDIALOGSTATICTEXT3,
+              label='Type:', name='staticText3', parent=self.MainPanel,
+              pos=wx.Point(24, 136), size=wx.Size(71, 17), style=0)
+
+        self.Type = wx.Choice(choices=[], id=wxID_CREATENODEDIALOGTYPE,
+              name='Type', parent=self.MainPanel, pos=wx.Point(24, 160),
+              size=wx.Size(200, 24), style=0)
+
+        self.Name = wx.TextCtrl(id=wxID_CREATENODEDIALOGNAME, name='Name',
+              parent=self.MainPanel, pos=wx.Point(24, 48), size=wx.Size(200,
+              25), style=0, value='')
+
+        self.NodeID = wx.TextCtrl(id=wxID_CREATENODEDIALOGNODEID, name='NodeID',
+              parent=self.MainPanel, pos=wx.Point(24, 104), size=wx.Size(200,
+              25), style=wx.TE_RIGHT, value='')
+
+        self.staticText4 = wx.StaticText(id=wxID_CREATENODEDIALOGSTATICTEXT4,
+              label='Profile:', name='staticText4', parent=self.MainPanel,
+              pos=wx.Point(24, 192), size=wx.Size(47, 17), style=0)
+
+        self.Profile = wx.Choice(choices=[], id=wxID_CREATENODEDIALOGPROFILE,
+              name='Profile', parent=self.MainPanel, pos=wx.Point(24, 216),
+              size=wx.Size(200, 24), style=0)
+        self.Profile.Bind(wx.EVT_CHOICE, self.OnProfileChoice,
+              id=wxID_CREATENODEDIALOGPROFILE)
+
+        self.staticText5 = wx.StaticText(id=wxID_CREATENODEDIALOGSTATICTEXT5,
+              label='Network Management:', name='staticText5',
+              parent=self.MainPanel, pos=wx.Point(256, 24), size=wx.Size(152,
+              16), style=0)
+
+        self.NMT_None = wx.RadioButton(id=wxID_CREATENODEDIALOGNMT_NONE,
+              label='None', name='NMT_None', parent=self.MainPanel,
+              pos=wx.Point(256, 40), size=wx.Size(114, 24), style=0)
+        self.NMT_None.SetValue(True)
+
+        self.NMT_NodeGuarding = wx.RadioButton(id=wxID_CREATENODEDIALOGNMT_NODEGUARDING,
+              label='Node Guarding', name='NMT_NodeGuarding',
+              parent=self.MainPanel, pos=wx.Point(256, 64), size=wx.Size(128,
+              24), style=0)
+        self.NMT_NodeGuarding.SetValue(False)
+
+        self.NMT_Heartbeat = wx.RadioButton(id=wxID_CREATENODEDIALOGNMT_HEARTBEAT,
+              label='Heartbeat', name='NMT_Heartbeat', parent=self.MainPanel,
+              pos=wx.Point(256, 88), size=wx.Size(114, 24), style=0)
+        self.NMT_Heartbeat.SetValue(False)
+
+        self.staticText6 = wx.StaticText(id=wxID_CREATENODEDIALOGSTATICTEXT6,
+              label='Options:', name='staticText6', parent=self.MainPanel,
+              pos=wx.Point(256, 128), size=wx.Size(72, 17), style=0)
+
+        self.DS302 = wx.CheckBox(id=wxID_CREATENODEDIALOGGENSYNC,
+              label='DS-302 Profile', name='DS302', parent=self.MainPanel,
+              pos=wx.Point(256, 144), size=wx.Size(128, 24), style=0)
+        self.DS302.SetValue(False)
+        #self.DS302.Enable(False)
+
+        self.GenSYNC = wx.CheckBox(id=wxID_CREATENODEDIALOGGENSYNC,
+              label='Generate SYNC', name='GenSYNC', parent=self.MainPanel,
+              pos=wx.Point(256, 168), size=wx.Size(128, 24), style=0)
+        self.GenSYNC.SetValue(False)
+
+        self.Emergency = wx.CheckBox(id=wxID_CREATENODEDIALOGEMERGENCY,
+              label='Emergency support', name='Emergency',
+              parent=self.MainPanel, pos=wx.Point(256, 192), size=wx.Size(152,
+              24), style=0)
+        self.Emergency.SetValue(False)
+        self.Emergency.Enable(False)
+
+        self.SaveConfig = wx.CheckBox(id=wxID_CREATENODEDIALOGSAVECONFIG,
+              label='Save Configuration', name='SaveConfig',
+              parent=self.MainPanel, pos=wx.Point(256, 216), size=wx.Size(152,
+              24), style=0)
+        self.SaveConfig.SetValue(False)
+        self.SaveConfig.Enable(False)
+
+#        self.StoreEDS = wx.CheckBox(id=wxID_CREATENODEDIALOGSTOREEDS,
+#              label='Store EDS', name='StoreEDS', parent=self.MainPanel,
+#              pos=wx.Point(256, 240), size=wx.Size(144, 24), style=0)
+#        self.StoreEDS.SetValue(False)
+
+        self.staticText7 = wx.StaticText(id=wxID_CREATENODEDIALOGSTATICTEXT7,
+              label='Description:', name='staticText7', parent=self.MainPanel,
+              pos=wx.Point(24, 248), size=wx.Size(71, 17), style=0)
+
+        self.Description = wx.TextCtrl(id=wxID_CREATENODEDIALOGDESCRIPTION, 
+              name='Description', parent=self.MainPanel, pos=wx.Point(24, 272), 
+              size=wx.Size(400, 25), style=0, value='')
+
+        self._init_sizers()
+
+    def __init__(self, parent):
+        self._init_ctrls(parent)
+        self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL)
+        self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_CENTER)
+        self.NodeID.SetValue("0x00")
+        self.Type.Append("master")
+        self.Type.Append("slave")
+        self.Type.SetStringSelection("slave")
+        self.Description.SetValue("")
+        self.ListProfile = {"None" : ""}
+        self.Profile.Append("None")
+        self.Directory = os.path.join(ScriptDirectory, "config")
+        listfiles = os.listdir(self.Directory)
+        listfiles.sort()
+        for item in listfiles:
+            name, extend = os.path.splitext(item)
+            if os.path.isfile(os.path.join(self.Directory, item)) and extend == ".prf" and name != "DS-302":
+                self.ListProfile[name] = os.path.join(self.Directory, item)
+                self.Profile.Append(name)
+        self.Profile.Append("Other")
+        self.Profile.SetStringSelection("None")
+        self.Name.SetFocus()
+        
+        EVT_BUTTON(self, self.ButtonSizer.GetAffirmativeButton().GetId(), self.OnOK)
+
+    def OnOK(self, event):
+        name = self.Name.GetValue()
+        message = ""
+        if name != "":
+            good = not name[0].isdigit()
+            for item in name.split("_"):
+                good &= item.isalnum()
+            if not good:
+                message = "Node name can't be undefined or start with a digit and must be composed of alphanumerical characters or underscore!"
+        if message != "":
+            try:
+                nodeid = int(self.NodeID.GetValue(), 16)
+            except:
+                message = "Node ID must be an integer!"
+        if message != "":
+            message = wxMessageDialog(self, message, "ERROR", wxOK|wxICON_ERROR)
+            message.ShowModal()
+            message.Destroy()
+            self.Name.SetFocus()
+        else:
+            self.EndModal(wxID_OK)
+
+    def GetValues(self):
+        name = self.Name.GetValue()
+        nodeid = 0
+        if self.NodeID.GetValue() != "":
+            nodeid = int(self.NodeID.GetValue(), 16)
+        type = self.Type.GetStringSelection()
+        description = self.Description.GetValue()
+        return name, nodeid, type, description
+
+    def GetProfile(self):
+        name = self.Profile.GetStringSelection()
+        return name, self.ListProfile[name]
+
+    def GetNMTManagement(self):
+        if self.NMT_None.GetValue():
+            return "None"
+        elif self.NMT_NodeGuarding.GetValue():
+            return "NodeGuarding"
+        elif self.NMT_Heartbeat.GetValue():
+            return "Heartbeat"
+        return None
+    
+    def GetOptions(self):
+        options = []
+        if self.DS302.GetValue():
+            options.append("DS302")
+        if self.GenSYNC.GetValue():
+            options.append("GenSYNC")
+        if self.Emergency.GetValue():
+            options.append("Emergency")
+        if self.SaveConfig.GetValue():
+            options.append("SaveConfig")
+#        if self.StoreEDS.GetValue():
+#            options.append("StoreEDS")
+        return options
+
+    def OnProfileChoice(self, event):
+        if self.Profile.GetStringSelection() == "Other":
+            dialog = wxFileDialog(self, "Choose a file", self.Directory, "",  "OD Profile files (*.prf)|*.prf|All files|*.*", wxOPEN|wxCHANGE_DIR)
+            dialog.ShowModal()
+            filepath = dialog.GetPath()
+            dialog.Destroy()
+            if os.path.isfile(filepath):
+                name = os.path.splitext(os.path.basename(filepath))[0]
+                self.ListProfile[name] = filepath
+                length = self.Profile.GetCount()
+                self.Profile.Insert(name, length - 2)
+                self.Profile.SetStringSelection(name)
+            else:
+                self.Profile.SetStringSelection("None")
+        event.Skip()
+
+
+#-------------------------------------------------------------------------------
+#                            ADD Slave to NodeList Dialog
+#-------------------------------------------------------------------------------
+
+[wxID_ADDSLAVEDIALOG, wxID_ADDSLAVEDIALOGMAINPANEL, wxID_ADDSLAVEDIALOGSLAVENAME, 
+ wxID_ADDSLAVEDIALOGSLAVENODEID, wxID_ADDSLAVEDIALOGEDSFILE, 
+ wxID_ADDSLAVEDIALOGIMPORTEDS, wxID_ADDSLAVEDIALOGSTATICTEXT1, 
+ wxID_ADDSLAVEDIALOGSTATICTEXT2, wxID_ADDSLAVEDIALOGSTATICTEXT3, 
+] = [wx.NewId() for _init_ctrls in range(9)]
+
+class AddSlaveDialog(wx.Dialog):
+    def _init_coll_flexGridSizer1_Items(self, parent):
+        # generated method, don't edit
+
+        parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
+
+    def _init_sizers(self):
+        # generated method, don't edit
+        self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
+
+        self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
+
+        self.SetSizer(self.flexGridSizer1)
+
+    def _init_ctrls(self, prnt):
+        # generated method, don't edit
+        wx.Dialog.__init__(self, id=wxID_ADDSLAVEDIALOG,
+              name='AddSlaveDialog', parent=prnt, pos=wx.Point(376, 223),
+              size=wx.Size(300, 250), style=wx.DEFAULT_DIALOG_STYLE,
+              title='Add a slave to nodelist')
+        self.SetClientSize(wx.Size(300, 250))
+
+        self.MainPanel = wx.Panel(id=wxID_ADDSLAVEDIALOGMAINPANEL,
+              name='MainPanel', parent=self, pos=wx.Point(0, 0),
+              size=wx.Size(350, 250), style=wx.TAB_TRAVERSAL)
+        self.MainPanel.SetAutoLayout(True)
+
+        self.staticText1 = wx.StaticText(id=wxID_ADDSLAVEDIALOGSTATICTEXT1,
+              label='Slave Name:', name='staticText1', parent=self.MainPanel,
+              pos=wx.Point(24, 24), size=wx.Size(150, 17), style=0)
+
+        self.SlaveName = wx.TextCtrl(id=wxID_ADDSLAVEDIALOGSLAVENAME,
+              name='SlaveName', parent=self.MainPanel, pos=wx.Point(24, 48), 
+              size=wx.Size(250, 24), style=0)
+
+        self.staticText2 = wx.StaticText(id=wxID_ADDSLAVEDIALOGSTATICTEXT2,
+              label='Slave Node ID:', name='staticText2', parent=self.MainPanel,
+              pos=wx.Point(24, 80), size=wx.Size(150, 17), style=0)
+
+        self.SlaveNodeID = wx.TextCtrl(id=wxID_ADDSLAVEDIALOGSLAVENODEID,
+              name='SlaveName', parent=self.MainPanel, pos=wx.Point(24, 104), 
+              size=wx.Size(250, 24), style=wxALIGN_RIGHT)
+
+        self.staticText3 = wx.StaticText(id=wxID_ADDSLAVEDIALOGSTATICTEXT3,
+              label='EDS File:', name='staticText3', parent=self.MainPanel,
+              pos=wx.Point(24, 136), size=wx.Size(155, 17), style=0)
+
+        self.EDSFile = wx.Choice(id=wxID_ADDSLAVEDIALOGEDSFILE,
+              name='EDSFile', parent=self.MainPanel, pos=wx.Point(24, 160),
+              size=wx.Size(145, 24), style=0)
+        
+        self.ImportEDS = wxButton(id=wxID_ADDSLAVEDIALOGIMPORTEDS, label='Import EDS',
+              name='ImportEDS', parent=self.MainPanel, pos=wx.Point(174, 160),
+              size=wx.Size(100, 32), style=0)
+        self.ImportEDS.Bind(wx.EVT_BUTTON, self.OnImportEDSButton,
+              id=wxID_ADDSLAVEDIALOGIMPORTEDS)
+        
+        self._init_sizers()
+
+    def __init__(self, parent):
+        self._init_ctrls(parent)
+        self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL|wxCENTRE)
+        self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_RIGHT)
+        
+        self.SlaveNodeID.SetValue("0x00")
+        
+        EVT_BUTTON(self, self.ButtonSizer.GetAffirmativeButton().GetId(), self.OnOK)
+    
+    def OnOK(self, event):
+        error = []
+        if self.SlaveName.GetValue() == "":
+            error.append("Slave Name")
+        if self.SlaveNodeID.GetValue() == "":
+            error.append("Slave Node ID")
+        if self.EDSFile.GetStringSelection() == "":
+            error.append("EDS File")
+        if len(error) > 0:
+            text = ""
+            for i, item in enumerate(error):
+                if i == 0:
+                    text += item
+                elif i == len(error) - 1:
+                    text += " and %s"%item
+                else:
+                    text += ", %s"%item 
+            message = wxMessageDialog(self, "Form isn't complete. %s must be filled!"%text, "Error", wxOK|wxICON_ERROR)
+            message.ShowModal()
+            message.Destroy()
+        else:
+            try:
+                nodeid = self.SlaveNodeID.GetValue()
+                if nodeid.find("x") != -1:
+                    nodeid = int(nodeid, 16)
+                else:
+                    nodeid = int(nodeid)
+            except:
+                message = wxMessageDialog(self, "Slave Node ID must be a value in decimal or hexadecimal!", "Error", wxOK|wxICON_ERROR)
+                message.ShowModal()
+                message.Destroy()
+                return
+            if not 0 <= nodeid <= 127:
+                message = wxMessageDialog(self, "Slave Node ID must be between 0 and 127!", "Error", wxOK|wxICON_ERROR)
+                message.ShowModal()
+                message.Destroy()
+            elif nodeid == 0 or nodeid in self.NodeList.SlaveNodes.keys():
+                message = wxMessageDialog(self, "A Node with this ID already exist in the network!", "Error", wxOK|wxICON_ERROR)
+                message.ShowModal()
+                message.Destroy()
+            else:
+                self.EndModal(wxID_OK)
+
+    def OnImportEDSButton(self, event):
+        dialog = wxFileDialog(self, "Choose an EDS file", os.getcwd(), "",  "EDS files (*.eds)|*.eds|All files|*.*", wxOPEN|wxCHANGE_DIR)
+        if dialog.ShowModal() == wxID_OK:
+            filepath = dialog.GetPath()
+            if os.path.isfile(filepath):
+                result = self.NodeList.ImportEDSFile(filepath)
+                if result:
+                    message = wxMessageDialog(self, result, "Error", wxOK|wxICON_ERROR)
+                    message.ShowModal()
+                    message.Destroy()
+        dialog.Destroy()
+        self.RefreshEDSFile()
+        event.Skip()
+
+    def RefreshEDSFile(self):
+        selection = self.EDSFile.GetStringSelection()
+        self.EDSFile.Clear()
+        for option in self.NodeList.EDSNodes.keys():
+            self.EDSFile.Append(option)
+        if self.EDSFile.FindString(selection) != wxNOT_FOUND:
+            self.EDSFile.SetStringSelection(selection)
+    
+    def SetNodeList(self, nodelist):
+        self.NodeList = nodelist
+        self.RefreshEDSFile()
+    
+    def GetValues(self):
+        values = {}
+        values["slaveName"] = self.SlaveName.GetValue()
+        nodeid = self.SlaveNodeID.GetValue()
+        if nodeid.find("x") != -1:
+            values["slaveNodeID"] = int(nodeid, 16)
+        else:
+            values["slaveNodeID"] = int(nodeid)
+        values["edsFile"] = self.EDSFile.GetStringSelection()
+        return values
--- a/objdictgen/eds_utils.py	Fri May 25 23:57:17 2007 +0200
+++ b/objdictgen/eds_utils.py	Mon May 28 18:08:24 2007 +0200
@@ -23,29 +23,41 @@
 
 
 import node
+from node import nosub, var, array, rec, plurivar, pluriarray, plurirec
 from sets import *
 from types import *
 from time import *
 import os,re
 
 # Regular expression for finding index section names
-index_model = re.compile('([0-9a-fA-F]{1,4})')
+index_model = re.compile('([0-9A-F]{1,4})')
 # Regular expression for finding subindex section names
-subindex_model = re.compile('([0-9a-fA-F]{1,4})sub([0-9a-fA-F]{1,2})')
+subindex_model = re.compile('([0-9A-F]{1,4})SUB([0-9A-F]{1,2})')
+
+# Regular expression for finding NodeXPresent keynames
+nodepresent_model = re.compile('NODE([0-9]{1,3})PRESENT')
+# Regular expression for finding NodeXName keynames
+nodename_model = re.compile('NODE([0-9]{1,3})NAME')
+# Regular expression for finding NodeXDCFName keynames
+nodedcfname_model = re.compile('NODE([0-9]{1,3})DCFNAME')
 
 # Dictionary for quickly translate boolean into integer value
 BOOL_TRANSLATE = {True : "1", False : "0"}
 
+# Dictionary for quickly translate eds access value into canfestival access value
+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_boolean = lambda x: x in (0, 1)
 
 # Define checking of value for each attribute
 ENTRY_ATTRIBUTES = {"SUBNUMBER" : is_integer, "PARAMETERNAME" : is_string, 
                     "OBJECTTYPE" : lambda x: x in (7, 8, 9), "DATATYPE" : is_integer, 
                     "LOWLIMIT" : is_integer, "HIGHLIMIT" : is_integer,
                     "ACCESSTYPE" : lambda x: x in ["ro","wo", "rw", "rwr", "rww", "const"],
-                    "DEFAULTVALUE" : lambda x: True, "PDOMAPPING" : lambda x: x in (0, 1),
+                    "DEFAULTVALUE" : lambda x: True, "PDOMAPPING" : is_boolean,
                     "OBJFLAGS" : is_integer}
 
 # Define entry parameters by entry ObjectType number
@@ -63,29 +75,29 @@
 # Function that search into Node Mappings the informations about an index or a subindex
 # and return the default value
 def GetDefaultValue(index, subIndex = None):
-    infos = Manager.GetEntryInfos(index, Node)
+    infos = Node.GetEntryInfos(index)
     if infos["struct"] & node.OD_MultipleSubindexes:
         # First case entry is a record
         if infos["struct"] & node.OD_IdenticalSubindexes:
-            subentry_infos = Manager.GetSubentryInfos(index, 1, Node)
+            subentry_infos = Node.GetSubentryInfos(index, 1)
         # Second case entry is an array
         else:
-            subentry_infos = Manager.GetSubentryInfos(index, subIndex, Node)
+            subentry_infos = Node.GetSubentryInfos(index, subIndex)
         # If a default value is defined for this subindex, returns it
         if "default" in subentry_infos:
             return subentry_infos["default"]
         # If not, returns the default value for the subindex type
         else:
-            return Manager.GetTypeDefaultValue(subentry_infos["type"], Node)
+            return Node.GetTypeDefaultValue(subentry_infos["type"])
     # Third case entry is a var
     else:
-        subentry_infos = Manager.GetSubentryInfos(index, 0, Node)
+        subentry_infos = Node.GetSubentryInfos(index, 0)
         # If a default value is defined for this subindex, returns it
         if "default" in subentry_infos:
             return subentry_infos["default"]
         # If not, returns the default value for the subindex type
         else:
-            return Manager.GetTypeDefaultValue(subentry_infos["type"], Node)
+            return Node.GetTypeDefaultValue(subentry_infos["type"])
     return None
 
 
@@ -100,18 +112,137 @@
                     "MANDATORYOBJECTS", "OPTIONALOBJECTS", "MANUFACTUREROBJECTS"]
 
 
+# Function that extract sections from a file and returns a dictionary of the informations
+def ExtractSections(file):
+    return [(blocktuple[0],                # EntryName : Assignements dict
+             blocktuple[-1].splitlines())  # all the lines
+             for blocktuple in [           # Split the eds files into
+             block.split("]")              # (EntryName,Assignements) tuple
+             for block in                  # for each blocks staring with '['
+             file.split("[")]
+             if blocktuple[0].isalnum()]   # if EntryName exists
+    
+
+# Function that parse an CPJ file and returns a dictionary of the informations
+def ParseCPJFile(filepath):
+    networks = []
+    # Read file text
+    cpj_file = open(filepath,'r').read()
+    sections = ExtractSections(cpj_file)
+    # Parse assignments for each section
+    for section_name, assignments in sections:
+        
+        # Verify that section name is TOPOLOGY 
+        if section_name.upper() in "TOPOLOGY":
+            
+            # Reset values for topology
+            topology = {"Name" : "", "Nodes" : {}}
+            
+            for assignment in assignments:
+                # Escape any comment
+                if assignment.startswith(";"):
+                    pass
+                # Verify that line is a valid assignment
+                elif assignment.find('=') > 0:
+                    # Split assignment into the two values keyname and value
+                    # Verify that there is only one '=' character in the line
+                    try:
+                        keyname, value = assignment.split("=")
+                    except:
+                        raise SyntaxError, "\"%s\" is not a valid EDS line"%assignment.strip()
+                    
+                    # keyname must be immediately followed by the "=" sign, so we
+                    # verify that there is no whitespace into keyname
+                    if keyname.isalnum():
+                        # value can be preceded and followed by whitespaces, so we escape them
+                        value = value.strip()
+                
+                        # First case, value starts with "0x", then it's an hexadecimal value
+                        if value.startswith("0x"):
+                            try:
+                                computed_value = int(value, 16)
+                            except:
+                                raise SyntaxError, "\"%s\" is not a valid value for attribute \"%s\" of section \"[%s]\""%(value, keyname, section_name)
+                        elif value.isdigit():
+                            # Second case, value is a number and starts with "0", then it's an octal value
+                            if value.startswith("0"):
+                                computed_value = int(value, 8)
+                            # Third case, value is a number and don't start with "0", then it's a decimal value
+                            else:
+                                computed_value = int(value)
+                        # In any other case, we keep string value
+                        else:
+                            computed_value = value
+                        
+                        # Search if the section name match any cpj expression
+                        nodepresent_result = nodepresent_model.match(keyname.upper())
+                        nodename_result = nodename_model.match(keyname.upper())
+                        nodedcfname_result = nodedcfname_model.match(keyname.upper())
+                        
+                        if keyname.upper() == "NETNAME":
+                            if not is_string(computed_value):
+                                raise SyntaxError, "Invalid value \"%s\" for keyname \"%s\" of section \"[%s]\""%(value, keyname, section_name)
+                            topology["Name"] = computed_value
+                        elif keyname.upper() == "NODES":
+                            if not is_integer(computed_value):
+                                raise SyntaxError, "Invalid value \"%s\" for keyname \"%s\" of section \"[%s]\""%(value, keyname, section_name)
+                            topology["Number"] = computed_value
+                        elif keyname.upper() == "EDSBASENAME":
+                            if not is_string(computed_value):
+                                raise SyntaxError, "Invalid value \"%s\" for keyname \"%s\" of section \"[%s]\""%(value, keyname, section_name)
+                            topology["Path"] = computed_value
+                        elif nodepresent_result:
+                            if not is_boolean(computed_value):
+                                raise SyntaxError, "Invalid value \"%s\" for keyname \"%s\" of section \"[%s]\""%(value, keyname, section_name)
+                            nodeid = int(nodepresent_result.groups()[0])
+                            if nodeid not in topology["Nodes"].keys():
+                                topology["Nodes"][nodeid] = {}
+                            topology["Nodes"][nodeid]["Present"] = computed_value
+                        elif nodename_result:
+                            if not is_string(value):
+                                raise SyntaxError, "Invalid value \"%s\" for keyname \"%s\" of section \"[%s]\""%(value, keyname, section_name)
+                            nodeid = int(nodename_result.groups()[0])
+                            if nodeid not in topology["Nodes"].keys():
+                                topology["Nodes"][nodeid] = {}
+                            topology["Nodes"][nodeid]["Name"] = computed_value
+                        elif nodedcfname_result:
+                            if not is_string(computed_value):
+                                raise SyntaxError, "Invalid value \"%s\" for keyname \"%s\" of section \"[%s]\""%(value, keyname, section_name)
+                            nodeid = int(nodedcfname_result.groups()[0])
+                            if nodeid not in topology["Nodes"].keys():
+                                topology["Nodes"][nodeid] = {}
+                            topology["Nodes"][nodeid]["DCFName"] = computed_value
+                        else:
+                            raise SyntaxError, "Keyname \"%s\" not recognised for section \"[%s]\""%(keyname, section_name)
+                        
+                # All lines that are not empty and are neither a comment neither not a valid assignment
+                elif assignment.strip() != "":
+                    raise SyntaxError, "\"%s\" is not a valid CPJ line"%assignment.strip()
+        
+            if "Number" not in topology.keys():
+                raise SyntaxError, "\"Nodes\" keyname in \"[%s]\" section is missing"%section_name
+        
+            if topology["Number"] != len(topology["Nodes"]):
+                raise SyntaxError, "\"Nodes\" value not corresponding to number of nodes defined"
+            
+            for nodeid, node in topology["Nodes"].items():
+                if "Present" not in node.keys():
+                    raise SyntaxError, "\"Node%dPresent\" keyname in \"[%s]\" section is missing"%(nodeid, section_name)
+            
+            networks.append(topology)
+            
+        # In other case, there is a syntax problem into CPJ file
+        else:
+            raise SyntaxError, "Section \"[%s]\" is unrecognized"%section_name
+    
+    return networks
+
 # Function that parse an EDS file and returns a dictionary of the informations
-def ParseFile(filepath):
+def ParseEDSFile(filepath):
     eds_dict = {}
     # Read file text
     eds_file = open(filepath,'r').read()
-    sections = [(blocktuple[0],                # EntryName : Assignements dict
-                 blocktuple[-1].splitlines())  # all the lines
-                 for blocktuple in [           # Split the eds files into
-                 block.split("]")              # (EntryName,Assignements) tuple
-                 for block in                  # for each blocks staring with '['
-                 eds_file.split("[")]
-                 if blocktuple[0].isalnum()]   # if EntryName exists
+    sections = ExtractSections(eds_file)
     
     # Parse assignments for each section
     for section_name, assignments in sections:
@@ -119,8 +250,8 @@
         values = {}
         
         # Search if the section name match an index or subindex expression
-        index_result = index_model.match(section_name)
-        subindex_result = subindex_model.match(section_name)
+        index_result = index_model.match(section_name.upper())
+        subindex_result = subindex_model.match(section_name.upper())
         
         # Compilation of the EDS information dictionary
         
@@ -170,6 +301,7 @@
             # Verify that line is a valid assignment
             elif assignment.find('=') > 0:
                 # Split assignment into the two values keyname and value
+                # Verify that there is only one '=' character in the line
                 try:
                     keyname, value = assignment.split("=")
                 except:
@@ -182,7 +314,8 @@
                     # First case, value starts with "$NODEID", then it's a formula
                     if value.startswith("$NODEID"):
                         try:
-                            computed_value = int(value.replace("$NODEID+", ""), 16)
+                            test = int(value.replace("$NODEID+", ""), 16)
+                            computed_value = value.replace("$NODEID", "self.ID")
                         except:
                             raise SyntaxError, "\"%s\" is not a valid formula for attribute \"%s\" of section \"[%s]\""%(value, keyname, section_name)
                     # Second case, value starts with "0x", then it's an hexadecimal value
@@ -320,7 +453,7 @@
     fileContent += "GroupMessaging=0\n"
     # Calculate receive and tranmit PDO numbers with the entry available
     fileContent += "NrOfRXPDO=%d\n"%len([idx for idx in entries if 0x1400 <= idx <= 0x15FF])
-    fileContent += "NrOfTXPDO=%d\n"%len([idx for idx in entries if 0x1400 <= idx <= 0x15FF])
+    fileContent += "NrOfTXPDO=%d\n"%len([idx for idx in entries if 0x1800 <= idx <= 0x19FF])
     # LSS not supported as soon as DS-302 was not fully implemented
     fileContent += "LSS_Supported=0\n"
     
@@ -455,17 +588,31 @@
     except ValueError, message:
         return "Unable to generate EDS file\n%s"%message
     
+# Function that generate the CPJ file content for the nodelist
+def GenerateCPJContent(nodelist):
+    nodes = nodelist.SlaveNodes.keys()
+    nodes.sort()
+    
+    fileContent = "[TOPOLOGY]\n"
+    fileContent += "NetName=%s\n"%nodelist.GetNetworkName()
+    fileContent += "Nodes=0x%2.2X\n"%len(nodes)
+    
+    for nodeid in nodes:
+        fileContent += "Node%dPresent=0x01\n"%nodeid
+        fileContent += "Node%dName=%s\n"%(nodeid, nodelist.SlaveNodes[nodeid]["Name"])
+        fileContent += "Node%dDCFName=%s\n"%(nodeid, nodelist.SlaveNodes[nodeid]["EDS"])
+        
+    fileContent += "EDSBaseName=eds\n"
+    return fileContent
 
 # Function that generates Node from an EDS file
-def GenerateNode(filepath, manager, cwd):
+def GenerateNode(filepath, cwd, nodeID = 0):
     global Node
-    global Manager
-    Manager = manager
     # Create a new node
-    Node = node.Node()
+    Node = node.Node(id = nodeID)
     try:
         # Parse file and extract dictionary of EDS entry
-        eds_dict = ParseFile(filepath)
+        eds_dict = ParseEDSFile(filepath)
         # Extract Profile Number from Device Type entry
         ProfileNb = eds_dict[0x1000]["DEFAULTVALUE"] & 0x0000ffff
         # If profile is not DS-301 or DS-302
@@ -490,7 +637,7 @@
                 pass
             else:
                 # Extract informations for the entry
-                entry_infos = Manager.GetEntryInfos(entry, Node)
+                entry_infos = Node.GetEntryInfos(entry)
                 
                 # If no informations are available, then we write them
                 if not entry_infos:
@@ -501,7 +648,7 @@
                         # Add mapping for first subindex
                         Node.AddMappingEntry(entry, 0, values = {"name" : values["PARAMETERNAME"], 
                                                                  "type" : values["DATATYPE"], 
-                                                                 "access" : values["ACCESSTYPE"], 
+                                                                 "access" : ACCESS_TRANSLATE[values["ACCESSTYPE"]], 
                                                                  "pdo" : values["PDOMAPPING"] == 1})
                     # Second case, entry is an ARRAY
                     elif values["OBJECTTYPE"] == 8:
@@ -520,7 +667,7 @@
                             if subindex in values["subindexes"]:
                                 Node.AddMappingEntry(entry, subindex, values = {"name" : values["subindexes"][subindex]["PARAMETERNAME"], 
                                                                                 "type" : values["subindexes"][subindex]["DATATYPE"], 
-                                                                                "access" : values["subindexes"][subindex]["ACCESSTYPE"], 
+                                                                                "access" : ACCESS_TRANSLATE[values["subindexes"][subindex]["ACCESSTYPE"]], 
                                                                                 "pdo" : values["subindexes"][subindex]["PDOMAPPING"] == 1})
                             # if not, we add a mapping for compatibility 
                             else:
@@ -538,7 +685,7 @@
                         if 1 in values:
                             Node.AddMappingEntry(entry, 1, values = {"name" : values["PARAMETERNAME"] + " %d[(sub)]", 
                                                                      "type" : values["subindexes"][1]["DATATYPE"], 
-                                                                     "access" : values["subindexes"][1]["ACCESSTYPE"], 
+                                                                     "access" : ACCESS_TRANSLATE[values["subindexes"][1]["ACCESSTYPE"]], 
                                                                      "pdo" : values["subindexes"][1]["PDOMAPPING"] == 1})
                         else:
                             raise SyntaxError, "Error on entry 0x%4.4X:\nA RECORD entry must have at least 2 subindexes"%entry
@@ -576,12 +723,12 @@
                         raise SyntaxError, "Array or Record entry 0x%4.4X must have a \"SubNumber\" attribute"%entry
         return Node
     except SyntaxError, message:
-        return "Unable to import EDS File\n%s"%message
+        return "Unable to import EDS file\n%s"%message
 
 #-------------------------------------------------------------------------------
 #                             Main Function
 #-------------------------------------------------------------------------------
 
 if __name__ == '__main__':
-    print ParseFile("examples/PEAK MicroMod.eds")
-
+    print ParseEDSFile("examples/PEAK MicroMod.eds")
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/objdictgen/networkedit.py	Mon May 28 18:08:24 2007 +0200
@@ -0,0 +1,953 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+#This file is part of CanFestival, a library implementing CanOpen Stack. 
+#
+#Copyright (C): Edouard TISSERANT, Francis DUPIN and Laurent BESSARD
+#
+#See COPYING file for copyrights details.
+#
+#This library is free software; you can redistribute it and/or
+#modify it under the terms of the GNU Lesser General Public
+#License as published by the Free Software Foundation; either
+#version 2.1 of the License, or (at your option) any later version.
+#
+#This library is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#Lesser General Public License for more details.
+#
+#You should have received a copy of the GNU Lesser General Public
+#License along with this library; if not, write to the Free Software
+#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+from wxPython.wx import *
+from wxPython.grid import *
+import wx
+from wx.lib.anchors import LayoutAnchors
+import wx.grid
+
+from types import *
+import os, re, platform, sys, time, traceback, getopt
+
+__version__ = "$Revision$"
+
+from nodelist import *
+from nodemanager import *
+from subindextable import *
+from commondialogs import *
+from doc_index.DS301_index import *
+
+def create(parent):
+    return networkedit(parent)
+
+def usage():
+    print "\nUsage of networkedit.py :"
+    print "\n   %s [Projectpath]\n"%sys.argv[0]
+
+try:
+    opts, args = getopt.getopt(sys.argv[1:], "h", ["help"])
+except getopt.GetoptError:
+    # print help information and exit:
+    usage()
+    sys.exit(2)
+
+for o, a in opts:
+    if o in ("-h", "--help"):
+        usage()
+        sys.exit()
+
+if len(args) == 0:
+    projectOpen = None 
+elif len(args) == 1:
+    projectOpen = args[0]
+else:
+    usage()
+    sys.exit(2)
+
+ScriptDirectory = sys.path[0]
+
+try:
+    from wxPython.html import *
+
+    wxEVT_HTML_URL_CLICK = wxNewId()
+
+    def EVT_HTML_URL_CLICK(win, func):
+        win.Connect(-1, -1, wxEVT_HTML_URL_CLICK, func)
+
+    class wxHtmlWindowUrlClick(wxPyEvent):
+        def __init__(self, linkinfo):
+            wxPyEvent.__init__(self)
+            self.SetEventType(wxEVT_HTML_URL_CLICK)
+            self.linkinfo = (linkinfo.GetHref(), linkinfo.GetTarget())
+
+    class wxUrlClickHtmlWindow(wxHtmlWindow):
+        """ HTML window that generates and OnLinkClicked event.
+
+        Use this to avoid having to override HTMLWindow
+        """
+        def OnLinkClicked(self, linkinfo):
+            wxPostEvent(self, wxHtmlWindowUrlClick(linkinfo))
+    
+#-------------------------------------------------------------------------------
+#                                Html Frame
+#-------------------------------------------------------------------------------
+
+    [wxID_HTMLFRAME, wxID_HTMLFRAMEHTMLCONTENT] = [wx.NewId() for _init_ctrls in range(2)]
+
+    class HtmlFrame(wx.Frame):
+        def _init_ctrls(self, prnt):
+            # generated method, don't edit
+            wx.Frame.__init__(self, id=wxID_HTMLFRAME, name='HtmlFrame',
+                  parent=prnt, pos=wx.Point(320, 231), size=wx.Size(853, 616),
+                  style=wx.DEFAULT_FRAME_STYLE, title='')
+            self.Bind(wx.EVT_CLOSE, self.OnCloseFrame, id=wxID_HTMLFRAME)
+            
+            self.HtmlContent = wxUrlClickHtmlWindow(id=wxID_HTMLFRAMEHTMLCONTENT,
+                  name='HtmlContent', parent=self, pos=wx.Point(0, 0),
+                  size=wx.Size(-1, -1), style=wxHW_SCROLLBAR_AUTO|wxHW_NO_SELECTION)
+            EVT_HTML_URL_CLICK(self.HtmlContent, self.OnLinkClick)
+
+        def __init__(self, parent, opened):
+            self._init_ctrls(parent)
+            self.HtmlFrameOpened = opened
+        
+        def SetHtmlCode(self, htmlcode):
+            self.HtmlContent.SetPage(htmlcode)
+            
+        def SetHtmlPage(self, htmlpage):
+            self.HtmlContent.LoadPage(htmlpage)
+            
+        def OnCloseFrame(self, event):
+            self.HtmlFrameOpened.remove(self.GetTitle())
+            event.Skip()
+        
+        def OnLinkClick(self, event):
+            url = event.linkinfo[0]
+            try:
+                import webbrowser
+            except ImportError:
+                wxMessageBox('Please point your browser at: %s' % url)
+            else:
+                webbrowser.open(url)
+    
+    Html_Window = True
+except:
+    Html_Window = False
+
+
+[wxID_NETWORKEDIT, wxID_NETWORKEDITNETWORKNODES, 
+ wxID_NETWORKEDITHELPBAR,
+] = [wx.NewId() for _init_ctrls in range(3)]
+
+[wxID_NETWORKEDITADDMENUITEMS0, wxID_NETWORKEDITADDMENUITEMS1, 
+ wxID_NETWORKEDITADDMENUITEMS2, wxID_NETWORKEDITADDMENUITEMS3, 
+ wxID_NETWORKEDITADDMENUITEMS4, wxID_NETWORKEDITADDMENUITEMS5, 
+] = [wx.NewId() for _init_coll_AddMenu_Items in range(6)]
+
+[wxID_NETWORKEDITFILEMENUITEMS0, wxID_NETWORKEDITFILEMENUITEMS1, 
+ wxID_NETWORKEDITFILEMENUITEMS2, wxID_NETWORKEDITFILEMENUITEMS4, 
+ wxID_NETWORKEDITFILEMENUITEMS5, wxID_NETWORKEDITFILEMENUITEMS6,
+] = [wx.NewId() for _init_coll_FileMenu_Items in range(6)]
+
+[wxID_NETWORKEDITNETWORKMENUITEMS0, wxID_NETWORKEDITNETWORKMENUITEMS1, 
+ wxID_NETWORKEDITNETWORKMENUITEMS3, 
+] = [wx.NewId() for _init_coll_AddMenu_Items in range(3)]
+
+
+[wxID_NETWORKEDITEDITMENUITEMS0, wxID_NETWORKEDITEDITMENUITEMS1, 
+ wxID_NETWORKEDITEDITMENUITEMS2, wxID_NETWORKEDITEDITMENUITEMS4, 
+ wxID_NETWORKEDITEDITMENUITEMS6, wxID_NETWORKEDITEDITMENUITEMS7, 
+ wxID_NETWORKEDITEDITMENUITEMS8, 
+] = [wx.NewId() for _init_coll_EditMenu_Items in range(7)]
+
+[wxID_NETWORKEDITHELPMENUITEMS0, wxID_NETWORKEDITHELPMENUITEMS1,
+ wxID_NETWORKEDITHELPMENUITEMS2,
+] = [wx.NewId() for _init_coll_HelpMenu_Items in range(3)]
+
+class networkedit(wx.Frame):
+    def _init_coll_menuBar1_Menus(self, parent):
+        # generated method, don't edit
+
+        if self.Mode == "solo":
+            parent.Append(menu=self.FileMenu, title='File')
+        parent.Append(menu=self.NetworkMenu, title='Network')
+        parent.Append(menu=self.EditMenu, title='Edit')
+        parent.Append(menu=self.AddMenu, title='Add')
+        parent.Append(menu=self.HelpMenu, title='Help')
+
+    def _init_coll_EditMenu_Items(self, parent):
+        # generated method, don't edit
+
+        parent.Append(help='', id=wxID_NETWORKEDITEDITMENUITEMS4,
+              kind=wx.ITEM_NORMAL, text='Refresh\tCTRL+R')
+        parent.AppendSeparator()
+        parent.Append(help='', id=wxID_NETWORKEDITEDITMENUITEMS1,
+              kind=wx.ITEM_NORMAL, text='Undo\tCTRL+Z')
+        parent.Append(help='', id=wxID_NETWORKEDITEDITMENUITEMS0,
+              kind=wx.ITEM_NORMAL, text='Redo\tCTRL+Y')
+        parent.AppendSeparator()
+        parent.Append(help='', id=wxID_NETWORKEDITEDITMENUITEMS6,
+              kind=wx.ITEM_NORMAL, text='Node infos')
+        parent.Append(help='', id=wxID_NETWORKEDITEDITMENUITEMS2,
+              kind=wx.ITEM_NORMAL, text='DS-301 Profile')
+        parent.Append(help='', id=wxID_NETWORKEDITEDITMENUITEMS8,
+              kind=wx.ITEM_NORMAL, text='DS-302 Profile')
+        parent.Append(help='', id=wxID_NETWORKEDITEDITMENUITEMS7,
+              kind=wx.ITEM_NORMAL, text='Other Profile')
+        self.Bind(wx.EVT_MENU, self.OnUndoMenu,
+              id=wxID_NETWORKEDITEDITMENUITEMS1)
+        self.Bind(wx.EVT_MENU, self.OnRedoMenu,
+              id=wxID_NETWORKEDITEDITMENUITEMS0)
+        self.Bind(wx.EVT_MENU, self.OnCommunicationMenu,
+              id=wxID_NETWORKEDITEDITMENUITEMS2)
+        self.Bind(wx.EVT_MENU, self.OnRefreshMenu,
+              id=wxID_NETWORKEDITEDITMENUITEMS4)
+        self.Bind(wx.EVT_MENU, self.OnNodeInfosMenu,
+              id=wxID_NETWORKEDITEDITMENUITEMS6)
+        self.Bind(wx.EVT_MENU, self.OnEditProfileMenu,
+              id=wxID_NETWORKEDITEDITMENUITEMS7)
+        self.Bind(wx.EVT_MENU, self.OnOtherCommunicationMenu,
+              id=wxID_NETWORKEDITEDITMENUITEMS8)
+
+    def _init_coll_HelpMenu_Items(self, parent):
+        # generated method, don't edit
+
+        parent.Append(help='', id=wxID_NETWORKEDITHELPMENUITEMS0,
+              kind=wx.ITEM_NORMAL, text='DS-301 Standard\tF1')
+        self.Bind(wx.EVT_MENU, self.OnHelpDS301Menu,
+              id=wxID_NETWORKEDITHELPMENUITEMS0)
+        parent.Append(help='', id=wxID_NETWORKEDITHELPMENUITEMS1,
+              kind=wx.ITEM_NORMAL, text='CAN Festival Docs\tF2')
+        self.Bind(wx.EVT_MENU, self.OnHelpCANFestivalMenu,
+              id=wxID_NETWORKEDITHELPMENUITEMS1)
+        if Html_Window and self.Mode == "solo":
+            parent.Append(help='', id=wxID_NETWORKEDITHELPMENUITEMS2,
+                  kind=wx.ITEM_NORMAL, text='About')
+            self.Bind(wx.EVT_MENU, self.OnAboutMenu,
+                  id=wxID_NETWORKEDITHELPMENUITEMS2)
+
+    def _init_coll_FileMenu_Items(self, parent):
+        # generated method, don't edit
+
+        parent.Append(help='', id=wxID_NETWORKEDITFILEMENUITEMS5,
+              kind=wx.ITEM_NORMAL, text='New\tCTRL+N')
+        parent.Append(help='', id=wxID_NETWORKEDITFILEMENUITEMS0,
+              kind=wx.ITEM_NORMAL, text='Open\tCTRL+O')
+        parent.Append(help='', id=wxID_NETWORKEDITFILEMENUITEMS1,
+              kind=wx.ITEM_NORMAL, text='Save\tCTRL+S')
+        parent.Append(help='', id=wxID_NETWORKEDITFILEMENUITEMS2,
+              kind=wx.ITEM_NORMAL, text='Close\tCTRL+W')
+        parent.AppendSeparator()
+        parent.Append(help='', id=wxID_NETWORKEDITFILEMENUITEMS4,
+              kind=wx.ITEM_NORMAL, text='Exit')
+        self.Bind(wx.EVT_MENU, self.OnOpenProjectMenu,
+              id=wxID_NETWORKEDITFILEMENUITEMS0)
+        self.Bind(wx.EVT_MENU, self.OnSaveProjectMenu,
+              id=wxID_NETWORKEDITFILEMENUITEMS1)
+##        self.Bind(wx.EVT_MENU, self.OnCloseProjectMenu,
+##              id=wxID_NETWORKEDITFILEMENUITEMS2)
+        self.Bind(wx.EVT_MENU, self.OnQuitMenu,
+              id=wxID_NETWORKEDITFILEMENUITEMS4)
+        self.Bind(wx.EVT_MENU, self.OnNewProjectMenu,
+              id=wxID_NETWORKEDITFILEMENUITEMS5)
+    
+    def _init_coll_NetworkMenu_Items(self, parent):
+        # generated method, don't edit
+
+        parent.Append(help='', id=wxID_NETWORKEDITNETWORKMENUITEMS0,
+              kind=wx.ITEM_NORMAL, text='Add Slave Node')
+        parent.Append(help='', id=wxID_NETWORKEDITNETWORKMENUITEMS1,
+              kind=wx.ITEM_NORMAL, text='Remove Slave Node')
+        parent.AppendSeparator()
+        parent.Append(help='', id=wxID_NETWORKEDITNETWORKMENUITEMS3,
+              kind=wx.ITEM_NORMAL, text='Build Master Dictionary')
+        self.Bind(wx.EVT_MENU, self.OnAddSlaveMenu,
+              id=wxID_NETWORKEDITNETWORKMENUITEMS0)
+        self.Bind(wx.EVT_MENU, self.OnRemoveSlaveMenu,
+              id=wxID_NETWORKEDITNETWORKMENUITEMS1)
+##        self.Bind(wx.EVT_MENU, self.OnBuildMasterMenu,
+##              id=wxID_NETWORKEDITNETWORKMENUITEMS3)
+    
+    def _init_coll_AddMenu_Items(self, parent):
+        # generated method, don't edit
+
+        parent.Append(help='', id=wxID_NETWORKEDITADDMENUITEMS0,
+              kind=wx.ITEM_NORMAL, text='SDO Server')
+        parent.Append(help='', id=wxID_NETWORKEDITADDMENUITEMS1,
+              kind=wx.ITEM_NORMAL, text='SDO Client')
+        parent.Append(help='', id=wxID_NETWORKEDITADDMENUITEMS2,
+              kind=wx.ITEM_NORMAL, text='PDO Transmit')
+        parent.Append(help='', id=wxID_NETWORKEDITADDMENUITEMS3,
+              kind=wx.ITEM_NORMAL, text='PDO Receive')
+        parent.Append(help='', id=wxID_NETWORKEDITADDMENUITEMS4,
+              kind=wx.ITEM_NORMAL, text='Map Variable')
+        parent.Append(help='', id=wxID_NETWORKEDITADDMENUITEMS5,
+              kind=wx.ITEM_NORMAL, text='User Type')
+        self.Bind(wx.EVT_MENU, self.OnAddSDOServerMenu,
+              id=wxID_NETWORKEDITADDMENUITEMS0)
+        self.Bind(wx.EVT_MENU, self.OnAddSDOClientMenu,
+              id=wxID_NETWORKEDITADDMENUITEMS1)
+        self.Bind(wx.EVT_MENU, self.OnAddPDOTransmitMenu,
+              id=wxID_NETWORKEDITADDMENUITEMS2)
+        self.Bind(wx.EVT_MENU, self.OnAddPDOReceiveMenu,
+              id=wxID_NETWORKEDITADDMENUITEMS3)
+        self.Bind(wx.EVT_MENU, self.OnAddMapVariableMenu,
+              id=wxID_NETWORKEDITADDMENUITEMS4)
+        self.Bind(wx.EVT_MENU, self.OnAddUserTypeMenu,
+              id=wxID_NETWORKEDITADDMENUITEMS5)
+
+    def _init_coll_HelpBar_Fields(self, parent):
+        # generated method, don't edit
+        parent.SetFieldsCount(3)
+
+        parent.SetStatusText(number=0, text='')
+        parent.SetStatusText(number=1, text='')
+        parent.SetStatusText(number=2, text='')
+
+        parent.SetStatusWidths([100, 110, -1])
+
+    def _init_utils(self):
+        # generated method, don't edit
+        self.menuBar1 = wx.MenuBar()
+        self.menuBar1.SetEvtHandlerEnabled(True)
+        
+        if self.Mode == "solo":
+            self.FileMenu = wx.Menu(title='')
+        
+        self.NetworkMenu = wx.Menu(title='')
+
+        self.EditMenu = wx.Menu(title='')
+
+        self.AddMenu = wx.Menu(title='')
+
+        self.HelpMenu = wx.Menu(title='')
+
+        self._init_coll_menuBar1_Menus(self.menuBar1)
+        if self.Mode == "solo":
+            self._init_coll_FileMenu_Items(self.FileMenu)
+        self._init_coll_NetworkMenu_Items(self.NetworkMenu)
+        self._init_coll_EditMenu_Items(self.EditMenu)
+        self._init_coll_AddMenu_Items(self.AddMenu)
+        self._init_coll_HelpMenu_Items(self.HelpMenu)
+
+    def _init_ctrls(self, prnt):
+        # generated method, don't edit
+        wx.Frame.__init__(self, id=wxID_NETWORKEDIT, name='networkedit',
+              parent=prnt, pos=wx.Point(149, 178), size=wx.Size(1000, 700),
+              style=wx.DEFAULT_FRAME_STYLE, title='Networkedit')
+        self._init_utils()
+        self.SetClientSize(wx.Size(1000, 700))
+        self.SetMenuBar(self.menuBar1)
+##        self.Bind(wx.EVT_CLOSE, self.OnCloseFrame, id=wxID_NETWORKEDIT)
+
+        self.NetworkNodes = wx.Notebook(id=wxID_NETWORKEDITNETWORKNODES,
+              name='NetworkNodes', parent=self, pos=wx.Point(0, 0),
+              size=wx.Size(0, 0), style=wxNB_LEFT)
+        self.NetworkNodes.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED,
+              self.OnNodeSelectedChanged, id=wxID_NETWORKEDITNETWORKNODES)
+
+        self.HelpBar = wx.StatusBar(id=wxID_NETWORKEDITHELPBAR, name='HelpBar',
+              parent=self, style=wxST_SIZEGRIP)
+        self._init_coll_HelpBar_Fields(self.HelpBar)
+        self.SetStatusBar(self.HelpBar)
+
+    def __init__(self, parent, mode = "solo", nodelist = None):
+        self.Mode = mode
+        self._init_ctrls(parent)
+        self.HtmlFrameOpened = []
+        
+        if self.Mode == "solo":
+            self.Manager = NodeManager(ScriptDirectory)
+            if projectOpen:
+                self.NodeList = NodeList(self.Manager)
+                result = self.NodeList.LoadProject(projectOpen)
+                if not result:
+                    self.RefreshNetworkNodes()
+            else:
+                self.NodeList = None
+        else:
+            self.NodeList = nodelist
+            self.Manager = self.NodeList.GetManager()
+        
+        self.RefreshBufferState()
+        self.RefreshTitle()
+        self.RefreshMainMenu()
+
+    def GetNoteBook(self):
+        return self.NetworkNodes
+
+    def OnQuitMenu(self, event):
+        self.Close()
+        event.Skip()
+
+    def OnAddSDOServerMenu(self, event):
+        self.Manager.AddSDOServerToCurrent()
+        self.RefreshBufferState()
+        self.RefreshCurrentIndexList()
+        event.Skip()
+    
+    def OnAddSDOClientMenu(self, event):
+        self.Manager.AddSDOClientToCurrent()
+        self.RefreshBufferState()
+        self.RefreshCurrentIndexList()
+        event.Skip()
+
+    def OnAddPDOTransmitMenu(self, event):
+        self.Manager.AddPDOTransmitToCurrent()
+        self.RefreshBufferState()
+        self.RefreshCurrentIndexList()
+        event.Skip()
+
+    def OnAddPDOReceiveMenu(self, event):
+        self.Manager.AddPDOReceiveToCurrent()
+        self.RefreshBufferState()
+        self.RefreshCurrentIndexList()
+        event.Skip()
+
+    def OnAddMapVariableMenu(self, event):
+        self.AddMapVariable()
+        event.Skip()
+
+    def OnAddUserTypeMenu(self, event):
+        self.AddUserType()
+        event.Skip()
+
+    def OnNodeSelectedChanged(self, event):
+        selected = event.GetSelection()
+        # At init selected = -1
+        if selected > 0:
+            window = self.NetworkNodes.GetPage(selected)
+            self.NodeList.SetCurrentSelected(window.GetIndex())
+        self.RefreshMainMenu()
+        self.RefreshStatusBar()
+        event.Skip()
+
+#-------------------------------------------------------------------------------
+#                         Load and Save Funtions
+#-------------------------------------------------------------------------------
+
+    def OnNewProjectMenu(self, event):
+        if self.NodeList:
+            defaultpath = os.path.dirname(self.NodeList.GetRoot())
+        else:
+            defaultpath = os.getcwd()
+        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:
+                manager = NodeManager(ScriptDirectory)
+                nodelist = NodeList(manager)
+                result = nodelist.LoadProject(projectpath)
+                if not result:
+                    self.Manager = manager
+                    self.NodeList = nodelist
+                    self.NodeList.SetCurrentSelected(0)
+                                        
+                    self.RefreshNetworkNodes()
+                    self.RefreshBufferState()
+                    self.RefreshTitle()
+                    self.RefreshProfileMenu()
+                    self.RefreshMainMenu()
+                else:
+                    message = wxMessageDialog(self, result, "ERROR", wxOK|wxICON_ERROR)
+                    message.ShowModal()
+                    message.Destroy()
+        event.Skip()
+
+    def OnOpenProjectMenu(self, event):
+        if self.NodeList:
+            defaultpath = os.path.dirname(self.NodeList.GetRoot())
+        else:
+            defaultpath = os.getcwd()
+        dialog = wxDirDialog(self , "Choose a project", defaultpath, 0)
+        if dialog.ShowModal() == wxID_OK:
+            projectpath = dialog.GetPath()
+            if os.path.isdir(projectpath):
+                manager = NodeManager(ScriptDirectory)
+                nodelist = NodeList(manager)
+                result = nodelist.LoadProject(projectpath)
+                if not result:
+                    self.Manager = manager
+                    self.NodeList = nodelist
+                    self.NodeList.SetCurrentSelected(0)
+                    
+                    self.RefreshNetworkNodes()
+                    self.RefreshBufferState()
+                    self.RefreshTitle()
+                    self.RefreshProfileMenu()
+                    self.RefreshMainMenu()
+                else:
+                    message = wxMessageDialog(self, result, "Error", wxOK|wxICON_ERROR)
+                    message.ShowModal()
+                    message.Destroy()
+        dialog.Destroy()
+        event.Skip()
+
+    def OnSaveProjectMenu(self, event):
+        result = self.NodeList.SaveProject()
+        if result:
+            message = wxMessageDialog(self, result, "Error", wxOK|wxICON_ERROR)
+            message.ShowModal()
+            message.Destroy()
+        event.Skip()
+
+#-------------------------------------------------------------------------------
+#                             Slave Nodes Management
+#-------------------------------------------------------------------------------
+
+    def OnAddSlaveMenu(self, event):
+        dialog = AddSlaveDialog(self)
+        dialog.SetNodeList(self.NodeList)
+        if dialog.ShowModal() == wxID_OK:
+            values = dialog.GetValues()
+            result = self.NodeList.AddSlaveNode(values["slaveName"], values["slaveNodeID"], values["edsFile"])
+            if not result:
+                new_editingpanel = EditingPanel(self, self.NodeList, False)
+                new_editingpanel.SetIndex(values["slaveNodeID"])
+                idx = self.NodeList.GetOrderNumber(values["slaveNodeID"])
+                self.NetworkNodes.InsertPage(idx, new_editingpanel, "")
+                self.NodeList.SetCurrentSelected(idx)
+                self.NetworkNodes.SetSelection(idx)
+                self.RefreshBufferState()
+            else:
+                message = wxMessageDialog(self, result, "Error", wxOK|wxICON_ERROR)
+                message.ShowModal()
+                message.Destroy()
+        dialog.Destroy()
+        event.Skip()
+
+    def OnRemoveSlaveMenu(self, event):
+        slavenames = self.NodeList.GetSlaveNames()
+        slaveids = self.NodeList.GetSlaveIDs()
+        dialog = wxSingleChoiceDialog(self, "Choose a slave to remove", "Remove slave", slavenames)
+        if dialog.ShowModal() == wxID_OK:
+            choice = dialog.GetSelection()
+            result = self.NodeList.RemoveSlaveNode(slaveids[choice])
+            if not result:
+                slaveids.pop(choice)
+                current = self.NetworkNodes.GetSelection()
+                self.NetworkNodes.DeletePage(choice + 1)
+                if self.NetworkNodes.GetPageCount() > 0:
+                    new_selection = min(current, self.NetworkNodes.GetPageCount() - 1)
+                    self.NetworkNodes.SetSelection(new_selection)
+                    if new_selection > 0:
+                        self.NodeList.SetCurrentSelected(slaveids[new_selection - 1])
+                    self.RefreshBufferState()
+            else:
+                message = wxMessageDialog(self, result, "Error", wxOK|wxICON_ERROR)
+                message.ShowModal()
+                message.Destroy()
+        event.Skip()
+
+#-------------------------------------------------------------------------------
+#                             Refresh Functions
+#-------------------------------------------------------------------------------
+
+    def RefreshTitle(self):
+        if self.NodeList != None:
+            self.SetTitle("Networkedit - %s"%self.NodeList.GetNetworkName())
+        else:
+            self.SetTitle("Networkedit")
+
+    def OnRefreshMenu(self, event):
+        self.RefreshCurrentIndexList()
+        event.Skip()
+
+    def RefreshCurrentIndexList(self):
+        selected = self.NetworkNodes.GetSelection()
+        if selected == 0:
+            window = self.NetworkNodes.GetPage(selected)
+            window.RefreshIndexList()
+        else:
+            pass
+
+    def RefreshNetworkNodes(self):
+        if self.NetworkNodes.GetPageCount() > 0:
+            self.NetworkNodes.DeleteAllPages()
+        if self.NodeList:
+            new_editingpanel = EditingPanel(self, self.Manager)
+            new_editingpanel.SetIndex(0)
+            self.NetworkNodes.AddPage(new_editingpanel, "")
+            for idx in self.NodeList.GetSlaveIDs():
+                new_editingpanel = EditingPanel(self, self.NodeList, False)
+                new_editingpanel.SetIndex(idx)
+                self.NetworkNodes.AddPage(new_editingpanel, "")
+
+    def RefreshStatusBar(self):
+        if self.HelpBar:
+            window = self.NetworkNodes.GetPage(self.NetworkNodes.GetSelection())
+            selection = window.GetSelection()
+            if selection:
+                index, subIndex = selection
+                if self.NodeList.IsCurrentEntry(index):
+                    self.HelpBar.SetStatusText("Index: 0x%04X"%index, 0)
+                    self.HelpBar.SetStatusText("Subindex: 0x%02X"%subIndex, 1)
+                    entryinfos = self.NodeList.GetEntryInfos(index)
+                    name = entryinfos["name"]
+                    category = "Optional"
+                    if entryinfos["need"]:
+                        category = "Mandatory"
+                    struct = "VAR"
+                    number = ""
+                    if entryinfos["struct"] & OD_IdenticalIndexes:
+                        number = " possibly defined %d times"%entryinfos["nbmax"]
+                    if entryinfos["struct"] & OD_IdenticalSubindexes:
+                        struct = "REC"
+                    elif entryinfos["struct"] & OD_MultipleSubindexes:
+                        struct = "ARRAY"
+                    text = "%s: %s entry of struct %s%s."%(name,category,struct,number)
+                    self.HelpBar.SetStatusText(text, 2)
+                else:
+                    for i in xrange(3):
+                        self.HelpBar.SetStatusText("", i)
+            else:
+                for i in xrange(3):
+                    self.HelpBar.SetStatusText("", i)
+
+    def RefreshMainMenu(self):
+        if self.menuBar1:
+            self.NetworkMenu.Enable(wxID_NETWORKEDITNETWORKMENUITEMS3, False)
+            if self.NodeList == None:
+                if self.Mode == "solo":
+                    self.menuBar1.EnableTop(1, False)
+                    self.menuBar1.EnableTop(2, False)
+                    self.menuBar1.EnableTop(3, False)
+                    if self.FileMenu:
+                        self.FileMenu.Enable(wxID_NETWORKEDITFILEMENUITEMS1, False)
+                        self.FileMenu.Enable(wxID_NETWORKEDITFILEMENUITEMS2, False)
+                else:
+                    self.menuBar1.EnableTop(0, False)
+                    self.menuBar1.EnableTop(1, False)
+                    self.menuBar1.EnableTop(2, False)
+            else:
+                if self.Mode == "solo":
+                    self.menuBar1.EnableTop(1, True)
+                    if self.FileMenu:
+                        self.FileMenu.Enable(wxID_NETWORKEDITFILEMENUITEMS1, True)
+                        self.FileMenu.Enable(wxID_NETWORKEDITFILEMENUITEMS2, False)
+                    if self.NetworkNodes.GetSelection() == 0:
+                        self.menuBar1.EnableTop(2, True)
+                        self.menuBar1.EnableTop(3, True)
+                    else:
+                        self.menuBar1.EnableTop(2, False)      
+                        self.menuBar1.EnableTop(3, False)
+                else:
+                    self.menuBar1.EnableTop(0, True)
+                    if self.NetworkNodes.GetSelection() == 0:
+                        self.menuBar1.EnableTop(1, True)
+                        self.menuBar1.EnableTop(2, True)
+                    else:
+                        self.menuBar1.EnableTop(1, False)      
+                        self.menuBar1.EnableTop(2, False)
+
+    def RefreshProfileMenu(self):
+        if self.EditMenu:
+            profile = self.Manager.GetCurrentProfileName()
+            edititem = self.EditMenu.FindItemById(wxID_NETWORKEDITEDITMENUITEMS7)
+            if edititem:
+                length = self.AddMenu.GetMenuItemCount()
+                for i in xrange(length-6):
+                    additem = self.AddMenu.FindItemByPosition(6)
+                    self.AddMenu.Delete(additem.GetId())
+                if profile not in ("None", "DS-301"):
+                    edititem.SetText("%s Profile"%profile)
+                    edititem.Enable(True)
+                    self.AddMenu.AppendSeparator()
+                    for text, indexes in self.Manager.GetCurrentSpecificMenu():
+                        new_id = wx.NewId()
+                        self.AddMenu.Append(help='', id=new_id, kind=wx.ITEM_NORMAL, text=text)
+                        self.Bind(wx.EVT_MENU, self.GetProfileCallBack(text), id=new_id)
+                else:
+                    edititem.SetText("Other Profile")
+                    edititem.Enable(False)
+
+#-------------------------------------------------------------------------------
+#                              Buffer Functions
+#-------------------------------------------------------------------------------
+
+    def RefreshBufferState(self):
+        if self.NodeList:
+            nodeID = self.Manager.GetCurrentNodeID()
+            if nodeID != None:
+                nodename = "0x%2.2X %s"%(nodeID, self.Manager.GetCurrentNodeName())
+            else:
+                nodename = self.Manager.GetCurrentNodeName()
+            self.NetworkNodes.SetPageText(0, nodename)
+            for idx, name in enumerate(self.NodeList.GetSlaveNames()):
+                self.NetworkNodes.SetPageText(idx + 1, name)
+            self.RefreshTitle()
+
+    def OnUndoMenu(self, event):
+        self.Manager.LoadCurrentPrevious()
+        self.RefreshCurrentIndexList()
+        self.RefreshBufferState()
+        event.Skip()
+
+    def OnRedoMenu(self, event):
+        self.Manager.LoadCurrentNext()
+        self.RefreshCurrentIndexList()
+        self.RefreshBufferState()
+        event.Skip()
+
+#-------------------------------------------------------------------------------
+#                                Help Method
+#-------------------------------------------------------------------------------
+
+    def OnHelpDS301Menu(self, event):
+        find_index = False
+        selected = self.NetworkNodes.GetSelection()
+        if selected >= 0:
+            window = self.NetworkNodes.GetPage(selected)
+            result = window.GetSelection()
+            if result:
+                find_index = True
+                index, subIndex = result
+                result = OpenPDFDocIndex(index, ScriptDirectory)
+                if type(result) == StringType:
+                    message = wxMessageDialog(self, result, "ERROR", wxOK|wxICON_ERROR)
+                    message.ShowModal()
+                    message.Destroy()
+        if not find_index:
+            result = OpenPDFDocIndex(None, ScriptDirectory)
+            if type(result) == StringType:
+                message = wxMessageDialog(self, result, "ERROR", wxOK|wxICON_ERROR)
+                message.ShowModal()
+                message.Destroy()
+        event.Skip()
+        
+    def OnHelpCANFestivalMenu(self, event):
+        #self.OpenHtmlFrame("CAN Festival Reference", os.path.join(ScriptDirectory, "doc/canfestival.html"), wx.Size(1000, 600))
+        os.system("xpdf -remote CANFESTIVAL %s %d &"%(os.path.join(ScriptDirectory, "doc/manual_en.pdf"),16))
+        event.Skip()
+
+    def OnAboutMenu(self, event):
+        self.OpenHtmlFrame("About CAN Festival", os.path.join(ScriptDirectory, "doc/about.html"), wx.Size(500, 450))
+        event.Skip()
+
+    def OpenHtmlFrame(self, title, file, size):
+        if title not in self.HtmlFrameOpened:
+            self.HtmlFrameOpened.append(title)
+            window = HtmlFrame(self, self.HtmlFrameOpened)
+            window.SetTitle(title)
+            window.SetHtmlPage(file)
+            window.SetClientSize(size)
+            window.Show()
+
+#-------------------------------------------------------------------------------
+#                          Editing Profiles functions
+#-------------------------------------------------------------------------------
+
+    def OnCommunicationMenu(self, event):
+        dictionary,current = self.Manager.GetCurrentCommunicationLists()
+        self.EditProfile("Edit DS-301 Profile", dictionary, current)
+        event.Skip()
+    
+    def OnOtherCommunicationMenu(self, event):
+        dictionary,current = self.Manager.GetCurrentDS302Lists()
+        self.EditProfile("Edit DS-301 Profile", dictionary, current)
+        event.Skip()
+    
+    def OnEditProfileMenu(self, event):
+        title = "Edit %s Profile"%self.Manager.GetCurrentProfileName()
+        dictionary,current = self.Manager.GetCurrentProfileLists()
+        self.EditProfile(title, dictionary, current)
+        event.Skip()
+    
+    def EditProfile(self, title, dictionary, current):
+        dialog = CommunicationDialog(self)
+        dialog.SetTitle(title)
+        dialog.SetIndexDictionary(dictionary)
+        dialog.SetCurrentList(current)
+        dialog.RefreshLists()
+        if dialog.ShowModal() == wxID_OK:
+            new_profile = dialog.GetCurrentList()
+            addinglist = []
+            removinglist = []
+            for index in new_profile:
+                if index not in current:
+                    addinglist.append(index)
+            for index in current:
+                if index not in new_profile:
+                    removinglist.append(index)
+            self.Manager.ManageEntriesOfCurrent(addinglist, removinglist)
+            self.Manager.GenerateMapList()
+            self.Manager.BufferCurrentNode()
+            self.RefreshBufferState()
+            self.RefreshCurrentIndexList()
+        dialog.Destroy()
+
+#-------------------------------------------------------------------------------
+#                         Edit Node informations function
+#-------------------------------------------------------------------------------
+
+    def OnNodeInfosMenu(self, event):
+        dialog = NodeInfosDialog(self)
+        name, id, type, description = self.Manager.GetCurrentNodeInfos()
+        dialog.SetValues(name, id, type, description)
+        if dialog.ShowModal() == wxID_OK:
+            name, id, type, description = dialog.GetValues()
+            self.Manager.SetCurrentNodeInfos(name, id, type, description)
+            self.RefreshBufferState()
+            self.RefreshProfileMenu()
+            selected = self.FileOpened.GetSelection()
+            if selected >= 0:
+                window = self.FileOpened.GetPage(selected)
+                window.RefreshTable()
+        event.Skip()
+
+
+#-------------------------------------------------------------------------------
+#                           Add User Types and Variables
+#-------------------------------------------------------------------------------
+        
+    def AddMapVariable(self):
+        index = self.Manager.GetCurrentNextMapIndex()
+        if index:
+            dialog = MapVariableDialog(self)
+            dialog.SetIndex(index)
+            if dialog.ShowModal() == wxID_OK:
+                index, name, struct, number = dialog.GetValues()
+                result = self.Manager.AddMapVariableToCurrent(index, name, struct, number)
+                if type(result) != StringType:
+                    self.RefreshBufferState()
+                    self.RefreshCurrentIndexList()
+                else:
+                    message = wxMessageDialog(self, result, "Error", wxOK|wxICON_ERROR)
+                    message.ShowModal()
+                    message.Destroy()
+            dialog.Destroy()
+        else:
+            message = wxMessageDialog(self, result, "No map variable index left!", wxOK|wxICON_ERROR)
+            message.ShowModal()
+            message.Destroy()
+        
+    def AddUserType(self):
+        dialog = UserTypeDialog(self)
+        dialog.SetTypeList(self.Manager.GetCustomisableTypes())
+        if dialog.ShowModal() == wxID_OK:
+            type, min, max, length = dialog.GetValues()
+            result = self.Manager.AddUserTypeToCurrent(type, min, max, length)
+            if not IsOfType(result, StringType):
+                self.RefreshBufferState()
+                self.RefreshCurrentIndexList()
+            else:
+                message = wxMessageDialog(self, result, "Error", wxOK|wxICON_ERROR)
+                message.ShowModal()
+                message.Destroy()
+        dialog.Destroy()
+
+#-------------------------------------------------------------------------------
+#                               Exception Handler
+#-------------------------------------------------------------------------------
+
+Max_Traceback_List_Size = 20
+
+def Display_Exception_Dialog(e_type,e_value,e_tb):
+    trcbck_lst = []
+    for i,line in enumerate(traceback.extract_tb(e_tb)):
+        trcbck = " " + str(i+1) + ". "
+        if line[0].find(os.getcwd()) == -1:
+            trcbck += "file : " + str(line[0]) + ",   "
+        else:
+            trcbck += "file : " + str(line[0][len(os.getcwd()):]) + ",   "
+        trcbck += "line : " + str(line[1]) + ",   " + "function : " + str(line[2])
+        trcbck_lst.append(trcbck)
+        
+    # Allow clicking....
+    cap = wx.Window_GetCapture()
+    if cap:
+        cap.ReleaseMouse()
+
+    dlg = wx.SingleChoiceDialog(None, 
+        """
+An error happens.
+
+Click on OK for saving an error report.
+
+Please contact LOLITech at:
++33 (0)3 29 52 95 67
+bugs_networkedit@lolitech.fr
+
+
+Error:
+""" +
+        str(e_type) + " : " + str(e_value), 
+        "Error",
+        trcbck_lst)
+    try:
+        res = (dlg.ShowModal() == wx.ID_OK)
+    finally:
+        dlg.Destroy()
+
+    return res
+
+def Display_Error_Dialog(e_value):
+    message = wxMessageDialog(None, str(e_value), "Error", wxOK|wxICON_ERROR)
+    message.ShowModal()
+    message.Destroy()
+
+def get_last_traceback(tb):
+    while tb.tb_next:
+        tb = tb.tb_next
+    return tb
+
+
+def format_namespace(d, indent='    '):
+    return '\n'.join(['%s%s: %s' % (indent, k, repr(v)[:10000]) for k, v in d.iteritems()])
+
+
+ignored_exceptions = [] # a problem with a line in a module is only reported once per session
+
+def wxAddExceptHook(path, app_version='[No version]'):#, ignored_exceptions=[]):
+    
+    def handle_exception(e_type, e_value, e_traceback):
+        traceback.print_exception(e_type, e_value, e_traceback) # this is very helpful when there's an exception in the rest of this func
+        last_tb = get_last_traceback(e_traceback)
+        ex = (last_tb.tb_frame.f_code.co_filename, last_tb.tb_frame.f_lineno)
+        if str(e_value).startswith("!!!"):
+            Display_Error_Dialog(e_value)
+        elif ex not in ignored_exceptions:
+            ignored_exceptions.append(ex)
+            result = Display_Exception_Dialog(e_type,e_value,e_traceback)
+            if result:
+                info = {
+                    'app-title' : wx.GetApp().GetAppName(), # app_title
+                    'app-version' : app_version,
+                    'wx-version' : wx.VERSION_STRING,
+                    'wx-platform' : wx.Platform,
+                    'python-version' : platform.python_version(), #sys.version.split()[0],
+                    'platform' : platform.platform(),
+                    'e-type' : e_type,
+                    'e-value' : e_value,
+                    'date' : time.ctime(),
+                    'cwd' : os.getcwd(),
+                    }
+                if e_traceback:
+                    info['traceback'] = ''.join(traceback.format_tb(e_traceback)) + '%s: %s' % (e_type, e_value)
+                    last_tb = get_last_traceback(e_traceback)
+                    exception_locals = last_tb.tb_frame.f_locals # the locals at the level of the stack trace where the exception actually occurred
+                    info['locals'] = format_namespace(exception_locals)
+                    if 'self' in exception_locals:
+                        info['self'] = format_namespace(exception_locals['self'].__dict__)
+                
+                output = open(path+os.sep+"bug_report_"+info['date'].replace(':','-').replace(' ','_')+".txt",'w')
+                lst = info.keys()
+                lst.sort()
+                for a in lst:
+                    output.write(a+":\n"+str(info[a])+"\n\n")
+
+    #sys.excepthook = lambda *args: wx.CallAfter(handle_exception, *args)
+    sys.excepthook = handle_exception
+
+if __name__ == '__main__':
+    app = wxPySimpleApp()
+    wxInitAllImageHandlers()
+    
+    # Install a exception handle for bug reports
+    wxAddExceptHook(os.getcwd(),__version__)
+    
+    frame = networkedit(None)
+
+    frame.Show()
+    app.MainLoop()
--- a/objdictgen/node.py	Fri May 25 23:57:17 2007 +0200
+++ b/objdictgen/node.py	Mon May 28 18:08:24 2007 +0200
@@ -23,6 +23,7 @@
 
 import cPickle
 from types import *
+import re
 
 """
 Dictionary of translation between access symbol and their signification
@@ -204,7 +205,7 @@
                  {"name" : "Node ID of the SDO Server", "type" : 0x04, "access" : 'rw', "pdo" : False}]},
     0x1400 : {"name" : "Receive PDO %d Parameter[(idx)]", "struct" : pluriarray, "incr" : 1, "nbmax" : 0x200, "need" : False, "values" :
                 [{"name" : "Highest SubIndex Supported", "type" : 0x05, "access" : 'ro', "pdo" : False},
-                 {"name" : "COB ID used by PDO", "type" : 0x07, "access" : 'rw', "pdo" : False},
+                 {"name" : "COB ID used by PDO", "type" : 0x07, "access" : 'rw', "pdo" : False, "default" : "{True:self.ID+(base+2)*0x100,False:0}[base<4]"},
                  {"name" : "Transmission Type", "type" : 0x05, "access" : 'rw', "pdo" : False},
                  {"name" : "Inhibit Time", "type" : 0x06, "access" : 'rw', "pdo" : False},
                  {"name" : "Compatibility Entry", "type" : 0x05, "access" : 'rw', "pdo" : False},
@@ -214,7 +215,7 @@
                  {"name" : "PDO %d Mapping for an application object %d[(idx,sub)]", "type" : 0x07, "access" : 'rw', "pdo" : False, "nbmax" : 0x40}]},
     0x1800 : {"name" : "Transmit PDO %d Parameter[(idx)]", "struct" : pluriarray, "incr" : 1, "nbmax" : 0x200, "need" : False, "values" :
                 [{"name" : "Highest SubIndex Supported", "type" : 0x05, "access" : 'ro', "pdo" : False},
-                 {"name" : "COB ID used by PDO", "type" : 0x07, "access" : 'rw', "pdo" : False},
+                 {"name" : "COB ID used by PDO", "type" : 0x07, "access" : 'rw', "pdo" : False, "default" : "{True:self.ID+(base+1)*0x100+0x80,False:0}[base<4]"},
                  {"name" : "Transmission Type", "type" : 0x05, "access" : 'rw', "pdo" : False},
                  {"name" : "Inhibit Time", "type" : 0x06, "access" : 'rw', "pdo" : False},
                  {"name" : "Compatibility Entry", "type" : 0x05, "access" : 'rw', "pdo" : False},
@@ -225,6 +226,161 @@
 }
 
 #-------------------------------------------------------------------------------
+#                         Search in a Mapping Dictionary
+#-------------------------------------------------------------------------------
+
+"""
+Return the index of the typename given by searching in mappingdictionary 
+"""
+def FindTypeIndex(typename, mappingdictionary):
+    testdic = {}
+    for index, values in mappingdictionary.iteritems():
+        if index < 0x1000:
+            testdic[values["name"]] = index
+    if typename in testdic:
+        return testdic[typename]
+    return None
+
+"""
+Return the name of the type by searching in mappingdictionary 
+"""
+def FindTypeName(typeindex, mappingdictionary):
+    if typeindex < 0x1000 and typeindex in mappingdictionary:
+        return mappingdictionary[typeindex]["name"]
+    return None
+
+"""
+Return the default value of the type by searching in mappingdictionary 
+"""
+def FindTypeDefaultValue(typeindex, mappingdictionary):
+    if typeindex < 0x1000 and typeindex in mappingdictionary:
+        return mappingdictionary[typeindex]["default"]
+    return None
+
+"""
+Return the list of types defined in mappingdictionary 
+"""
+def FindTypeList(mappingdictionary):
+    list = []
+    for index in mappingdictionary.keys():
+        if index < 0x1000:
+            list.append(mappingdictionary[index]["name"])
+    return list
+
+"""
+Return the name of an entry by searching in mappingdictionary 
+"""
+def FindEntryName(index, mappingdictionary):
+    base_index = FindIndex(index, mappingdictionary)
+    if base_index:
+        infos = mappingdictionary[base_index]
+        if infos["struct"] & OD_IdenticalIndexes:
+            return StringFormat(infos["name"], (index - base_index) / infos["incr"] + 1, 0)
+        else:
+            return infos["name"]
+    return None
+
+"""
+Return the informations of one entry by searching in mappingdictionary 
+"""
+def FindEntryInfos(index, mappingdictionary):
+    base_index = FindIndex(index, mappingdictionary)
+    if base_index:
+        copy = mappingdictionary[base_index].copy()
+        if copy["struct"] & OD_IdenticalIndexes:
+            copy["name"] = StringFormat(copy["name"], (index - base_index) / copy["incr"] + 1, 0)
+        copy.pop("values")
+        return copy
+    return None
+
+"""
+Return the informations of one subentry of an entry by searching in mappingdictionary 
+"""
+def FindSubentryInfos(index, subIndex, mappingdictionary):
+    base_index = FindIndex(index, mappingdictionary)
+    if base_index:
+        struct = mappingdictionary[base_index]["struct"]
+        if struct & OD_Subindex:
+            if struct & OD_IdenticalSubindexes:
+                if struct & OD_IdenticalIndexes:
+                    incr = mappingdictionary[base_index]["incr"]
+                else:
+                    incr = 1
+                if subIndex == 0:
+                    return mappingdictionary[base_index]["values"][0].copy()
+                elif 0 < subIndex <= mappingdictionary[base_index]["values"][1]["nbmax"]:
+                    copy = mappingdictionary[base_index]["values"][1].copy()
+                    copy["name"] = StringFormat(copy["name"], (index - base_index) / incr + 1, subIndex)
+                    return copy
+            elif struct & OD_MultipleSubindexes and 0 <= subIndex < len(mappingdictionary[base_index]["values"]):
+                return mappingdictionary[base_index]["values"][subIndex].copy()
+            elif subIndex == 0:
+                return mappingdictionary[base_index]["values"][0].copy()
+    return None
+
+"""
+Return the list of variables that can be mapped defined in mappingdictionary 
+"""
+def FindMapVariableList(mappingdictionary, Node):
+    list = []
+    for index in mappingdictionary.iterkeys():
+        if Node.IsEntry(index):
+            for subIndex, values in enumerate(mappingdictionary[index]["values"]):
+                if mappingdictionary[index]["values"][subIndex]["pdo"]:
+                    infos = Node.GetEntryInfos(mappingdictionary[index]["values"][subIndex]["type"])
+                    if mappingdictionary[index]["struct"] & OD_IdenticalSubindexes:
+                        values = Node.GetEntry(index)
+                        for i in xrange(len(values) - 1):
+                            list.append((index, i + 1, infos["size"], StringFormat(mappingdictionary[index]["values"][subIndex]["name"],1,i+1)))
+                    else:
+                        list.append((index, subIndex, infos["size"], mappingdictionary[index]["values"][subIndex]["name"]))
+    return list
+
+"""
+Return the list of mandatory indexes defined in mappingdictionary 
+"""
+def FindMandatoryIndexes(mappingdictionary):
+    list = []
+    for index in mappingdictionary.iterkeys():
+        if index >= 0x1000 and mappingdictionary[index]["need"]:
+            list.append(index)
+    return list
+
+"""
+Return the index of the informations in the Object Dictionary in case of identical
+indexes
+"""
+def FindIndex(index, mappingdictionary):
+    if index in mappingdictionary:
+        return index
+    else:
+        listpluri = [idx for idx in mappingdictionary.keys() if mappingdictionary[idx]["struct"] & OD_IdenticalIndexes]
+        listpluri.sort()
+        for idx in listpluri:
+            nb_max = mappingdictionary[idx]["nbmax"]
+            incr = mappingdictionary[idx]["incr"]
+            if idx < index < idx + incr * nb_max and (index - idx)%incr == 0:
+                return idx
+    return None
+
+#-------------------------------------------------------------------------------
+#                           Formating Name of an Entry
+#-------------------------------------------------------------------------------
+
+name_model = re.compile('(.*)\[(.*)\]')
+
+"""
+Format the text given with the index and subindex defined
+"""
+def StringFormat(text, idx, sub):
+    result = name_model.match(text)
+    if result:
+        format = result.groups()
+        return format[0]%eval(format[1])
+    else:
+        return text
+
+#-------------------------------------------------------------------------------
 #                          Definition of Node Object
 #-------------------------------------------------------------------------------
 
@@ -449,9 +605,11 @@
     """
     Check if an entry exists in the Object Dictionary and returns the answer.
     """
-    def IsEntry(self, index):
+    def IsEntry(self, index, subIndex = None):
         if index in self.Dictionary:
-            return True
+            if not subIndex:
+                return True
+            return subIndex <= len(self.Dictionary[index])
         return False
     
     """
@@ -463,7 +621,8 @@
             if subIndex == None:
                 if type(self.Dictionary[index]) == ListType:
                     values = [len(self.Dictionary[index])]
-                    values.extend(self.Dictionary[index])
+                    for value in self.Dictionary[index]:
+                        values.append(self.CompileValue(value, index))
                     return values
                 else:
                     return self.Dictionary[index]
@@ -471,9 +630,9 @@
                 if type(self.Dictionary[index]) == ListType:
                     return len(self.Dictionary[index])
                 else:
-                    return self.Dictionary[index]
+                    return self.CompileValue(self.Dictionary[index], index)
             elif type(self.Dictionary[index]) == ListType and 0 < subIndex <= len(self.Dictionary[index]):
-                return self.Dictionary[index][subIndex - 1]
+                return self.CompileValue(self.Dictionary[index][subIndex - 1], index)
         return None
 
     """
@@ -594,7 +753,7 @@
                 return True
         return False
 
-    def RemoveMapVariable(self, index, subIndex):
+    def RemoveMapVariable(self, index, subIndex = None):
         model = index << 16
         mask = 0xFFFF << 16
         if subIndex:
@@ -656,3 +815,173 @@
         listindex.sort()
         for index in listindex:
             print "%04X : %s"%(index, self.Dictionary[index])    
+
+    def CompileValue(self, value, index):
+        if type(value) == StringType and value.find("self.ID") != -1:
+            base = self.GetBaseIndex(index)
+            try:
+                return eval(value)
+            except:
+                return 0
+        else:
+            return value
+
+#-------------------------------------------------------------------------------
+#                         Node Informations Functions
+#-------------------------------------------------------------------------------
+
+    def GetBaseIndex(self, index):
+        for mapping in self.GetMappings():
+            result = FindIndex(index, mapping)
+            if result != None:
+                return (index - result) / mapping[result]["incr"]
+        result = FindIndex(index, MappingDictionary)
+        if result != None:
+            return (index - result) / MappingDictionary[result]["incr"]
+        return 0
+
+    def GetCustomisedTypeValues(self, index):
+        values = self.GetEntry(index)
+        customisabletypes = self.GetCustomisableTypes()
+        return values, customisabletypes[values[1]][1]
+
+    def GetEntryName(self, index):
+        result = None
+        mappings = self.GetMappings()
+        i = 0
+        while not result and i < len(mappings):
+            result = FindEntryName(index, mappings[i])
+            i += 1
+        if result == None:
+            result = FindEntryName(index, MappingDictionary)
+        return result
+    
+    def GetEntryInfos(self, index):
+        result = None
+        mappings = self.GetMappings()
+        i = 0
+        while not result and i < len(mappings):
+            result = FindEntryInfos(index, mappings[i])
+            i += 1
+        if result == None:
+            result = FindEntryInfos(index, MappingDictionary)
+        return result
+    
+    def GetSubentryInfos(self, index, subIndex):
+        result = None
+        mappings = self.GetMappings()
+        i = 0
+        while not result and i < len(mappings):
+            result = FindSubentryInfos(index, subIndex, mappings[i])
+            if result:
+                result["user_defined"] = i == len(mappings) - 1 and index >= 0x1000
+            i += 1
+        if result == None:
+            result = FindSubentryInfos(index, subIndex, MappingDictionary)
+            if result:
+                result["user_defined"] = False
+        return result
+    
+    def GetTypeIndex(self, typename):
+        result = None
+        mappings = self.GetMappings()
+        i = 0
+        while not result and i < len(mappings):
+            result = FindTypeIndex(typename, mappings[i])
+            i += 1
+        if result == None:
+            result = FindTypeIndex(typename, MappingDictionary)
+        return result
+    
+    def GetTypeName(self, typeindex):
+        result = None
+        mappings = self.GetMappings()
+        i = 0
+        while not result and i < len(mappings):
+            result = FindTypeName(typeindex, mappings[i])
+            i += 1
+        if result == None:
+            result = FindTypeName(typeindex, MappingDictionary)
+        return result
+    
+    def GetTypeDefaultValue(self, typeindex):
+        result = None
+        mappings = self.GetMappings()
+        i = 0
+        while not result and i < len(mappings):
+            result = FindTypeDefaultValue(typeindex, mappings[i])
+            i += 1
+        if result == None:
+            result = FindTypeDefaultValue(typeindex, MappingDictionary)
+        return result
+    
+    def GetMapVariableList(self):
+        list = FindMapVariableList(MappingDictionary, self)
+        for mapping in self.GetMappings():
+            list.extend(FindMapVariableList(mapping, self))
+        list.sort()
+        return list
+    
+    def GetMandatoryIndexes(self, node = None):
+        list = FindMandatoryIndexes(MappingDictionary)
+        for mapping in self.GetMappings():
+            list.extend(FindMandatoryIndexes(mapping))
+        return list
+    
+    def GetCustomisableTypes(self):
+        dic = {}
+        for index, valuetype in CustomisableTypes:
+            name = self.GetTypeName(index)
+            dic[index] = [name, valuetype]
+        return dic
+
+#-------------------------------------------------------------------------------
+#                            Type and Map Variable Lists
+#-------------------------------------------------------------------------------
+    
+    def GetTypeList(self):
+        list = FindTypeList(MappingDictionary)
+        for mapping in self.GetMappings():
+            list.extend(FindTypeList(mapping))
+        list.sort()
+        return ",".join(list)
+
+    """
+    Generate the list of variables that can be mapped for the current node
+    """
+    def GenerateMapList(self):
+        self.MapList = "None"
+        self.NameTranslation = {"None" : "00000000"}
+        self.MapTranslation = {"00000000" : "None"}
+        list = self.GetMapVariableList()
+        for index, subIndex, size, name in list:
+            self.MapList += ",%s"%name
+            map = "%04X%02X%02X"%(index,subIndex,size)
+            self.NameTranslation[name] = map
+            self.MapTranslation[map] = name
+
+    def GetMapValue(self, mapname):
+        if mapname == "None":
+            return 0
+        else:
+            list = self.GetMapVariableList()
+            for index, subIndex, size, name in list:
+                if mapname == name:
+                    return (index << 16) + (subIndex << 8) + size
+            return None
+    
+    def GetMapName(self, value):
+        if value != 0:
+            index = value >> 16
+            subindex = (value >> 8) % (1 << 8)
+            result = self.GetSubentryInfos(index, subindex)
+            if result:
+                return result["name"]
+        return "None"
+    
+    """
+    Return the list of variables that can be mapped for the current node
+    """
+    def GetMapList(self):
+        list = ["None"] + [name for index, subIndex, size, name in self.GetMapVariableList()]
+        return ",".join(list)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/objdictgen/nodelist.py	Mon May 28 18:08:24 2007 +0200
@@ -0,0 +1,278 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+#This file is part of CanFestival, a library implementing CanOpen Stack. 
+#
+#Copyright (C): Edouard TISSERANT, Francis DUPIN and Laurent BESSARD
+#
+#See COPYING file for copyrights details.
+#
+#This library is free software; you can redistribute it and/or
+#modify it under the terms of the GNU Lesser General Public
+#License as published by the Free Software Foundation; either
+#version 2.1 of the License, or (at your option) any later version.
+#
+#This library is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#Lesser General Public License for more details.
+#
+#You should have received a copy of the GNU Lesser General Public
+#License along with this library; if not, write to the Free Software
+#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+from gnosis.xml.pickle import *
+from gnosis.xml.pickle.util import setParanoia
+setParanoia(0)
+
+from node import *
+import eds_utils
+import os, shutil
+
+#-------------------------------------------------------------------------------
+#                          Definition of NodeList Object
+#-------------------------------------------------------------------------------
+
+"""
+Class recording a node list for a CANOpen network.
+"""
+
+class NodeList:
+    
+    def __init__(self, manager):
+        self.Root = ""
+        self.Manager = manager
+        self.NetworkName = ""
+        self.SlaveNodes = {}
+        self.EDSNodes = {}
+        self.CurrentSelected = None
+    
+    def GetNetworkName(self):
+        return self.NetworkName
+    
+    def SetNetworkName(self, name):
+        self.NetworkName = name
+    
+    def GetManager(self):
+        return self.Manager
+    
+    def GetRoot(self):
+        return self.Root
+    
+    def GetSlaveNumber(self):
+        return len(self.SlaveNodes)
+    
+    def GetSlaveNames(self):
+        nodes = self.SlaveNodes.keys()
+        nodes.sort()
+        return ["0x%2.2X %s"%(idx, self.SlaveNodes[idx]["Name"]) for idx in nodes]
+    
+    def GetSlaveIDs(self):
+        nodes = self.SlaveNodes.keys()
+        nodes.sort()
+        return nodes
+        
+    def SetCurrentSelected(self, selected):
+        self.CurrentSelected = selected
+        
+    def GetCurrentSelected(self):
+        return self.CurrentSelected
+            
+    def LoadProject(self, root):
+        self.SlaveNodes = {}
+        self.EDSNodes = {}
+        
+        self.Root = root
+        if not os.path.exists(self.Root):
+            return "\"%s\" folder doesn't exist"%self.Root
+        
+        self.EDSFolder = os.path.join(self.Root, "eds")
+        if not os.path.exists(self.EDSFolder):
+            return "\"%s\" folder doesn't contain a \"eds\" folder"%self.Root
+        
+        files = os.listdir(self.EDSFolder)
+        for file in files:
+            result = self.LoadEDS(file)
+            if result != None:
+                return result
+                
+        result = self.LoadMasterNode()
+        if result != None:
+            return result
+            
+        result = self.LoadSlaveNodes()
+        if result != None:
+            return result
+    
+    def SaveProject(self):
+        result = self.SaveMasterNode()
+        if result != None:
+            return result
+            
+        result = self.SaveNodeList()
+        if result != None:
+            return result
+    
+    def ImportEDSFile(self, edspath):
+        dir, file = os.path.split(edspath)
+        eds = os.path.join(self.EDSFolder, file)
+        if os.path.isfile(eds):
+            return "EDS file already imported"
+        else:
+            shutil.copy(edspath, self.EDSFolder)
+            return self.LoadEDS(file)
+    
+    def LoadEDS(self, eds):
+        edspath = os.path.join(self.EDSFolder, eds)
+        node = eds_utils.GenerateNode(edspath, self.Manager.ScriptDirectory)
+        if isinstance(node, Node):
+            self.EDSNodes[eds] = node
+            return None
+        else:
+            return node
+    
+    def AddSlaveNode(self, nodeName, nodeID, eds):
+        if eds in self.EDSNodes.keys():
+            slave = {"Name" : nodeName, "EDS" : eds, "Node" : self.EDSNodes[eds]}
+            self.SlaveNodes[nodeID] = slave
+            return None
+        else:
+            return "\"%s\" EDS file is not available"%eds
+    
+    def RemoveSlaveNode(self, index):
+        if index in self.SlaveNodes.keys():
+            self.SlaveNodes.pop(index)
+            return None
+        else:
+            return "Node with \"0x%2.2X\" ID doesn't exist"
+    
+    def LoadMasterNode(self):
+        masterpath = os.path.join(self.Root, "master.od")
+        if os.path.isfile(masterpath):
+            self.Manager.OpenFileInCurrent(masterpath)
+        else:
+            self.Manager.CreateNewNode("MasterNode", 0x00, "master", "", "None", "", "heartbeat", ["DS302"])
+        return None
+    
+    def SaveMasterNode(self):
+        masterpath = os.path.join(self.Root, "master.od")
+        if self.Manager.SaveCurrentInFile(masterpath):
+            return None
+        else:
+            return "Fail to save Master Node"
+    
+    def LoadSlaveNodes(self):
+        cpjpath = os.path.join(self.Root, "nodelist.cpj")
+        if os.path.isfile(cpjpath):
+            try:
+                networks = eds_utils.ParseCPJFile(cpjpath)
+                if len(networks) > 0:
+                    self.NetworkName = networks[0]["Name"]
+                    for nodeid, node in networks[0]["Nodes"].items():
+                        if node["Present"] == 1:
+                            result = self.AddSlaveNode(node["Name"], nodeid, node["DCFName"])
+                            if result != None:
+                                return result
+            except SyntaxError, message:
+                return "Unable to load CPJ file\n%s"%message
+        return None
+    
+    def SaveNodeList(self):
+        cpjpath = os.path.join(self.Root, "nodelist.cpj")
+        content = eds_utils.GenerateCPJContent(self)
+        file = open(cpjpath, "w")
+        file.write(content)
+        file.close()
+    
+    def GetSlaveNodeEntry(self, nodeid, index, subindex = None):
+        if nodeid in self.SlaveNodes.keys():
+            self.SlaveNodes[nodeid]["Node"].SetNodeID(nodeid)
+            return self.SlaveNodes[nodeid]["Node"].GetEntry(index, subindex)
+        else:
+            return "Node 0x%2.2X doesn't exist"%nodeid
+
+    def GetMasterNodeEntry(self, index, subindex = None):
+        return self.Manager.GetCurrentEntry(index, subindex)
+        
+    def SetMasterNodeEntry(self, index, subindex = None, value = None):
+        self.Manager.SetCurrentEntry(index, subindex, value)
+    
+    def GetOrderNumber(self, nodeid):
+        nodeindexes = self.SlaveNodes.keys()
+        nodeindexes.sort()
+        return nodeindexes.index(nodeid) + 1
+    
+    def GetNodeByOrder(self, order):
+        if order > 0:
+            nodeindexes = self.SlaveNodes.keys()
+            nodeindexes.sort()
+            print nodeindexes
+            if order <= len(nodeindexes):
+                return self.SlaveNodes[nodeindexes[order - 1]]["Node"]
+        return None
+    
+    def IsCurrentEntry(self, index):
+        if self.CurrentSelected != None:
+            if self.CurrentSelected == 0:
+                return self.Manager.IsCurrentEntry(index)
+            else:
+                node = self.SlaveNodes[self.CurrentSelected]["Node"]
+                if node:
+                    return node.IsEntry(index)
+        return False
+    
+    def GetEntryInfos(self, index):
+        if self.CurrentSelected != None:
+            if self.CurrentSelected == 0:
+                return self.Manager.GetEntryInfos(index)
+            else:
+                node = self.SlaveNodes[self.CurrentSelected]["Node"]
+                if node:
+                    return node.GetEntryInfos(index)
+        return None
+
+    def GetCurrentValidIndexes(self, min, max):
+        if self.CurrentSelected != None:
+            if self.CurrentSelected == 0:
+                return self.Manager.GetCurrentValidIndexes(min, max)
+            else:
+                node = self.SlaveNodes[self.CurrentSelected]["Node"]
+                if node:
+                    validindexes = []
+                    for index in node.GetIndexes():
+                        if min <= index <= max:
+                            validindexes.append((node.GetEntryName(index), index))
+                    return validindexes
+                else:
+                    print "Can't find node"
+        return []
+    
+    def GetCurrentEntryValues(self, index):
+        if self.CurrentSelected != None:
+            node = self.SlaveNodes[self.CurrentSelected]["Node"]
+            if node:
+                return self.Manager.GetNodeEntryValues(node, index)
+            else:
+                print "Can't find node"
+        return [], []
+    
+if __name__ == "__main__":
+    from nodemanager import *
+    import os, sys, shutil
+    
+    manager = NodeManager(sys.path[0])
+    
+    nodelist = NodeList(manager)
+    
+    result = nodelist.LoadProject("/home/laurent/test_nodelist")
+    if result != None:
+        print result
+    else:
+        print "MasterNode :"
+        manager.CurrentNode.Print()
+        print 
+        for nodeid, node in nodelist.SlaveNodes.items():
+            print "SlaveNode name=%s id=0x%2.2X :"%(node["Name"], nodeid)
+            node["Node"].Print()
+            print
+
--- a/objdictgen/nodemanager.py	Fri May 25 23:57:17 2007 +0200
+++ b/objdictgen/nodemanager.py	Mon May 28 18:08:24 2007 +0200
@@ -35,164 +35,15 @@
 
 type_model = re.compile('([\_A-Z]*)([0-9]*)')
 range_model = re.compile('([\_A-Z]*)([0-9]*)\[([\-0-9]*)-([\-0-9]*)\]')
-name_model = re.compile('(.*)\[(.*)\]')
-
-def IsOfType(object, typedef):
-    return type(object) == typedef
-
-#-------------------------------------------------------------------------------
-#                           Formating Name of an Entry
-#-------------------------------------------------------------------------------
-
-"""
-Format the text given with the index and subindex defined
-"""
-def StringFormat(text, idx, sub):
-    result = name_model.match(text)
-    if result:
-        format = result.groups()
-        return format[0]%eval(format[1])
-    else:
-        return text
-
-#-------------------------------------------------------------------------------
-#                         Search in a Mapping Dictionary
-#-------------------------------------------------------------------------------
-
-"""
-Return the index of the informations in the Object Dictionary in case of identical
-indexes
-"""
-def FindIndex(index, mappingdictionary):
-    if index in mappingdictionary:
-        return index
-    else:
-        listpluri = [idx for idx in mappingdictionary.keys() if mappingdictionary[idx]["struct"] & OD_IdenticalIndexes]
-        listpluri.sort()
-        for idx in listpluri:
-            nb_max = mappingdictionary[idx]["nbmax"]
-            incr = mappingdictionary[idx]["incr"]
-            if idx < index < idx + incr * nb_max and (index - idx)%incr == 0:
-                return idx
-    return None
-
-"""
-Return the index of the typename given by searching in mappingdictionary 
-"""
-def FindTypeIndex(typename, mappingdictionary):
-    testdic = {}
-    for index, values in mappingdictionary.iteritems():
-        if index < 0x1000:
-            testdic[values["name"]] = index
-    if typename in testdic:
-        return testdic[typename]
-    return None
-
-"""
-Return the name of the type by searching in mappingdictionary 
-"""
-def FindTypeName(typeindex, mappingdictionary):
-    if typeindex < 0x1000 and typeindex in mappingdictionary:
-        return mappingdictionary[typeindex]["name"]
-    return None
-
-"""
-Return the default value of the type by searching in mappingdictionary 
-"""
-def FindTypeDefaultValue(typeindex, mappingdictionary):
-    if typeindex < 0x1000 and typeindex in mappingdictionary:
-        return mappingdictionary[typeindex]["default"]
-    return None
-
-"""
-Return the list of types defined in mappingdictionary 
-"""
-def FindTypeList(mappingdictionary):
-    list = []
-    for index in mappingdictionary.keys():
-        if index < 0x1000:
-            list.append((index, mappingdictionary[index]["name"]))
-    return list
-
-"""
-Return the name of an entry by searching in mappingdictionary 
-"""
-def FindEntryName(index, mappingdictionary):
-    base_index = FindIndex(index, mappingdictionary)
-    if base_index:
-        infos = mappingdictionary[base_index]
-        if infos["struct"] & OD_IdenticalIndexes:
-            return StringFormat(infos["name"], (index - base_index) / infos["incr"] + 1, 0)
-        else:
-            return infos["name"]
-    return None
-
-"""
-Return the informations of one entry by searching in mappingdictionary 
-"""
-def FindEntryInfos(index, mappingdictionary):
-    base_index = FindIndex(index, mappingdictionary)
-    if base_index:
-        copy = mappingdictionary[base_index].copy()
-        if copy["struct"] & OD_IdenticalIndexes:
-            copy["name"] = StringFormat(copy["name"], (index - base_index) / copy["incr"] + 1, 0)
-        copy.pop("values")
-        return copy
-    return None
-
-"""
-Return the informations of one subentry of an entry by searching in mappingdictionary 
-"""
-def FindSubentryInfos(index, subIndex, mappingdictionary):
-    base_index = FindIndex(index, mappingdictionary)
-    if base_index:
-        struct = mappingdictionary[base_index]["struct"]
-        if struct & OD_Subindex:
-            if struct & OD_IdenticalSubindexes:
-                if struct & OD_IdenticalIndexes:
-                    incr = mappingdictionary[base_index]["incr"]
-                else:
-                    incr = 1
-                if subIndex == 0:
-                    return mappingdictionary[base_index]["values"][0].copy()
-                elif 0 < subIndex <= mappingdictionary[base_index]["values"][1]["nbmax"]:
-                    copy = mappingdictionary[base_index]["values"][1].copy()
-                    copy["name"] = StringFormat(copy["name"], (index - base_index) / incr + 1, subIndex)
-                    return copy
-            elif struct & OD_MultipleSubindexes and 0 <= subIndex < len(mappingdictionary[base_index]["values"]):
-                return mappingdictionary[base_index]["values"][subIndex].copy()
-            elif subIndex == 0:
-                return mappingdictionary[base_index]["values"][0].copy()
-    return None
-
-"""
-Return the list of variables that can be mapped defined in mappingdictionary 
-"""
-def FindMapVariableList(mappingdictionary, Manager):
-    list = []
-    for index in mappingdictionary.iterkeys():
-        if Manager.IsCurrentEntry(index):
-            for subIndex, values in enumerate(mappingdictionary[index]["values"]):
-                if mappingdictionary[index]["values"][subIndex]["pdo"]:
-                    infos = Manager.GetEntryInfos(mappingdictionary[index]["values"][subIndex]["type"])
-                    if mappingdictionary[index]["struct"] & OD_IdenticalSubindexes:
-                        values = Manager.GetCurrentEntry(index)
-                        for i in xrange(len(values) - 1):
-                            list.append((index, i + 1, infos["size"], StringFormat(mappingdictionary[index]["values"][subIndex]["name"],1,i+1)))
-                    else:
-                        list.append((index, subIndex, infos["size"], mappingdictionary[index]["values"][subIndex]["name"]))
-    return list
-
-"""
-Return the list of mandatory indexes defined in mappingdictionary 
-"""
-def FindMandatoryIndexes(mappingdictionary):
-    list = []
-    for index in mappingdictionary.iterkeys():
-        if index >= 0x1000 and mappingdictionary[index]["need"]:
-            list.append(index)
-    return list
-
+
+# ID for the file viewed
+CurrentID = 0
+
+# Returns a new id
+def GetNewId():
+    global CurrentID
+    CurrentID += 1
+    return CurrentID
 
 """
 Class implementing a buffer of changes made on the current editing Object Dictionary
@@ -301,55 +152,34 @@
     """
     def __init__(self, cwd):
         self.LastNewIndex = 0
-        self.FilePaths = []
-        self.FileNames = []
-        self.NodeIndex = -1
+        self.FilePaths = {}
+        self.FileNames = {}
+        self.NodeIndex = None
         self.CurrentNode = None
         self.ScriptDirectory = cwd
-        self.UndoBuffers = []
+        self.UndoBuffers = {}
 
 #-------------------------------------------------------------------------------
 #                         Type and Map Variable Lists
 #-------------------------------------------------------------------------------
-
-    """
-    Generate the list of types defined for the current node
-    """
-    def GenerateTypeList(self):
-        self.TypeList = ""
-        self.TypeTranslation = {}
-        list = self.GetTypeList()
-        sep = ""
-        for index, name in list:
-            self.TypeList += "%s%s"%(sep,name)
-            self.TypeTranslation[name] = index
-            sep = ","
-    
-    """
-    Generate the list of variables that can be mapped for the current node
-    """
-    def GenerateMapList(self):
-        self.MapList = "None"
-        self.NameTranslation = {"None" : "00000000"}
-        self.MapTranslation = {"00000000" : "None"}
-        list = self.GetMapVariableList()
-        for index, subIndex, size, name in list:
-            self.MapList += ",%s"%name
-            map = "%04X%02X%02X"%(index,subIndex,size)
-            self.NameTranslation[name] = map
-            self.MapTranslation[map] = name
     
     """
     Return the list of types defined for the current node
     """
     def GetCurrentTypeList(self):
-        return self.TypeList
+        if self.CurrentNode:
+            return self.CurrentNode.GetTypeList()
+        else:
+            return ""
 
     """
     Return the list of variables that can be mapped for the current node
     """
     def GetCurrentMapList(self):
-        return self.MapList
+        if self.CurrentNode:
+            return self.CurrentNode.GetMapList()
+        else:
+            return ""
 
 #-------------------------------------------------------------------------------
 #                        Create Load and Save Functions
@@ -397,14 +227,11 @@
                 elif option == "StoreEDS":
                     AddIndexList.extend([0x1021, 0x1022])
             # Add a new buffer 
-            self.AddNodeBuffer()
+            index = self.AddNodeBuffer()
             self.SetCurrentFilePath("")
             # Add Mandatory indexes
             self.ManageEntriesOfCurrent(AddIndexList, [])
-            # Regenerate lists
-            self.GenerateTypeList()
-            self.GenerateMapList()
-            return True
+            return index
         else:
             return result
     
@@ -439,12 +266,9 @@
         file.close()
         self.CurrentNode = node
         # Add a new buffer and defining current state
-        self.AddNodeBuffer(self.CurrentNode.Copy(), True)
+        index = self.AddNodeBuffer(self.CurrentNode.Copy(), True)
         self.SetCurrentFilePath(filepath)
-        # Regenerate lists
-        self.GenerateTypeList()
-        self.GenerateMapList()
-        return True
+        return index
 
     """
     Save current node in  a file
@@ -479,16 +303,14 @@
     """
     def ImportCurrentFromEDSFile(self, filepath):
         # Generate node from definition in a xml file
-        result = eds_utils.GenerateNode(filepath, self, self.ScriptDirectory)
+        result = eds_utils.GenerateNode(filepath, self.ScriptDirectory)
         if isinstance(result, Node):
             self.CurrentNode = result
-            self.GenerateTypeList()
-            self.GenerateMapList()
             if len(self.UndoBuffers) == 0:
-                self.AddNodeBuffer()
+                index = self.AddNodeBuffer()
                 self.SetCurrentFilePath("")
             self.BufferCurrentNode()
-            return None
+            return index
         else:
             return result
     
@@ -705,30 +527,28 @@
                     self.CurrentNode.RemoveEntry(index, subIndex)
             if index in Mappings[-1]:
                 self.CurrentNode.RemoveMappingEntry(index, subIndex)
-            self.GenerateMapList()
 
     def AddMapVariableToCurrent(self, index, name, struct, number):
         if 0x2000 <= index <= 0x5FFF:
             if not self.CurrentNode.IsEntry(index):
                 self.CurrentNode.AddMappingEntry(index, name = name, struct = struct)
                 if struct == var:
-                    values = {"name" : name, "type" : 5, "access" : "rw", "pdo" : True}
+                    values = {"name" : name, "type" : 0x05, "access" : "rw", "pdo" : True}
                     self.CurrentNode.AddMappingEntry(index, 0, values = values)
                     self.CurrentNode.AddEntry(index, 0, 0)
                 else:
-                    values = {"name" : "Number of Entries", "type" : 2, "access" : "ro", "pdo" : False}
+                    values = {"name" : "Number of Entries", "type" : 0x05, "access" : "ro", "pdo" : False}
                     self.CurrentNode.AddMappingEntry(index, 0, values = values)
                     if struct == rec:
-                        values = {"name" : name + " %d[(sub)]", "type" : 5, "access" : "rw", "pdo" : True, "nbmax" : 0xFE}
+                        values = {"name" : name + " %d[(sub)]", "type" : 0x05, "access" : "rw", "pdo" : True, "nbmax" : 0xFE}
                         self.CurrentNode.AddMappingEntry(index, 1, values = values)
                         for i in xrange(number):
                             self.CurrentNode.AddEntry(index, i + 1, 0)
                     else:
                         for i in xrange(number):
-                            values = {"name" : "Undefined", "type" : 5, "access" : "rw", "pdo" : True}
+                            values = {"name" : "Undefined", "type" : 0x05, "access" : "rw", "pdo" : True}
                             self.CurrentNode.AddMappingEntry(index, i + 1, values = values)
                             self.CurrentNode.AddEntry(index, i + 1, 0)
-                self.GenerateMapList()
                 self.BufferCurrentNode()
                 return None
             else:
@@ -747,8 +567,8 @@
             default = self.GetTypeDefaultValue(type)
             if valuetype == 0:
                 self.CurrentNode.AddMappingEntry(index, name = "%s[%d-%d]"%(name, min, max), struct = 3, size = size, default = default)
-                self.CurrentNode.AddMappingEntry(index, 0, values = {"name" : "Number of Entries", "type" : 0x02, "access" : "ro", "pdo" : False})
-                self.CurrentNode.AddMappingEntry(index, 1, values = {"name" : "Type", "type" : 0x02, "access" : "ro", "pdo" : False})
+                self.CurrentNode.AddMappingEntry(index, 0, values = {"name" : "Number of Entries", "type" : 0x05, "access" : "ro", "pdo" : False})
+                self.CurrentNode.AddMappingEntry(index, 1, values = {"name" : "Type", "type" : 0x05, "access" : "ro", "pdo" : False})
                 self.CurrentNode.AddMappingEntry(index, 2, values = {"name" : "Minimum Value", "type" : type, "access" : "ro", "pdo" : False})
                 self.CurrentNode.AddMappingEntry(index, 3, values = {"name" : "Maximum Value", "type" : type, "access" : "ro", "pdo" : False})
                 self.CurrentNode.AddEntry(index, 1, type)
@@ -756,12 +576,11 @@
                 self.CurrentNode.AddEntry(index, 3, max)
             elif valuetype == 1:
                 self.CurrentNode.AddMappingEntry(index, name = "%s%d"%(name, length), struct = 3, size = length * size, default = default)
-                self.CurrentNode.AddMappingEntry(index, 0, values = {"name" : "Number of Entries", "type" : 0x02, "access" : "ro", "pdo" : False})
-                self.CurrentNode.AddMappingEntry(index, 1, values = {"name" : "Type", "type" : 0x02, "access" : "ro", "pdo" : False})
-                self.CurrentNode.AddMappingEntry(index, 2, values = {"name" : "Length", "type" : 0x02, "access" : "ro", "pdo" : False})
+                self.CurrentNode.AddMappingEntry(index, 0, values = {"name" : "Number of Entries", "type" : 0x05, "access" : "ro", "pdo" : False})
+                self.CurrentNode.AddMappingEntry(index, 1, values = {"name" : "Type", "type" : 0x05, "access" : "ro", "pdo" : False})
+                self.CurrentNode.AddMappingEntry(index, 2, values = {"name" : "Length", "type" : 0x05, "access" : "ro", "pdo" : False})
                 self.CurrentNode.AddEntry(index, 1, type)
                 self.CurrentNode.AddEntry(index, 2, length)
-            self.GenerateTypeList()
             self.BufferCurrentNode()
             return None
         else:
@@ -782,11 +601,9 @@
         if self.CurrentNode and self.CurrentNode.IsEntry(index):
             if name == "value":
                 if editor == "map":
-                    try:
-                        value = int(self.NameTranslation[value], 16)
+                    value = self.CurrentNode.GetMapValue(value)
+                    if value:
                         self.CurrentNode.SetEntry(index, subIndex, value)
-                    except:
-                        pass
                 elif editor == "bool":
                     value = value == "True"
                     self.CurrentNode.SetEntry(index, subIndex, value)
@@ -830,7 +647,7 @@
                     self.CurrentNode.SetParamsEntry(index, subIndex, comment = value)
             else:
                 if editor == "type":
-                    value = self.TypeTranslation[value]
+                    value = self.GetTypeIndex(value)
                     size = self.GetEntryInfos(value)["size"]
                     self.CurrentNode.UpdateMapVariable(index, subIndex, size)
                 elif editor in ["access","raccess"]:
@@ -844,8 +661,6 @@
                         self.CurrentNode.AddMappingEntry(index, 0, values = self.GetSubentryInfos(index, 0, False).copy())
                         self.CurrentNode.AddMappingEntry(index, 1, values = self.GetSubentryInfos(index, 1, False).copy())
                 self.CurrentNode.SetMappingEntry(index, subIndex, values = {name : value})
-                if name == "name" or editor == "type":
-                    self.GenerateMapList()
             self.BufferCurrentNode()
 
     def SetCurrentEntryName(self, index, name):
@@ -892,7 +707,7 @@
 
     def OneFileHasChanged(self):
         result = False
-        for buffer in self.UndoBuffers:
+        for buffer in self.UndoBuffers.values():
             result |= not buffer.IsCurrentSaved()
         return result
 
@@ -906,29 +721,21 @@
         self.CurrentNode = self.UndoBuffers[self.NodeIndex].Next().Copy()
 
     def AddNodeBuffer(self, currentstate = None, issaved = False):
-        self.NodeIndex = len(self.UndoBuffers)
-        self.UndoBuffers.append(UndoBuffer(currentstate, issaved))
-        self.FilePaths.append("")
-        self.FileNames.append("")
+        self.NodeIndex = GetNewId()
+        self.UndoBuffers[self.NodeIndex] = UndoBuffer(currentstate, issaved)
+        self.FilePaths[self.NodeIndex] = ""
+        self.FileNames[self.NodeIndex] = ""
+        return self.NodeIndex
 
     def ChangeCurrentNode(self, index):
-        if index < len(self.UndoBuffers):
+        if index in self.UndoBuffers.keys():
             self.NodeIndex = index
             self.CurrentNode = self.UndoBuffers[self.NodeIndex].Current().Copy()
-            self.GenerateTypeList()
-            self.GenerateMapList()
     
     def RemoveNodeBuffer(self, index):
         self.UndoBuffers.pop(index)
         self.FilePaths.pop(index)
         self.FileNames.pop(index)
-        self.NodeIndex = min(self.NodeIndex, len(self.UndoBuffers) - 1)
-        if len(self.UndoBuffers) > 0:
-            self.CurrentNode = self.UndoBuffers[self.NodeIndex].Current().Copy()
-            self.GenerateTypeList()
-            self.GenerateMapList()
-        else:
-            self.CurrentNode = None
     
     def GetCurrentNodeIndex(self):
         return self.NodeIndex
@@ -937,10 +744,9 @@
         return self.GetFilename(self.NodeIndex)
     
     def GetAllFilenames(self):
-        filenames = []
-        for i in xrange(len(self.UndoBuffers)):
-            filenames.append(self.GetFilename(i))
-        return filenames
+        indexes = self.UndoBuffers.keys()
+        indexes.sort()
+        return [self.GetFilename(idx) for idx in indexes]
     
     def GetFilename(self, index):
         if self.UndoBuffers[index].IsCurrentSaved():
@@ -1021,6 +827,18 @@
 #-------------------------------------------------------------------------------
 #                         Node State and Values Functions
 #-------------------------------------------------------------------------------
+    
+    def GetCurrentNodeName(self):
+        if self.CurrentNode:
+            return self.CurrentNode.GetNodeName()
+        else:
+            return ""
+
+    def GetCurrentNodeID(self):
+        if self.CurrentNode:
+            return self.CurrentNode.GetNodeID()
+        else:
+            return None
 
     def GetCurrentNodeInfos(self):
         name = self.CurrentNode.GetNodeName()
@@ -1092,12 +910,16 @@
         return False
     
     def GetCurrentEntryValues(self, index):
-        if self.CurrentNode and self.CurrentNode.IsEntry(index):
-            entry_infos = self.GetEntryInfos(index)
+        if self.CurrentNode:
+            return self.GetNodeEntryValues(self.CurrentNode, index)
+    
+    def GetNodeEntryValues(self, node, index):
+        if node and node.IsEntry(index):
+            entry_infos = node.GetEntryInfos(index)
             data = []
             editors = []
-            values = self.CurrentNode.GetEntry(index)
-            params = self.CurrentNode.GetParamsEntry(index)
+            values = node.GetEntry(index)
+            params = node.GetParamsEntry(index)
             if type(values) == ListType:
                 for i, value in enumerate(values):
                     data.append({"value" : value})
@@ -1106,10 +928,10 @@
                 data.append({"value" : values})
                 data[-1].update(params)
             for i, dic in enumerate(data):
-                infos = self.GetSubentryInfos(index, i)
+                infos = node.GetSubentryInfos(index, i)
                 dic["subindex"] = "0x%02X"%i
                 dic["name"] = infos["name"]
-                dic["type"] = self.GetTypeName(infos["type"])
+                dic["type"] = node.GetTypeName(infos["type"])
                 dic["access"] = AccessType[infos["access"]]
                 dic["save"] = OptionType[dic["save"]]
                 editor = {"subindex" : None, "save" : "option", "callback" : "option", "comment" : "string"}
@@ -1145,10 +967,10 @@
                     if index < 0x260:
                         editor["value"] = None
                         if i == 1:
-                            dic["value"] = self.GetTypeName(dic["value"])
+                            dic["value"] = node.GetTypeName(dic["value"])
                     elif 0x1600 <= index <= 0x17FF or 0x1A00 <= index <= 0x1C00:
                         editor["value"] = "map"
-                        dic["value"] = self.MapTranslation["%08X"%dic["value"]]
+                        dic["value"] = node.GetMapName(dic["value"])
                     else:
                         if dic["type"].startswith("VISIBLE_STRING"):
                             editor["value"] = "string"
@@ -1183,124 +1005,69 @@
             return data, editors
         else:
             return None
-    
+
 #-------------------------------------------------------------------------------
 #                         Node Informations Functions
 #-------------------------------------------------------------------------------
 
     def GetCustomisedTypeValues(self, index):
-        values = self.CurrentNode.GetEntry(index)
-        customisabletypes = self.GetCustomisableTypes()
-        return values, customisabletypes[values[1]][1]
-
-    def GetEntryName(self, index, node = None):
-        result = None
-        if node == None:
-            node = self.CurrentNode
-        NodeMappings = node.GetMappings()
-        i = 0
-        while not result and i < len(NodeMappings):
-            result = FindEntryName(index, NodeMappings[i])
-            i += 1
-        if result == None:
-            result = FindEntryName(index, MappingDictionary)
-        return result
-    
-    def GetEntryInfos(self, index, node = None):
-        result = None
-        if node == None:
-            node = self.CurrentNode
-        NodeMappings = node.GetMappings()
-        i = 0
-        while not result and i < len(NodeMappings):
-            result = FindEntryInfos(index, NodeMappings[i])
-            i += 1
-        if result == None:
-            result = FindEntryInfos(index, MappingDictionary)
-        return result
-    
-    def GetSubentryInfos(self, index, subIndex, node = None):
-        result = None
-        if node == None:
-            node = self.CurrentNode
-        NodeMappings = node.GetMappings()
-        i = 0
-        while not result and i < len(NodeMappings):
-            result = FindSubentryInfos(index, subIndex, NodeMappings[i])
-            if result:
-                result["user_defined"] = i == len(NodeMappings) - 1 and index >= 0x1000
-            i += 1
-        if result == None:    
-            result = FindSubentryInfos(index, subIndex, MappingDictionary)
+        if self.CurrentNode:
+            values = self.CurrentNode.GetEntry(index)
+            customisabletypes = self.GetCustomisableTypes()
+            return values, customisabletypes[values[1]][1]
+        else:
+            return None, None
+
+    def GetEntryName(self, index):
+        if self.CurrentNode:
+            return self.CurrentNode.GetEntryName(index)
+        else:
+            return FindEntryName(index, MappingDictionary)
+    
+    def GetEntryInfos(self, index):
+        if self.CurrentNode:
+            return self.CurrentNode.GetEntryInfos(index)
+        else:
+            return FindEntryInfos(index, MappingDictionary)
+    
+    def GetSubentryInfos(self, index, subindex):
+        if self.CurrentNode:
+            return self.CurrentNode.GetSubentryInfos(index, subindex)
+        else:
+            result = FindSubentryInfos(index, subindex, MappingDictionary)
             if result:
                 result["user_defined"] = False
-        return result
-    
-    def GetTypeIndex(self, typename, node = None):
-        result = None
-        if node == None:
-            node = self.CurrentNode
-        NodeMappings = node.GetMappings()
-        i = 0
-        while not result and i < len(NodeMappings):
-            result = FindTypeIndex(typename, NodeMappings[i])
-            i += 1
-        if result == None:
-            result = FindTypeIndex(typename, MappingDictionary)
-        return result
-    
-    def GetTypeName(self, typeindex, node = None):
-        result = None
-        if node == None:
-            node = self.CurrentNode
-        NodeMappings = node.GetMappings()
-        i = 0
-        while not result and i < len(NodeMappings):
-            result = FindTypeName(typeindex, NodeMappings[i])
-            i += 1
-        if result == None:
-            result = FindTypeName(typeindex, MappingDictionary)
-        return result
-    
-    def GetTypeDefaultValue(self, typeindex, node = None):
-        result = None
-        if node == None:
-            node = self.CurrentNode
-        if node:
-            NodeMappings = node.GetMappings()
-            i = 0
-            while not result and i < len(NodeMappings):
-                result = FindTypeDefaultValue(typeindex, NodeMappings[i])
-                i += 1
-        if result == None:
-            result = FindTypeDefaultValue(typeindex, MappingDictionary)
-        return result
-    
-    def GetTypeList(self, node = None):
-        list = FindTypeList(MappingDictionary)
-        if node == None:
-            node = self.CurrentNode
-        for NodeMapping in self.CurrentNode.GetMappings():
-            list.extend(FindTypeList(NodeMapping))
-        list.sort()
-        return list
-    
-    def GetMapVariableList(self, node = None):
-        list = FindMapVariableList(MappingDictionary, self)
-        if node == None:
-            node = self.CurrentNode
-        for NodeMapping in node.GetMappings():
-            list.extend(FindMapVariableList(NodeMapping, self))
-        list.sort()
-        return list
-    
+            return result
+    
+    def GetTypeIndex(self, typename):
+        if self.CurrentNode:
+            return self.CurrentNode.GetTypeIndex(typename)
+        else:
+            return FindTypeIndex(typename, MappingDictionary)
+    
+    def GetTypeName(self, typeindex):
+        if self.CurrentNode:
+            return self.CurrentNode.GetTypeName(typeindex)
+        else:
+            return FindTypeName(typeindex, MappingDictionary)
+    
+    def GetTypeDefaultValue(self, typeindex):
+        if self.CurrentNode:
+            return self.CurrentNode.GetTypeDefaultValue(typeindex)
+        else:
+            return FindTypeDefaultValue(typeindex, MappingDictionary)
+    
+    def GetMapVariableList(self):
+        if self.CurrentNode:
+            return self.CurrentNode.GetMapVariableList()
+        else:
+            return []
+
     def GetMandatoryIndexes(self, node = None):
-        list = FindMandatoryIndexes(MappingDictionary)
-        if node == None:
-            node = self.CurrentNode
-        for NodeMapping in node.GetMappings():
-            list.extend(FindMandatoryIndexes(NodeMapping))
-        return list
+        if self.CurrentNode:
+            return self.CurrentNode.GetMapVariableList()
+        else:
+            return FindMandatoryIndexes(MappingDictionary)
     
     def GetCustomisableTypes(self):
         dic = {}
--- a/objdictgen/objdictedit.py	Fri May 25 23:57:17 2007 +0200
+++ b/objdictgen/objdictedit.py	Mon May 28 18:08:24 2007 +0200
@@ -24,7 +24,6 @@
 from wxPython.wx import *
 from wxPython.grid import *
 import wx
-from wx.lib.anchors import LayoutAnchors
 import wx.grid
 
 from types import *
@@ -33,7 +32,8 @@
 __version__ = "$Revision$"
 
 from nodemanager import *
-from node import OD_Subindex,OD_MultipleSubindexes,OD_IdenticalSubindexes,OD_IdenticalIndexes
+from subindextable import *
+from commondialogs import *
 from doc_index.DS301_index import *
 
 try:
@@ -108,7 +108,7 @@
     return objdictedit(parent)
 
 def usage():
-    print "\nUsage of objectdict.py :"
+    print "\nUsage of objdictedit.py :"
     print "\n   %s [Filepath, ...]\n"%sys.argv[0]
 
 try:
@@ -126,663 +126,6 @@
 filesOpen = args
 ScriptDirectory = sys.path[0]
 
-ColSizes = [75, 250, 150, 125, 100, 60, 250]
-ColAlignements = [wxALIGN_CENTER, wxALIGN_LEFT, wxALIGN_CENTER, wxALIGN_RIGHT, wxALIGN_CENTER, wxALIGN_CENTER, wxALIGN_LEFT]
-AccessList = "Read Only,Write Only,Read/Write"
-RAccessList = "Read Only,Read/Write"
-BoolList = "True,False"
-OptionList = "Yes,No"
-
-DictionaryOrganisation = [
-    {"minIndex" : 0x0001, "maxIndex" : 0x0FFF, "name" : "Data Type Definitions"},
-    {"minIndex" : 0x1000, "maxIndex" : 0x1029, "name" : "Communication Parameters"},
-    {"minIndex" : 0x1200, "maxIndex" : 0x12FF, "name" : "SDO Parameters"},
-    {"minIndex" : 0x1400, "maxIndex" : 0x15FF, "name" : "Receive PDO Parameters"},
-    {"minIndex" : 0x1600, "maxIndex" : 0x17FF, "name" : "Receive PDO Mapping"},
-    {"minIndex" : 0x1800, "maxIndex" : 0x19FF, "name" : "Transmit PDO Parameters"},
-    {"minIndex" : 0x1A00, "maxIndex" : 0x1BFF, "name" : "Transmit PDO Mapping"},
-    {"minIndex" : 0x1C00, "maxIndex" : 0x1FFF, "name" : "Other Communication Parameters"},
-    {"minIndex" : 0x2000, "maxIndex" : 0x5FFF, "name" : "Manufacturer Specific"},
-    {"minIndex" : 0x6000, "maxIndex" : 0x9FFF, "name" : "Standardized Device Profile"},
-    {"minIndex" : 0xA000, "maxIndex" : 0xBFFF, "name" : "Standardized Interface Profile"}]
-
-class SubindexTable(wxPyGridTableBase):
-    
-    """
-    A custom wxGrid Table using user supplied data
-    """
-    def __init__(self, parent, data, editors, colnames):
-        # The base class must be initialized *first*
-        wxPyGridTableBase.__init__(self)
-        self.data = data
-        self.editors = editors
-        self.CurrentIndex = 0
-        self.colnames = colnames
-        self.Parent = parent
-        # XXX
-        # we need to store the row length and collength to
-        # see if the table has changed size
-        self._rows = self.GetNumberRows()
-        self._cols = self.GetNumberCols()
-    
-    def GetNumberCols(self):
-        return len(self.colnames)
-        
-    def GetNumberRows(self):
-        return len(self.data)
-
-    def GetColLabelValue(self, col):
-        if col < len(self.colnames):
-            return self.colnames[col]
-
-    def GetRowLabelValues(self, row):
-        return row
-
-    def GetValue(self, row, col):
-        if row < self.GetNumberRows():
-            value = self.data[row].get(self.GetColLabelValue(col), "")
-            if (type(value) == UnicodeType):
-                return value
-            else: 
-                return str(value)
-    
-    def GetEditor(self, row, col):
-        if row < self.GetNumberRows():
-            return self.editors[row].get(self.GetColLabelValue(col), "")
-    
-    def GetValueByName(self, row, colname):
-        return self.data[row].get(colname)
-
-    def SetValue(self, row, col, value):
-        if col < len(self.colnames):
-            self.data[row][self.GetColLabelValue(col)] = value
-        
-    def ResetView(self, grid):
-        """
-        (wxGrid) -> Reset the grid view.   Call this to
-        update the grid if rows and columns have been added or deleted
-        """
-        grid.BeginBatch()
-        for current, new, delmsg, addmsg in [
-            (self._rows, self.GetNumberRows(), wxGRIDTABLE_NOTIFY_ROWS_DELETED, wxGRIDTABLE_NOTIFY_ROWS_APPENDED),
-            (self._cols, self.GetNumberCols(), wxGRIDTABLE_NOTIFY_COLS_DELETED, wxGRIDTABLE_NOTIFY_COLS_APPENDED),
-        ]:
-            if new < current:
-                msg = wxGridTableMessage(self,delmsg,new,current-new)
-                grid.ProcessTableMessage(msg)
-            elif new > current:
-                msg = wxGridTableMessage(self,addmsg,new-current)
-                grid.ProcessTableMessage(msg)
-                self.UpdateValues(grid)
-        grid.EndBatch()
-
-        self._rows = self.GetNumberRows()
-        self._cols = self.GetNumberCols()
-        # update the column rendering scheme
-        self._updateColAttrs(grid)
-
-        # update the scrollbars and the displayed part of the grid
-        grid.AdjustScrollbars()
-        grid.ForceRefresh()
-
-
-    def UpdateValues(self, grid):
-        """Update all displayed values"""
-        # This sends an event to the grid table to update all of the values
-        msg = wxGridTableMessage(self, wxGRIDTABLE_REQUEST_VIEW_GET_VALUES)
-        grid.ProcessTableMessage(msg)
-
-    def _updateColAttrs(self, grid):
-        """
-        wxGrid -> update the column attributes to add the
-        appropriate renderer given the column name.
-
-        Otherwise default to the default renderer.
-        """
-        
-        for col in range(self.GetNumberCols()):
-            attr = wxGridCellAttr()
-            attr.SetAlignment(ColAlignements[col], wxALIGN_CENTRE)
-            grid.SetColAttr(col, attr)
-            grid.SetColSize(col, ColSizes[col])
-        
-        typelist = None
-        accesslist = None
-        for row in range(self.GetNumberRows()):
-            editors = self.editors[row]
-            for col in range(self.GetNumberCols()):
-                editor = None
-                renderer = None
-                
-                colname = self.GetColLabelValue(col)
-                editortype = editors[colname]
-                if editortype:
-                    grid.SetReadOnly(row, col, False)
-                    if editortype == "string":
-                        editor = wxGridCellTextEditor()
-                        renderer = wxGridCellStringRenderer()
-                        if colname == "value" and "length" in editors:
-                            editor.SetParameters(editors["length"]) 
-                    elif editortype == "number":
-                        editor = wxGridCellNumberEditor()
-                        renderer = wxGridCellNumberRenderer()
-                        if colname == "value" and "min" in editors and "max" in editors:
-                            editor.SetParameters("%s,%s"%(editors["min"],editors["max"]))
-                    elif editortype == "real":
-                        editor = wxGridCellFloatEditor()
-                        renderer = wxGridCellFloatRenderer()
-                        if colname == "value" and "min" in editors and "max" in editors:
-                            editor.SetParameters("%s,%s"%(editors["min"],editors["max"]))
-                    elif editortype == "bool":
-                        editor = wxGridCellChoiceEditor()
-                        editor.SetParameters(BoolList)
-                    elif editortype == "access":
-                        editor = wxGridCellChoiceEditor()
-                        editor.SetParameters(AccessList)
-                    elif editortype == "raccess":
-                        editor = wxGridCellChoiceEditor()
-                        editor.SetParameters(RAccessList)
-                    elif editortype == "option":
-                        editor = wxGridCellChoiceEditor()
-                        editor.SetParameters(OptionList)
-                    elif editortype == "type":
-                        editor = wxGridCellChoiceEditor()
-                        editor.SetParameters(self.Parent.Manager.GetCurrentTypeList())
-                    elif editortype == "map":
-                        editor = wxGridCellChoiceEditor()
-                        editor.SetParameters(self.Parent.Manager.GetCurrentMapList())
-                    elif editortype == "time":
-                        editor = wxGridCellTextEditor()
-                        renderer = wxGridCellStringRenderer()
-                    elif editortype == "domain":
-                        editor = wxGridCellTextEditor()
-                        renderer = wxGridCellStringRenderer()
-                else:
-                    grid.SetReadOnly(row, col, True)
-                    
-                grid.SetCellEditor(row, col, editor)
-                grid.SetCellRenderer(row, col, renderer)
-                
-                grid.SetCellBackgroundColour(row, col, wxWHITE)
-    
-    def SetData(self, data):
-        self.data = data
-        
-    def SetEditors(self, editors):
-        self.editors = editors
-    
-    def GetCurrentIndex(self):
-        return self.CurrentIndex
-    
-    def SetCurrentIndex(self, index):
-        self.CurrentIndex = index
-    
-    def AppendRow(self, row_content):
-        self.data.append(row_content)
-
-    def Empty(self):
-        self.data = []
-        self.editors = []
-
-[wxID_EDITINGPANEL, wxID_EDITINGPANELADDBUTTON, wxID_EDITINGPANELINDEXCHOICE, 
- wxID_EDITINGPANELINDEXLIST, wxID_EDITINGPANELINDEXLISTPANEL, wxID_EDITINGPANELPARTLIST, 
- wxID_EDITINGPANELSECONDSPLITTER, wxID_EDITINGPANELSUBINDEXGRID,
- wxID_EDITINGPANELSUBINDEXGRIDPANEL, wxID_EDITINGPANELCALLBACKCHECK,
-] = [wx.NewId() for _init_ctrls in range(10)]
-
-[wxID_EDITINGPANELINDEXLISTMENUITEMS0, wxID_EDITINGPANELINDEXLISTMENUITEMS1, 
- wxID_EDITINGPANELINDEXLISTMENUITEMS2, 
-] = [wx.NewId() for _init_coll_IndexListMenu_Items in range(3)]
-
-[wxID_EDITINGPANELMENU1ITEMS0, wxID_EDITINGPANELMENU1ITEMS1, 
-] = [wx.NewId() for _init_coll_SubindexGridMenu_Items in range(2)]
-
-class EditingPanel(wx.SplitterWindow):
-    def _init_coll_AddToListSizer_Items(self, parent):
-        # generated method, don't edit
-
-        parent.AddWindow(self.AddButton, 0, border=0, flag=0)
-        parent.AddWindow(self.IndexChoice, 0, border=0, flag=wxGROW)
-
-    def _init_coll_SubindexGridSizer_Items(self, parent):
-        # generated method, don't edit
-
-        parent.AddWindow(self.CallbackCheck, 0, border=0, flag=0)
-        parent.AddWindow(self.SubindexGrid, 0, border=0, flag=wxGROW)
-
-    def _init_coll_IndexListSizer_Items(self, parent):
-        # generated method, don't edit
-
-        parent.AddWindow(self.IndexList, 0, border=0, flag=wxGROW)
-        parent.AddSizer(self.AddToListSizer, 0, border=0, flag=wxGROW)
-
-    def _init_coll_AddToListSizer_Growables(self, parent):
-        # generated method, don't edit
-
-        parent.AddGrowableCol(1)
-
-    def _init_coll_SubindexGridSizer_Growables(self, parent):
-        # generated method, don't edit
-
-        parent.AddGrowableCol(0)
-        parent.AddGrowableRow(1)
-
-    def _init_coll_IndexListSizer_Growables(self, parent):
-        # generated method, don't edit
-
-        parent.AddGrowableCol(0)
-        parent.AddGrowableRow(0)
-
-    def _init_coll_SubindexGridMenu_Items(self, parent):
-        # generated method, don't edit
-
-        parent.Append(help='', id=wxID_EDITINGPANELMENU1ITEMS0,
-              kind=wx.ITEM_NORMAL, text='Add')
-        parent.Append(help='', id=wxID_EDITINGPANELMENU1ITEMS1,
-              kind=wx.ITEM_NORMAL, text='Delete')
-        self.Bind(wx.EVT_MENU, self.OnAddSubindexMenu,
-              id=wxID_EDITINGPANELMENU1ITEMS0)
-        self.Bind(wx.EVT_MENU, self.OnDeleteSubindexMenu,
-              id=wxID_EDITINGPANELMENU1ITEMS1)
-
-    def _init_coll_IndexListMenu_Items(self, parent):
-        # generated method, don't edit
-
-        parent.Append(help='', id=wxID_EDITINGPANELINDEXLISTMENUITEMS0,
-              kind=wx.ITEM_NORMAL, text='Rename')
-        parent.Append(help='', id=wxID_EDITINGPANELINDEXLISTMENUITEMS2,
-              kind=wx.ITEM_NORMAL, text='Modify')
-        parent.Append(help='', id=wxID_EDITINGPANELINDEXLISTMENUITEMS1,
-              kind=wx.ITEM_NORMAL, text='Delete')
-        self.Bind(wx.EVT_MENU, self.OnRenameIndexMenu,
-              id=wxID_EDITINGPANELINDEXLISTMENUITEMS0)
-        self.Bind(wx.EVT_MENU, self.OnDeleteIndexMenu,
-              id=wxID_EDITINGPANELINDEXLISTMENUITEMS1)
-        self.Bind(wx.EVT_MENU, self.OnModifyIndexMenu,
-              id=wxID_EDITINGPANELINDEXLISTMENUITEMS2)
-
-    def _init_utils(self):
-        # generated method, don't edit
-        self.IndexListMenu = wx.Menu(title='')
-
-        self.SubindexGridMenu = wx.Menu(title='')
-
-        self._init_coll_IndexListMenu_Items(self.IndexListMenu)
-        self._init_coll_SubindexGridMenu_Items(self.SubindexGridMenu)
-
-    def _init_sizers(self):
-        # generated method, don't edit
-        self.IndexListSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
-
-        self.SubindexGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
-
-        self.AddToListSizer = wx.FlexGridSizer(cols=2, hgap=0, rows=1, vgap=0)
-
-        self._init_coll_IndexListSizer_Growables(self.IndexListSizer)
-        self._init_coll_IndexListSizer_Items(self.IndexListSizer)
-        self._init_coll_SubindexGridSizer_Growables(self.SubindexGridSizer)
-        self._init_coll_SubindexGridSizer_Items(self.SubindexGridSizer)
-        self._init_coll_AddToListSizer_Growables(self.AddToListSizer)
-        self._init_coll_AddToListSizer_Items(self.AddToListSizer)
-
-        self.SubindexGridPanel.SetSizer(self.SubindexGridSizer)
-        self.IndexListPanel.SetSizer(self.IndexListSizer)
-        
-    def _init_ctrls(self, prnt):
-        wx.SplitterWindow.__init__(self, id=wxID_EDITINGPANEL,
-              name='MainSplitter', parent=prnt, point=wx.Point(0, 0),
-              size=wx.Size(-1, -1), style=wx.SP_3D)
-        self._init_utils()
-        self.SetNeedUpdating(True)
-        self.SetMinimumPaneSize(1)
-
-        self.PartList = wx.ListBox(choices=[], id=wxID_EDITINGPANELPARTLIST,
-              name='PartList', parent=self, pos=wx.Point(0, 0),
-              size=wx.Size(-1, -1), style=0)
-        self.PartList.Bind(wx.EVT_LISTBOX, self.OnPartListBoxClick,
-              id=wxID_EDITINGPANELPARTLIST)
-
-        self.SecondSplitter = wx.SplitterWindow(id=wxID_EDITINGPANELSECONDSPLITTER,
-              name='SecondSplitter', parent=self, point=wx.Point(0,
-              0), size=wx.Size(-1, -1), style=wx.SP_3D)
-        self.SecondSplitter.SetMinimumPaneSize(1)
-        self.SplitHorizontally(self.PartList, self.SecondSplitter,
-              110)
-
-        self.SubindexGridPanel = wx.Panel(id=wxID_EDITINGPANELSUBINDEXGRIDPANEL,
-              name='SubindexGridPanel', parent=self.SecondSplitter, pos=wx.Point(0,
-              0), size=wx.Size(-1, -1), style=wx.TAB_TRAVERSAL)
-
-        self.IndexListPanel = wx.Panel(id=wxID_EDITINGPANELINDEXLISTPANEL,
-              name='IndexListPanel', parent=self.SecondSplitter, pos=wx.Point(0,
-              0), size=wx.Size(-1, -1), style=wx.TAB_TRAVERSAL)
-        self.SecondSplitter.SplitVertically(self.IndexListPanel,
-              self.SubindexGridPanel, 280)
-
-        self.SubindexGrid = wx.grid.Grid(id=wxID_EDITINGPANELSUBINDEXGRID,
-              name='SubindexGrid', parent=self.SubindexGridPanel, pos=wx.Point(0,
-              0), size=wx.Size(-1, -1), style=0)
-        self.SubindexGrid.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False,
-              'Sans'))
-        self.SubindexGrid.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL,
-              False, 'Sans'))
-        self.SubindexGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE,
-              self.OnSubindexGridCellChange)
-        self.SubindexGrid.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK,
-              self.OnSubindexGridRightClick)
-        self.SubindexGrid.Bind(wx.grid.EVT_GRID_SELECT_CELL,
-              self.OnSubindexGridSelectCell)
-
-        self.CallbackCheck = wx.CheckBox(id=wxID_EDITINGPANELCALLBACKCHECK,
-              label='Have Callbacks', name='CallbackCheck',
-              parent=self.SubindexGridPanel, pos=wx.Point(0, 0), size=wx.Size(152,
-              24), style=0)
-        self.CallbackCheck.Bind(wx.EVT_CHECKBOX, self.OnCallbackCheck,
-              id=wxID_EDITINGPANELCALLBACKCHECK)
-
-        self.IndexList = wx.ListBox(choices=[], id=wxID_EDITINGPANELINDEXLIST,
-              name='IndexList', parent=self.IndexListPanel, pos=wx.Point(0, 0),
-              size=wx.Size(-1, -1), style=0)
-        self.IndexList.Bind(wx.EVT_LISTBOX, self.OnIndexListClick,
-              id=wxID_EDITINGPANELINDEXLIST)
-        self.IndexList.Bind(wx.EVT_RIGHT_UP, self.OnIndexListRightUp)
-
-        self.AddButton = wx.Button(id=wxID_EDITINGPANELADDBUTTON, label='Add',
-              name='AddButton', parent=self.IndexListPanel, pos=wx.Point(0, 0),
-              size=wx.Size(50, 30), style=0)
-        self.AddButton.Bind(wx.EVT_BUTTON, self.OnAddButtonClick,
-              id=wxID_EDITINGPANELADDBUTTON)
-
-        self.IndexChoice = wx.Choice(choices=[], id=wxID_EDITINGPANELINDEXCHOICE,
-              name='IndexChoice', parent=self.IndexListPanel, pos=wx.Point(50,
-              0), size=wx.Size(-1, 30), style=0)
-
-        self._init_sizers()
-
-    def __init__(self, parent, manager):
-        self._init_ctrls(parent.GetNoteBook())
-        self.Parent = parent
-        self.Manager = manager
-        self.ListIndex = []
-        self.ChoiceIndex = []
-        self.FirstCall = False
-        
-        for values in DictionaryOrganisation:
-            text = "   0x%04X-0x%04X      %s"%(values["minIndex"],values["maxIndex"],values["name"])
-            self.PartList.Append(text)
-        self.Table = SubindexTable(self, [], [], ["subindex", "name", "type", "value", "access", "save", "comment"])
-        self.SubindexGrid.SetTable(self.Table)
-        self.SubindexGrid.SetRowLabelSize(0)
-        self.CallbackCheck.Disable()
-        self.Table.ResetView(self.SubindexGrid)
-
-    def GetSelection(self):
-        selected = self.IndexList.GetSelection()
-        if selected != wxNOT_FOUND:
-            index = self.ListIndex[selected]
-            subIndex = self.SubindexGrid.GetGridCursorRow()
-            return index, subIndex
-        return None
-
-    def OnAddButtonClick(self, event):
-        self.SubindexGrid.SetGridCursor(0, 0)
-        selected = self.IndexChoice.GetStringSelection()
-        if selected != "":
-            if selected == "User Type":
-                self.Parent.AddUserType()
-            elif selected == "SDO Server":
-                self.Manager.AddSDOServerToCurrent()
-            elif selected == "SDO Client":
-                self.Manager.AddSDOClientToCurrent()
-            elif selected == "PDO Receive":
-                self.Manager.AddPDOReceiveToCurrent()
-            elif selected == "PDO Transmit":
-                self.Manager.AddPDOTransmitToCurrent()
-            elif selected == "Map Variable":
-                self.Parent.AddMapVariable()
-            elif selected in [menu for menu, indexes in self.Manager.GetCurrentSpecificMenu()]:
-                self.Manager.AddSpecificEntryToCurrent(selected)
-            else:
-                index = self.ChoiceIndex[self.IndexChoice.GetSelection()]
-                self.Manager.ManageEntriesOfCurrent([index], [])
-            self.Parent.RefreshBufferState()
-            self.RefreshIndexList()
-        event.Skip()
-
-    def OnPartListBoxClick(self, event):
-        self.SubindexGrid.SetGridCursor(0, 0)
-        self.RefreshIndexList()
-        event.Skip()
-
-    def OnIndexListClick(self, event):
-        self.SubindexGrid.SetGridCursor(0, 0)
-        self.RefreshTable()
-        event.Skip()
-
-    def OnSubindexGridSelectCell(self, event):
-        wxCallAfter(self.Parent.RefreshStatusBar)
-        event.Skip()
-
-#-------------------------------------------------------------------------------
-#                             Refresh Functions
-#-------------------------------------------------------------------------------
-
-    def RefreshIndexList(self):
-        selected = self.IndexList.GetSelection()
-        choice = self.IndexChoice.GetStringSelection()
-        choiceindex = self.IndexChoice.GetSelection()
-        if selected != wxNOT_FOUND:
-            selectedindex = self.ListIndex[selected]
-        self.IndexList.Clear()
-        self.IndexChoice.Clear()
-        i = self.PartList.GetSelection()
-        if i < len(DictionaryOrganisation):
-            values = DictionaryOrganisation[i]
-            self.ListIndex = []
-            for name, index in self.Manager.GetCurrentValidIndexes(values["minIndex"], values["maxIndex"]):
-                self.IndexList.Append("0x%04X   %s"%(index, name))
-                self.ListIndex.append(index)
-            self.ChoiceIndex = []
-            if i == 0:
-                self.IndexChoice.Append("User Type")
-                self.IndexChoice.SetStringSelection("User Type")
-            elif i == 2:
-                self.IndexChoice.Append("SDO Server")
-                self.IndexChoice.Append("SDO Client")
-                if choiceindex != wxNOT_FOUND and choice == self.IndexChoice.GetString(choiceindex):
-                     self.IndexChoice.SetStringSelection(choice)
-            elif i in (3, 4):
-                self.IndexChoice.Append("PDO Receive")
-                self.IndexChoice.SetStringSelection("PDO Receive")
-            elif i in (5, 6):
-                self.IndexChoice.Append("PDO Transmit")
-                self.IndexChoice.SetStringSelection("PDO Transmit")
-            elif i == 8:
-                self.IndexChoice.Append("Map Variable")
-                self.IndexChoice.SetStringSelection("Map Variable")
-            else:
-                for name, index in self.Manager.GetCurrentValidChoices(values["minIndex"], values["maxIndex"]):
-                    if index:
-                        self.IndexChoice.Append("0x%04X   %s"%(index, name))
-                    else:
-                        self.IndexChoice.Append(name)
-                    self.ChoiceIndex.append(index)
-            if choiceindex != wxNOT_FOUND and choice == self.IndexChoice.GetString(choiceindex):
-                self.IndexChoice.SetStringSelection(choice)
-        self.IndexChoice.Enable(self.IndexChoice.GetCount() != 0)
-        self.AddButton.Enable(self.IndexChoice.GetCount() != 0)
-        if selected == wxNOT_FOUND or selected >= len(self.ListIndex) or selectedindex != self.ListIndex[selected]:
-            self.Table.Empty()
-            self.CallbackCheck.SetValue(False)
-            self.CallbackCheck.Disable()
-            self.Table.ResetView(self.SubindexGrid)
-            self.Parent.RefreshStatusBar()
-        else:
-            self.IndexList.SetSelection(selected)
-            self.RefreshTable()
-
-    def RefreshTable(self):
-        selected = self.IndexList.GetSelection()
-        if selected != wxNOT_FOUND:
-            index = self.ListIndex[selected]
-            if index > 0x260:
-                self.CallbackCheck.Enable()
-                self.CallbackCheck.SetValue(self.Manager.HasCurrentEntryCallbacks(index))
-            result = self.Manager.GetCurrentEntryValues(index)
-            if result != None:
-                self.Table.SetCurrentIndex(index)
-                data, editors = result
-                self.Table.SetData(data)
-                self.Table.SetEditors(editors)
-                self.Table.ResetView(self.SubindexGrid)
-        self.Parent.RefreshStatusBar()
-
-#-------------------------------------------------------------------------------
-#                        Editing Table value function
-#-------------------------------------------------------------------------------
-
-    def OnSubindexGridCellChange(self, event):
-        index = self.Table.GetCurrentIndex()
-        subIndex = event.GetRow()
-        col = event.GetCol()
-        name = self.Table.GetColLabelValue(col)
-        value = self.Table.GetValue(subIndex, col)
-        editor = self.Table.GetEditor(subIndex, col)
-        self.Manager.SetCurrentEntry(index, subIndex, value, name, editor)
-        self.Parent.RefreshBufferState()
-        wxCallAfter(self.RefreshTable)
-        event.Skip()
-
-    def OnCallbackCheck(self, event):
-        index = self.Table.GetCurrentIndex()
-        self.Manager.SetCurrentEntryCallbacks(index, self.CallbackCheck.GetValue())
-        self.Parent.RefreshBufferState()
-        wxCallAfter(self.RefreshTable)
-        event.Skip()
-
-#-------------------------------------------------------------------------------
-#                          Contextual Menu functions
-#-------------------------------------------------------------------------------
-
-    def OnIndexListRightUp(self, event):
-        if not self.FirstCall:
-            self.FirstCall = True
-            selected = self.IndexList.GetSelection()
-            if selected != wxNOT_FOUND:
-                index = self.ListIndex[selected]
-                if index < 0x260:
-                    self.IndexListMenu.FindItemByPosition(0).Enable(False)
-                    self.IndexListMenu.FindItemByPosition(1).Enable(True)
-                    self.PopupMenu(self.IndexListMenu)
-                elif 0x1000 <= index <= 0x1BFF:
-                    self.IndexListMenu.FindItemByPosition(0).Enable(False)
-                    self.IndexListMenu.FindItemByPosition(1).Enable(False)
-                    self.PopupMenu(self.IndexListMenu)
-                elif 0x2000 <= index <= 0x5FFF:
-                    self.IndexListMenu.FindItemByPosition(0).Enable(True)
-                    self.IndexListMenu.FindItemByPosition(1).Enable(False)
-                    self.PopupMenu(self.IndexListMenu)
-                elif index >= 0x6000:
-                    self.IndexListMenu.FindItemByPosition(0).Enable(False)
-                    self.IndexListMenu.FindItemByPosition(1).Enable(False)
-                    self.PopupMenu(self.IndexListMenu)
-        else:
-            self.FirstCall = False
-        event.Skip()
-
-    def OnSubindexGridRightClick(self, event):
-        selected = self.IndexList.GetSelection()
-        if selected != wxNOT_FOUND:
-            index = self.ListIndex[selected]
-            if self.Manager.IsCurrentEntry(index):
-                infos = self.Manager.GetEntryInfos(index)
-                if index >= 0x2000 and infos["struct"] & OD_MultipleSubindexes or infos["struct"] & OD_IdenticalSubindexes:
-                    self.PopupMenu(self.SubindexGridMenu)
-        event.Skip()
-
-    def OnRenameIndexMenu(self, event):
-        selected = self.IndexList.GetSelection()
-        if selected != wxNOT_FOUND:
-            index = self.ListIndex[selected]
-            if self.Manager.IsCurrentEntry(index):
-                infos = self.Manager.GetEntryInfos(index)
-                dialog = wxTextEntryDialog(self, "Give a new name for index 0x%04X"%index,
-                             "Rename an index", infos["name"], wxOK|wxCANCEL)
-                if dialog.ShowModal() == wxID_OK:
-                    self.Manager.SetCurrentEntryName(index, dialog.GetValue())
-                    self.Parent.RefreshBufferState()
-                    self.RefreshIndexList()
-                dialog.Destroy()
-        event.Skip()
-
-    def OnModifyIndexMenu(self, event):
-        selected = self.IndexList.GetSelection()
-        if selected != wxNOT_FOUND:
-            index = self.ListIndex[selected]
-            if self.Manager.IsCurrentEntry(index) and index < 0x260:
-                values, valuetype = self.Manager.GetCustomisedTypeValues(index)
-                dialog = UserTypeDialog(self)
-                dialog.SetTypeList(self.Manager.GetCustomisableTypes(), values[1])
-                if valuetype == 0:
-                    dialog.SetValues(min = values[2], max = values[3])
-                elif valuetype == 1:
-                    dialog.SetValues(length = values[2])
-                if dialog.ShowModal() == wxID_OK:
-                    type, min, max, length = dialog.GetValues()
-                    self.Manager.SetCurrentUserType(index, type, min, max, length)
-                    self.Parent.RefreshBufferState()
-                    self.RefreshIndexList()
-        event.Skip()
-        
-    def OnDeleteIndexMenu(self, event):
-        selected = self.IndexList.GetSelection()
-        if selected != wxNOT_FOUND:
-            index = self.ListIndex[selected]
-            if self.Manager.IsCurrentEntry(index):
-                self.Manager.ManageEntriesOfCurrent([],[index])
-                self.Parent.RefreshBufferState()
-                self.RefreshIndexList()
-        event.Skip()
-
-    def OnAddSubindexMenu(self, event):
-        selected = self.IndexList.GetSelection()
-        if selected != wxNOT_FOUND:
-            index = self.ListIndex[selected]
-            if self.Manager.IsCurrentEntry(index):
-                dialog = wxTextEntryDialog(self, "Number of subindexes to add:",
-                             "Add subindexes", "1", wxOK|wxCANCEL)
-                if dialog.ShowModal() == wxID_OK:
-                    try:
-                        number = int(dialog.GetValue())
-                        self.Manager.AddSubentriesToCurrent(index, number)
-                        self.Parent.RefreshBufferState()
-                        self.RefreshIndexList()
-                    except:
-                        message = wxMessageDialog(self, "An integer is required!", "ERROR", wxOK|wxICON_ERROR)
-                        message.ShowModal()
-                        message.Destroy()
-                dialog.Destroy()
-        event.Skip()
-
-    def OnDeleteSubindexMenu(self, event):
-        selected = self.IndexList.GetSelection()
-        if selected != wxNOT_FOUND:
-            index = self.ListIndex[selected]
-            if self.Manager.IsCurrentEntry(index):
-                dialog = wxTextEntryDialog(self, "Number of subindexes to delete:",
-                             "Delete subindexes", "1", wxOK|wxCANCEL)
-                if dialog.ShowModal() == wxID_OK:
-                    try:
-                        number = int(dialog.GetValue())
-                        self.Manager.RemoveSubentriesFromCurrent(index, number)
-                        self.Parent.RefreshBufferState()
-                        self.RefreshIndexList()
-                    except:
-                        message = wxMessageDialog(self, "An integer is required!", "ERROR", wxOK|wxICON_ERROR)
-                        message.ShowModal()
-                        message.Destroy()
-                dialog.Destroy()
-        event.Skip()
 
 [wxID_OBJDICTEDIT, wxID_OBJDICTEDITFILEOPENED, 
  wxID_OBJDICTEDITHELPBAR,
@@ -860,13 +203,13 @@
               kind=wx.ITEM_NORMAL, text='DS-301 Standard\tF1')
         self.Bind(wx.EVT_MENU, self.OnHelpDS301Menu,
               id=wxID_OBJDICTEDITHELPMENUITEMS0)
+        parent.Append(help='', id=wxID_OBJDICTEDITHELPMENUITEMS1,
+              kind=wx.ITEM_NORMAL, text='CAN Festival Docs\tF2')
+        self.Bind(wx.EVT_MENU, self.OnHelpCANFestivalMenu,
+              id=wxID_OBJDICTEDITHELPMENUITEMS1)
         if Html_Window:
-            parent.Append(help='', id=wxID_OBJDICTEDITHELPMENUITEMS1,
-                  kind=wx.ITEM_NORMAL, text='CAN Festival Docs\tF2')
             parent.Append(help='', id=wxID_OBJDICTEDITHELPMENUITEMS2,
                   kind=wx.ITEM_NORMAL, text='About')
-            self.Bind(wx.EVT_MENU, self.OnHelpCANFestivalMenu,
-                  id=wxID_OBJDICTEDITHELPMENUITEMS1)
             self.Bind(wx.EVT_MENU, self.OnAboutMenu,
                   id=wxID_OBJDICTEDITHELPMENUITEMS2)
 
@@ -1007,9 +350,6 @@
         self.RefreshEditMenu()
         self.RefreshBufferState()
         self.RefreshProfileMenu()
-        self.RefreshMainMenu()
-
-        self.RefreshBufferState()
         self.RefreshTitle()
         self.RefreshMainMenu()
 
@@ -1052,9 +392,11 @@
         selected = event.GetSelection()
         # At init selected = -1
         if selected >= 0:
-        	self.Manager.ChangeCurrentNode(selected)
-        	self.RefreshBufferState()
-        	self.RefreshProfileMenu()
+            window = self.FileOpened.GetPage(selected)
+            self.Manager.ChangeCurrentNode(window.GetIndex())
+            self.RefreshBufferState()
+            self.RefreshStatusBar()
+            self.RefreshProfileMenu()
         event.Skip()
 
     def OnHelpDS301Menu(self, event):
@@ -1143,34 +485,35 @@
         window.RefreshIndexList()
 
     def RefreshStatusBar(self):
-        window = self.FileOpened.GetPage(self.FileOpened.GetSelection())
-        selection = window.GetSelection()
-        if selection:
-            index, subIndex = selection
-            if self.Manager.IsCurrentEntry(index):
-                self.HelpBar.SetStatusText("Index: 0x%04X"%index, 0)
-                self.HelpBar.SetStatusText("Subindex: 0x%02X"%subIndex, 1)
-                entryinfos = self.Manager.GetEntryInfos(index)
-                name = entryinfos["name"]
-                category = "Optional"
-                if entryinfos["need"]:
-                    category = "Mandatory"
-                struct = "VAR"
-                number = ""
-                if entryinfos["struct"] & OD_IdenticalIndexes:
-                    number = " possibly defined %d times"%entryinfos["nbmax"]
-                if entryinfos["struct"] & OD_IdenticalSubindexes:
-                    struct = "REC"
-                elif entryinfos["struct"] & OD_MultipleSubindexes:
-                    struct = "ARRAY"
-                text = "%s: %s entry of struct %s%s."%(name,category,struct,number)
-                self.HelpBar.SetStatusText(text, 2)
+        if self.HelpBar:
+            window = self.FileOpened.GetPage(self.FileOpened.GetSelection())
+            selection = window.GetSelection()
+            if selection:
+                index, subIndex = selection
+                if self.Manager.IsCurrentEntry(index):
+                    self.HelpBar.SetStatusText("Index: 0x%04X"%index, 0)
+                    self.HelpBar.SetStatusText("Subindex: 0x%02X"%subIndex, 1)
+                    entryinfos = self.Manager.GetEntryInfos(index)
+                    name = entryinfos["name"]
+                    category = "Optional"
+                    if entryinfos["need"]:
+                        category = "Mandatory"
+                    struct = "VAR"
+                    number = ""
+                    if entryinfos["struct"] & OD_IdenticalIndexes:
+                        number = " possibly defined %d times"%entryinfos["nbmax"]
+                    if entryinfos["struct"] & OD_IdenticalSubindexes:
+                        struct = "REC"
+                    elif entryinfos["struct"] & OD_MultipleSubindexes:
+                        struct = "ARRAY"
+                    text = "%s: %s entry of struct %s%s."%(name,category,struct,number)
+                    self.HelpBar.SetStatusText(text, 2)
+                else:
+                    for i in xrange(3):
+                        self.HelpBar.SetStatusText("", i)
             else:
                 for i in xrange(3):
                     self.HelpBar.SetStatusText("", i)
-        else:
-            for i in xrange(3):
-                self.HelpBar.SetStatusText("", i)
 
     def RefreshMainMenu(self):
         if self.FileMenu:
@@ -1255,15 +598,16 @@
         self.FilePath = ""
         dialog = CreateNodeDialog(self)
         if dialog.ShowModal() == wxID_OK:
-            name, id, type, description = dialog.GetValues()
+            name, id, nodetype, description = dialog.GetValues()
             profile, filepath = dialog.GetProfile()
             NMT = dialog.GetNMTManagement()
             options = dialog.GetOptions()
-            result = self.Manager.CreateNewNode(name, id, type, description, profile, filepath, NMT, options)
-            if not IsOfType(result, StringType):
+            result = self.Manager.CreateNewNode(name, id, nodetype, description, profile, filepath, NMT, options)
+            if type(result) == IntType:
                 new_editingpanel = EditingPanel(self, self.Manager)
+                new_editingpanel.SetIndex(result)
                 self.FileOpened.AddPage(new_editingpanel, "")
-                self.FileOpened.SetSelection(self.Manager.GetCurrentNodeIndex())
+                self.FileOpened.SetSelection(self.FileOpened.GetPageCount() - 1)
                 self.EditMenu.Enable(wxID_OBJDICTEDITEDITMENUITEMS8, False)
                 if "DS302" in options:
                     self.EditMenu.Enable(wxID_OBJDICTEDITEDITMENUITEMS8, True)
@@ -1287,10 +631,11 @@
             filepath = dialog.GetPath()
             if os.path.isfile(filepath):
                 result = self.Manager.OpenFileInCurrent(filepath)
-                if type(result) != StringType:
+                if type(result) == IntType:
                     new_editingpanel = EditingPanel(self, self.Manager)
+                    new_editingpanel.SetIndex(result)
                     self.FileOpened.AddPage(new_editingpanel, "")
-                    self.FileOpened.SetSelection(self.Manager.GetCurrentNodeIndex())
+                    self.FileOpened.SetSelection(self.FileOpened.GetPageCount() - 1)
                     if self.Manager.CurrentDS302Defined(): 
                         self.EditMenu.Enable(wxID_OBJDICTEDITEDITMENUITEMS8, True)
                     else:
@@ -1381,11 +726,11 @@
             filepath = dialog.GetPath()
             if os.path.isfile(filepath):
                 result = self.Manager.ImportCurrentFromEDSFile(filepath)
-                if not result:
-                    if self.FileOpened.GetPageCount() == 0:
-                        new_editingpanel = EditingPanel(self, self.Manager)
-                        self.FileOpened.AddPage(new_editingpanel, "")
-                        self.FileOpened.SetSelection(self.Manager.GetCurrentNodeIndex())
+                if type(result) == IntType:
+                    new_editingpanel = EditingPanel(self, self.Manager)
+                    new_editingpanel.SetIndex(result)
+                    self.FileOpened.AddPage(new_editingpanel, "")
+                    self.FileOpened.SetSelection(self.FileOpened.GetPageCount() - 1)
                     self.RefreshBufferState()
                     self.RefreshCurrentIndexList()
                     self.RefreshProfileMenu()
@@ -1517,6 +862,10 @@
             self.Manager.SetCurrentNodeInfos(name, id, type, description)
             self.RefreshBufferState()
             self.RefreshProfileMenu()
+            selected = self.FileOpened.GetSelection()
+            if selected >= 0:
+                window = self.FileOpened.GetPage(selected)
+                window.RefreshTable()
         event.Skip()
 
 
@@ -1551,7 +900,7 @@
         if dialog.ShowModal() == wxID_OK:
             type, min, max, length = dialog.GetValues()
             result = self.Manager.AddUserTypeToCurrent(type, min, max, length)
-            if not IsOfType(result, StringType):
+            if not result:
                 self.RefreshBufferState()
                 self.RefreshCurrentIndexList()
             else:
@@ -1559,872 +908,6 @@
                 message.ShowModal()
                 message.Destroy()
         dialog.Destroy()
-
-
-
-#-------------------------------------------------------------------------------
-#                          Editing Communication Dialog
-#-------------------------------------------------------------------------------
-
-
-[wxID_COMMUNICATIONDIALOG, wxID_COMMUNICATIONDIALOGMAINPANEL,
- wxID_COMMUNICATIONDIALOGPOSSIBLEINDEXES, wxID_COMMUNICATIONDIALOGCURRENTINDEXES,
- wxID_COMMUNICATIONDIALOGSELECT, wxID_COMMUNICATIONDIALOGUNSELECT, 
- wxID_COMMUNICATIONDIALOGSTATICTEXT1, wxID_COMMUNICATIONDIALOGSTATICTEXT2
-] = [wx.NewId() for _init_ctrls in range(8)]
-
-class CommunicationDialog(wx.Dialog):
-    def _init_coll_flexGridSizer1_Items(self, parent):
-        # generated method, don't edit
-
-        parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
-
-    def _init_sizers(self):
-        # generated method, don't edit
-        self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
-
-        self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
-
-        self.SetSizer(self.flexGridSizer1)
-
-    def _init_ctrls(self, prnt):
-        # generated method, don't edit
-        wx.Dialog.__init__(self, id=wxID_COMMUNICATIONDIALOG,
-              name='CommunicationDialog', parent=prnt, pos=wx.Point(234, 216),
-              size=wx.Size(726, 437), style=wx.DEFAULT_DIALOG_STYLE,
-              title='Edit Communication Profile')
-        self.SetClientSize(wx.Size(726, 437))
-
-        self.MainPanel = wx.Panel(id=wxID_COMMUNICATIONDIALOGMAINPANEL,
-              name='MainPanel', parent=self, pos=wx.Point(0, 0),
-              size=wx.Size(688, 382), style=wx.TAB_TRAVERSAL)
-        self.MainPanel.SetAutoLayout(True)
-
-        self.PossibleIndexes = wx.ListBox(choices=[],
-              id=wxID_COMMUNICATIONDIALOGPOSSIBLEINDEXES,
-              name='PossibleIndexes', parent=self.MainPanel, pos=wx.Point(40,
-              48), size=wx.Size(280, 320), style=wxLB_EXTENDED)
-        self.PossibleIndexes.Bind(wx.EVT_LEFT_DCLICK, self.OnPossibleIndexesDClick,
-              id=wxID_COMMUNICATIONDIALOGPOSSIBLEINDEXES)
-
-        self.CurrentIndexes = wx.ListBox(choices=[],
-              id=wxID_COMMUNICATIONDIALOGCURRENTINDEXES, name='CurrentIndexes',
-              parent=self.MainPanel, pos=wx.Point(400, 48), size=wx.Size(280,
-              320), style=wxLB_EXTENDED)
-        self.CurrentIndexes.Bind(wx.EVT_LEFT_DCLICK, self.OnCurrentIndexesDClick,
-              id=wxID_COMMUNICATIONDIALOGCURRENTINDEXES)
-
-        self.Select = wx.Button(id=wxID_COMMUNICATIONDIALOGSELECT, label='>>',
-              name='Select', parent=self.MainPanel, pos=wx.Point(345, 136),
-              size=wx.Size(32, 32), style=0)
-        self.Select.Bind(wx.EVT_BUTTON, self.OnSelectButton,
-              id=wxID_COMMUNICATIONDIALOGSELECT)
-
-        self.Unselect = wx.Button(id=wxID_COMMUNICATIONDIALOGUNSELECT,
-              label='<<', name='Unselect', parent=self.MainPanel,
-              pos=wx.Point(345, 216), size=wx.Size(32, 30), style=0)
-        self.Unselect.Bind(wx.EVT_BUTTON, self.OnUnselectButton,
-              id=wxID_COMMUNICATIONDIALOGUNSELECT)
-
-        self.staticText1 = wx.StaticText(id=wxID_COMMUNICATIONDIALOGSTATICTEXT1,
-              label='Possible Profile Indexes:', name='staticText1',
-              parent=self.MainPanel, pos=wx.Point(40, 24), size=wx.Size(156,
-              17), style=0)
-
-        self.staticText2 = wx.StaticText(id=wxID_COMMUNICATIONDIALOGSTATICTEXT2,
-              label='Current Profile Indexes:', name='staticText2',
-              parent=self.MainPanel, pos=wx.Point(400, 24), size=wx.Size(152,
-              17), style=0)
-
-        self._init_sizers()
-
-    def __init__(self, parent):
-        self._init_ctrls(parent)
-        self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL)
-        self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_CENTER)
-        self.AllList = []
-        self.CurrentList = []
-        self.IndexDictionary = {}
-
-    def SetIndexDictionary(self, dictionary):
-        self.IndexDictionary = dictionary
-        
-    def SetCurrentList(self, list):
-        self.CurrentList = []
-        self.CurrentList.extend(list)
-        self.CurrentList.sort()
-        
-    def GetCurrentList(self):
-        return self.CurrentList
-        
-    def RefreshLists(self):
-        self.PossibleIndexes.Clear()
-        self.CurrentIndexes.Clear()
-        self.AllList = []
-        for index in self.IndexDictionary.iterkeys():
-            if index not in self.CurrentList:
-                self.AllList.append(index)
-        self.AllList.sort()
-        for index in self.AllList:
-            self.PossibleIndexes.Append("0x%04X   %s"%(index, self.IndexDictionary[index][0]))
-        for index in self.CurrentList:
-            if index in self.IndexDictionary:
-                self.CurrentIndexes.Append("0x%04X   %s"%(index, self.IndexDictionary[index][0]))
-
-    def OnPossibleIndexesDClick(self, event):
-        self.SelectPossible()
-        event.Skip()
-
-    def OnCurrentIndexesDClick(self, event):
-        self.UnselectCurrent()
-        event.Skip()
-
-    def OnSelectButton(self, event):
-        self.SelectPossible()
-        event.Skip()
-
-    def OnUnselectButton(self, event):
-        self.UnselectCurrent()
-        event.Skip()
-
-    def SelectPossible(self):
-        selected = self.PossibleIndexes.GetSelections()
-        for i in selected:
-            self.CurrentList.append(self.AllList[i])
-        self.CurrentList.sort()
-        self.RefreshLists()
-
-    def UnselectCurrent(self):
-        selected = self.CurrentIndexes.GetSelections()
-        for i in selected:
-            if not self.IndexDictionary[self.CurrentList[i]][1]:
-                self.CurrentList.pop(i)
-        self.CurrentList.sort()
-        self.RefreshLists()
-
-
-
-#-------------------------------------------------------------------------------
-#                          Create Map Variable Dialog
-#-------------------------------------------------------------------------------
-
-
-[wxID_MAPVARIABLEDIALOG, wxID_MAPVARIABLEDIALOGINDEX, 
- wxID_MAPVARIABLEDIALOGINDEXNAME, wxID_MAPVARIABLEDIALOGMAINPANEL, 
- wxID_MAPVARIABLEDIALOGNUMBER, wxID_MAPVARIABLEDIALOGRADIOBUTTON1, 
- wxID_MAPVARIABLEDIALOGRADIOBUTTON2, wxID_MAPVARIABLEDIALOGRADIOBUTTON3, 
- wxID_MAPVARIABLEDIALOGSTATICTEXT1, wxID_MAPVARIABLEDIALOGSTATICTEXT2, 
- wxID_MAPVARIABLEDIALOGSTATICTEXT3, wxID_MAPVARIABLEDIALOGSTATICTEXT4, 
-] = [wx.NewId() for _init_ctrls in range(12)]
-
-class MapVariableDialog(wx.Dialog):
-    def _init_coll_flexGridSizer1_Items(self, parent):
-        # generated method, don't edit
-
-        parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
-
-    def _init_sizers(self):
-        # generated method, don't edit
-        self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
-
-        self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
-
-        self.SetSizer(self.flexGridSizer1)
-
-    def _init_ctrls(self, prnt):
-        # generated method, don't edit
-        wx.Dialog.__init__(self, id=wxID_MAPVARIABLEDIALOG,
-              name='CommunicationDialog', parent=prnt, pos=wx.Point(376, 223),
-              size=wx.Size(444, 186), style=wx.DEFAULT_DIALOG_STYLE,
-              title='Add Map Variable')
-        self.SetClientSize(wx.Size(444, 186))
-
-        self.MainPanel = wx.Panel(id=wxID_MAPVARIABLEDIALOGMAINPANEL,
-              name='MainPanel', parent=self, pos=wx.Point(0, 0),
-              size=wx.Size(431, 142), style=wx.TAB_TRAVERSAL)
-        self.MainPanel.SetAutoLayout(True)
-
-        self.staticText1 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT1,
-              label='Index:', name='staticText1', parent=self.MainPanel,
-              pos=wx.Point(24, 24), size=wx.Size(156, 17), style=0)
-
-        self.Index = wx.TextCtrl(id=wxID_MAPVARIABLEDIALOGINDEX, name='Index',
-              parent=self.MainPanel, pos=wx.Point(24, 48), size=wx.Size(152,
-              25), style=0, value='0x2000')
-
-        self.staticText3 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT3,
-              label='Name:', name='staticText3', parent=self.MainPanel,
-              pos=wx.Point(24, 80), size=wx.Size(47, 17), style=0)
-
-        self.IndexName = wx.TextCtrl(id=wxID_MAPVARIABLEDIALOGINDEXNAME,
-              name='IndexName', parent=self.MainPanel, pos=wx.Point(24, 104),
-              size=wx.Size(152, 24), style=0, value='Undefined')
-
-        self.staticText2 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT2,
-              label='Type:', name='staticText2', parent=self.MainPanel,
-              pos=wx.Point(208, 24), size=wx.Size(38, 17), style=0)
-
-        self.radioButton1 = wx.RadioButton(id=wxID_MAPVARIABLEDIALOGRADIOBUTTON1,
-              label='VAR', name='radioButton1', parent=self.MainPanel,
-              pos=wx.Point(208, 48), size=wx.Size(72, 24), style=wxRB_GROUP)
-        self.radioButton1.SetValue(True)
-        self.radioButton1.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton1Click,
-              id=wxID_MAPVARIABLEDIALOGRADIOBUTTON1)
-
-        self.radioButton2 = wx.RadioButton(id=wxID_MAPVARIABLEDIALOGRADIOBUTTON2,
-              label='ARRAY', name='radioButton2', parent=self.MainPanel,
-              pos=wx.Point(208, 72), size=wx.Size(80, 24), style=wxRB_SINGLE)
-        self.radioButton2.SetValue(False)
-        self.radioButton2.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton2Click,
-              id=wxID_MAPVARIABLEDIALOGRADIOBUTTON2)
-
-        self.radioButton3 = wx.RadioButton(id=wxID_MAPVARIABLEDIALOGRADIOBUTTON3,
-              label='REC', name='radioButton3', parent=self.MainPanel,
-              pos=wx.Point(208, 96), size=wx.Size(96, 24), style=wxRB_SINGLE)
-        self.radioButton3.SetValue(False)
-        self.radioButton3.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton3Click,
-              id=wxID_MAPVARIABLEDIALOGRADIOBUTTON3)
-
-        self.staticText4 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT4,
-              label='Number:', name='staticText4', parent=self.MainPanel,
-              pos=wx.Point(312, 80), size=wx.Size(88, 16), style=0)
-
-        self.Number = wx.TextCtrl(id=wxID_MAPVARIABLEDIALOGNUMBER,
-              name='Number', parent=self.MainPanel, pos=wx.Point(312, 104),
-              size=wx.Size(112, 24), style=wx.TE_RIGHT, value='0')
-
-        self._init_sizers()
-
-    def __init__(self, parent):
-        self._init_ctrls(parent)
-        self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL)
-        self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_CENTER)
-        self.staticText4.Enable(False)
-        self.Number.Enable(False)
-        
-        EVT_BUTTON(self, self.ButtonSizer.GetAffirmativeButton().GetId(), self.OnOK)
-
-    def SetIndex(self, index):
-        self.Index.SetValue("0x%04X"%index)
-
-    def OnOK(self, event):
-        error = []
-        try:
-            int(self.Index.GetValue(), 16)
-        except:
-            error.append("Index")
-        if self.radioButton2.GetValue() or self.radioButton3.GetValue():
-            try:
-                int(self.Number.GetValue())
-            except:
-                error.append("Number")
-        if len(error) > 0:
-            text = ""
-            if len(error) > 1:
-                suffix = "s"
-            else:
-                suffix = ""
-            for i, item in enumerate(error):
-                if i == 0:
-                    text += item
-                elif i == len(error) - 1:
-                    text += " and %s"%item
-                else:
-                    text += ", %s"%item
-            message = wxMessageDialog(self, "Form isn't valid. %s must be integer%s!"%(text,suffix), "Error", wxOK|wxICON_ERROR)
-            message.ShowModal()
-            message.Destroy()
-        else:
-            self.EndModal(wxID_OK)
-
-    def GetValues(self):
-        name = self.IndexName.GetValue()
-        index = int(self.Index.GetValue(), 16)
-        if self.radioButton1.GetValue():
-            struct = 1
-            number = None
-        elif self.radioButton2.GetValue():
-            struct = 3
-            number = int(self.Number.GetValue())
-        elif self.radioButton3.GetValue():
-            struct = 7
-            number = int(self.Number.GetValue())
-        return index, name, struct, number
-
-    def OnRadioButton1Click(self, event):
-        self.EnableNumberTyping(False)
-        event.Skip()
-
-    def OnRadioButton2Click(self, event):
-        self.EnableNumberTyping(True)
-        event.Skip()
-
-    def OnRadioButton3Click(self, event):
-        self.EnableNumberTyping(True)
-        event.Skip()
-
-    def EnableNumberTyping(self, enable):
-        self.staticText4.Enable(enable)
-        self.Number.Enable(enable)
-
-
-#-------------------------------------------------------------------------------
-#                          Create User Type Dialog
-#-------------------------------------------------------------------------------
-
-
-[wxID_USERTYPEDIALOG, wxID_USERTYPEDIALOGLENGTH, wxID_USERTYPEDIALOGMAINPANEL, 
- wxID_USERTYPEDIALOGMAX, wxID_USERTYPEDIALOGMIN, 
- wxID_USERTYPEDIALOGSTATICBOX1, wxID_USERTYPEDIALOGSTATICTEXT1, 
- wxID_USERTYPEDIALOGSTATICTEXT2, wxID_USERTYPEDIALOGSTATICTEXT3, 
- wxID_USERTYPEDIALOGSTATICTEXT4, wxID_USERTYPEDIALOGTYPE, 
-] = [wx.NewId() for _init_ctrls in range(11)]
-
-class UserTypeDialog(wx.Dialog):
-    def _init_coll_flexGridSizer1_Items(self, parent):
-        # generated method, don't edit
-
-        parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
-
-    def _init_sizers(self):
-        # generated method, don't edit
-        self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
-
-        self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
-
-        self.SetSizer(self.flexGridSizer1)
-
-    def _init_ctrls(self, prnt):
-        # generated method, don't edit
-        wx.Dialog.__init__(self, id=wxID_USERTYPEDIALOG, name='UserTypeDialog',
-              parent=prnt, pos=wx.Point(376, 223), size=wx.Size(444, 228),
-              style=wx.DEFAULT_DIALOG_STYLE, title='Add User Type')
-        self.SetClientSize(wx.Size(444, 228))
-
-        self.MainPanel = wx.Panel(id=wxID_USERTYPEDIALOGMAINPANEL,
-              name='MainPanel', parent=self, pos=wx.Point(0, 0),
-              size=wx.Size(431, 182), style=wx.TAB_TRAVERSAL)
-        self.MainPanel.SetAutoLayout(True)
-
-        self.staticText1 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT1,
-              label='Type:', name='staticText1', parent=self.MainPanel,
-              pos=wx.Point(24, 24), size=wx.Size(156, 17), style=0)
-
-        self.Type = wx.Choice(choices=[], id=wxID_USERTYPEDIALOGTYPE,
-              name='Type', parent=self.MainPanel, pos=wx.Point(24, 48),
-              size=wx.Size(160, 24), style=0)
-        self.Type.Bind(wx.EVT_CHOICE, self.OnTypeChoice,
-              id=wxID_USERTYPEDIALOGTYPE)
-
-        self.staticBox1 = wx.StaticBox(id=wxID_USERTYPEDIALOGSTATICBOX1,
-              label='Values', name='staticBox1', parent=self.MainPanel,
-              pos=wx.Point(200, 24), size=wx.Size(224, 144), style=0)
-
-        self.staticText2 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT2,
-              label='Minimum:', name='staticText2', parent=self.MainPanel,
-              pos=wx.Point(216, 48), size=wx.Size(67, 17), style=0)
-
-        self.Min = wx.TextCtrl(id=wxID_USERTYPEDIALOGMIN, name='Min',
-              parent=self.MainPanel, pos=wx.Point(296, 48), size=wx.Size(112,
-              24), style=wx.TE_RIGHT, value='0')
-
-        self.staticText3 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT3,
-              label='Maximum:', name='staticText3', parent=self.MainPanel,
-              pos=wx.Point(216, 88), size=wx.Size(71, 17), style=0)
-
-        self.Max = wx.TextCtrl(id=wxID_USERTYPEDIALOGMAX, name='Max',
-              parent=self.MainPanel, pos=wx.Point(296, 88), size=wx.Size(112,
-              25), style=wx.TE_RIGHT, value='0')
-
-        self.staticText4 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT4,
-              label='Length:', name='staticText4', parent=self.MainPanel,
-              pos=wx.Point(216, 128), size=wx.Size(52, 17), style=0)
-
-        self.Length = wx.TextCtrl(id=wxID_USERTYPEDIALOGLENGTH, name='Length',
-              parent=self.MainPanel, pos=wx.Point(296, 128), size=wx.Size(112,
-              25), style=wx.TE_RIGHT, value='0')
-
-        self._init_sizers()
-
-    def __init__(self, parent):
-        self._init_ctrls(parent)
-        self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL)
-        self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_CENTER)
-        self.TypeDictionary = {}
-
-        EVT_BUTTON(self, self.ButtonSizer.GetAffirmativeButton().GetId(), self.OnOK)
-
-    def OnOK(self, event):
-        error = []
-        good = True
-        firstmessage = ""
-        secondmessage = ""
-        name = self.Type.GetStringSelection()
-        if name != "":
-            valuetype = self.TypeDictionary[name][1]
-            if valuetype == 0:
-                try:
-                    int(self.Min.GetValue(), 16)
-                except:
-                    error.append("Minimum")
-                    good = False
-                try:
-                    int(self.Max.GetValue(), 16)
-                except:
-                    error.append("Maximum")
-                    good = False
-            elif valuetype == 1:
-                try:
-                    int(self.Length.GetValue(), 16)
-                except:
-                    error.append("Length")
-                    good = False
-            if len(error) > 0:
-                secondmessage = ". "
-                for i, item in enumerate(error):
-                    if i == 0:
-                        secondmessage += item
-                    elif i == len(error) - 1:
-                        secondmessage += " and %s"%item
-                    else:
-                        secondmessage += ", %s"%item
-                secondmessage += " must be integer"
-                if len(error) > 1:
-                    secondmessage += "s"
-        else:
-            firstmessage = ". A type must be selected"
-            good = False
-        if not good:
-            message = wxMessageDialog(self, "Form isn't valid%s%s%s!"%(firstmessage,secondmessage), "Error", wxOK|wxICON_ERROR)
-            message.ShowModal()
-            message.Destroy()
-            self.Name.SetFocus()
-        else:
-            self.EndModal(wxID_OK)
-
-    def SetValues(self, min = None, max = None, length = None):
-        if min != None:
-            self.Min.SetValue(str(min))
-        if max != None:
-            self.Max.SetValue(str(max))
-        if length != None:
-            self.Length.SetValue(str(length))
-
-    def SetTypeList(self, typedic, type = None):
-        self.Type.Clear()
-        list = []
-        for index, (name, valuetype) in typedic.iteritems():
-            self.TypeDictionary[name] = (index, valuetype)
-            list.append((index, name))
-        list.sort()
-        for index, name in list:
-            self.Type.Append(name)
-        if type != None:
-            self.Type.SetStringSelection(typedic[type][0])
-        self.RefreshValues()
-
-    def OnTypeChoice(self, event):
-        self.RefreshValues()
-        event.Skip()
-    
-    def RefreshValues(self):
-        name = self.Type.GetStringSelection()
-        if name != "":
-            valuetype = self.TypeDictionary[name][1]
-            if valuetype == 0:
-                self.staticText2.Enable(True)
-                self.staticText3.Enable(True)
-                self.staticText4.Enable(False)
-                self.Min.Enable(True)
-                self.Max.Enable(True)
-                self.Length.Enable(False)
-            elif valuetype == 1:
-                self.staticText2.Enable(False)
-                self.staticText3.Enable(False)
-                self.staticText4.Enable(True)
-                self.Min.Enable(False)
-                self.Max.Enable(False)
-                self.Length.Enable(True)
-        else:
-            self.staticText2.Enable(False)
-            self.staticText3.Enable(False)
-            self.staticText4.Enable(False)
-            self.Min.Enable(False)
-            self.Max.Enable(False)
-            self.Length.Enable(False)
-
-    def GetValues(self):
-        name = self.Type.GetStringSelection()
-        type = self.TypeDictionary[name][0]
-        min = int(self.Min.GetValue())
-        max = int(self.Max.GetValue())
-        length = int(self.Length.GetValue())
-        return type, min, max, length
-
-
-
-#-------------------------------------------------------------------------------
-#                          Editing Node Infos Dialog
-#-------------------------------------------------------------------------------
-
-
-[wxID_NODEINFOSDIALOG, wxID_NODEINFOSDIALOGMAINPANEL, 
- wxID_NODEINFOSDIALOGNAME, wxID_NODEINFOSDIALOGNODEID, 
- wxID_NODEINFOSDIALOGDESCRIPTION, wxID_NODEINFOSDIALOGSTATICTEXT1, 
- wxID_NODEINFOSDIALOGSTATICTEXT2, wxID_NODEINFOSDIALOGSTATICTEXT3, 
- wxID_NODEINFOSDIALOGSTATICTEXT4, wxID_NODEINFOSDIALOGTYPE, 
-] = [wx.NewId() for _init_ctrls in range(10)]
-
-class NodeInfosDialog(wx.Dialog):
-    def _init_coll_flexGridSizer1_Items(self, parent):
-        # generated method, don't edit
-
-        parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
-
-    def _init_sizers(self):
-        # generated method, don't edit
-        self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
-
-        self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
-
-        self.SetSizer(self.flexGridSizer1)
-
-    def _init_ctrls(self, prnt):
-        # generated method, don't edit
-        wx.Dialog.__init__(self, id=wxID_NODEINFOSDIALOG,
-              name='NodeInfosDialog', parent=prnt, pos=wx.Point(376, 223),
-              size=wx.Size(300, 300), style=wx.DEFAULT_DIALOG_STYLE,
-              title='Node Infos')
-        self.SetClientSize(wx.Size(300, 300))
-
-        self.MainPanel = wx.Panel(id=wxID_NODEINFOSDIALOGMAINPANEL,
-              name='MainPanel', parent=self, pos=wx.Point(0, 0),
-              size=wx.Size(280, 264), style=wx.TAB_TRAVERSAL)
-        self.MainPanel.SetAutoLayout(True)
-
-        self.staticText1 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT1,
-              label='Name:', 
-              name='staticText1', parent=self.MainPanel,
-              pos=wx.Point(24, 24), size=wx.Size(156, 17), style=0)
-
-        self.Name = wx.TextCtrl(id=wxID_NODEINFOSDIALOGNAME, name='Name',
-              parent=self.MainPanel, pos=wx.Point(24, 48), size=wx.Size(250,
-              25), style=0, value='')
-
-        self.staticText2 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT2,
-              label='Node ID:', name='staticText2', parent=self.MainPanel,
-              pos=wx.Point(24, 80), size=wx.Size(67, 17), style=0)
-
-        self.NodeID = wx.TextCtrl(id=wxID_NODEINFOSDIALOGNODEID, name='NodeID',
-              parent=self.MainPanel, pos=wx.Point(24, 104), size=wx.Size(250,
-              25), style=wx.TE_RIGHT, value='')
-
-        self.staticText3 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT3,
-              label='Type:', name='staticText3', parent=self.MainPanel,
-              pos=wx.Point(24, 136), size=wx.Size(71, 17), style=0)
-
-        self.Type = wx.Choice(choices=[], id=wxID_NODEINFOSDIALOGTYPE,
-              name='Type', parent=self.MainPanel, pos=wx.Point(24, 160),
-              size=wx.Size(250, 25), style=0)
-
-        self.staticText4 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT4,
-              label='Description:', name='staticText4', parent=self.MainPanel,
-              pos=wx.Point(24, 192), size=wx.Size(71, 17), style=0)
-
-        self.Description = wx.TextCtrl(id=wxID_NODEINFOSDIALOGDESCRIPTION, 
-              name='Description', parent=self.MainPanel, pos=wx.Point(24, 216), 
-              size=wx.Size(250, 25), style=0, value='')
-
-        self._init_sizers()
-
-    def __init__(self, parent):
-        self._init_ctrls(parent)
-        self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL)
-        self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_CENTER)
-        self.Type.Append("master")
-        self.Type.Append("slave")
-
-        EVT_BUTTON(self, self.ButtonSizer.GetAffirmativeButton().GetId(), self.OnOK)
-
-    def OnOK(self, event):
-        name = self.Name.GetValue()
-        message = ""
-        if name != "":
-            good = not name[0].isdigit()
-            for item in name.split("_"):
-                good &= item.isalnum()
-            if not good:
-                message = "Node name can't be undefined or start with a digit and must be composed of alphanumerical characters or underscore!"
-        if message != "":
-            try:
-                nodeid = int(self.NodeID.GetValue(), 16)
-            except:
-                message = "Node ID must be integer!"
-        if message != "":
-            message = wxMessageDialog(self, message, "ERROR", wxOK|wxICON_ERROR)
-            message.ShowModal()
-            message.Destroy()
-            self.Name.SetFocus()
-        else:
-            self.EndModal(wxID_OK)
-    
-    def SetValues(self, name, id, type, description):
-        self.Name.SetValue(name)
-        self.NodeID.SetValue("0x%02X"%id)
-        self.Type.SetStringSelection(type)
-        self.Description.SetValue(description)
-
-    def GetValues(self):
-        name = self.Name.GetValue()
-        nodeid = int(self.NodeID.GetValue(), 16)
-        type = self.Type.GetStringSelection()
-        description = self.Description.GetValue()
-        return name, nodeid, type, description
-
-
-
-#-------------------------------------------------------------------------------
-#                          Create New Node Dialog
-#-------------------------------------------------------------------------------
-
-
-[wxID_CREATENODEDIALOG, wxID_CREATENODEDIALOGEMERGENCY, 
- wxID_CREATENODEDIALOGGENSYNC, wxID_CREATENODEDIALOGMAINPANEL, 
- wxID_CREATENODEDIALOGNAME, wxID_CREATENODEDIALOGNMT_HEARTBEAT, 
- wxID_CREATENODEDIALOGNMT_NODEGUARDING, wxID_CREATENODEDIALOGNMT_NONE, 
- wxID_CREATENODEDIALOGNODEID, wxID_CREATENODEDIALOGPROFILE, 
- wxID_CREATENODEDIALOGSAVECONFIG, wxID_CREATENODEDIALOGSTATICTEXT1, 
- wxID_CREATENODEDIALOGSTATICTEXT2, wxID_CREATENODEDIALOGSTATICTEXT3, 
- wxID_CREATENODEDIALOGSTATICTEXT4, wxID_CREATENODEDIALOGSTATICTEXT5, 
- wxID_CREATENODEDIALOGSTATICTEXT6, wxID_CREATENODEDIALOGSTATICTEXT7,
- wxID_CREATENODEDIALOGSTOREEDS, wxID_CREATENODEDIALOGDESCRIPTION,
- wxID_CREATENODEDIALOGTYPE, 
-] = [wx.NewId() for _init_ctrls in range(21)]
-
-class CreateNodeDialog(wx.Dialog):
-    def _init_coll_flexGridSizer1_Items(self, parent):
-        # generated method, don't edit
-
-        parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
-
-    def _init_sizers(self):
-        # generated method, don't edit
-        self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
-
-        self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
-
-        self.SetSizer(self.flexGridSizer1)
-
-    def _init_ctrls(self, prnt):
-        # generated method, don't edit
-        wx.Dialog.__init__(self, id=wxID_CREATENODEDIALOG,
-              name='CreateNodeDialog', parent=prnt, pos=wx.Point(376, 223),
-              size=wx.Size(451, 376), style=wx.DEFAULT_DIALOG_STYLE,
-              title='Create a new Node')
-        self.SetClientSize(wx.Size(451, 376))
-
-        self.MainPanel = wx.Panel(id=wxID_CREATENODEDIALOGMAINPANEL,
-              name='MainPanel', parent=self, pos=wx.Point(0, 0),
-              size=wx.Size(440, 278), style=wx.TAB_TRAVERSAL)
-        self.MainPanel.SetAutoLayout(True)
-
-        self.staticText1 = wx.StaticText(id=wxID_CREATENODEDIALOGSTATICTEXT1,
-              label='Name:', name='staticText1', parent=self.MainPanel,
-              pos=wx.Point(24, 24), size=wx.Size(156, 17), style=0)
-
-        self.staticText2 = wx.StaticText(id=wxID_CREATENODEDIALOGSTATICTEXT2,
-              label='Node ID:', name='staticText2', parent=self.MainPanel,
-              pos=wx.Point(24, 80), size=wx.Size(67, 17), style=0)
-
-        self.staticText3 = wx.StaticText(id=wxID_CREATENODEDIALOGSTATICTEXT3,
-              label='Type:', name='staticText3', parent=self.MainPanel,
-              pos=wx.Point(24, 136), size=wx.Size(71, 17), style=0)
-
-        self.Type = wx.Choice(choices=[], id=wxID_CREATENODEDIALOGTYPE,
-              name='Type', parent=self.MainPanel, pos=wx.Point(24, 160),
-              size=wx.Size(200, 24), style=0)
-
-        self.Name = wx.TextCtrl(id=wxID_CREATENODEDIALOGNAME, name='Name',
-              parent=self.MainPanel, pos=wx.Point(24, 48), size=wx.Size(200,
-              25), style=0, value='')
-
-        self.NodeID = wx.TextCtrl(id=wxID_CREATENODEDIALOGNODEID, name='NodeID',
-              parent=self.MainPanel, pos=wx.Point(24, 104), size=wx.Size(200,
-              25), style=wx.TE_RIGHT, value='')
-
-        self.staticText4 = wx.StaticText(id=wxID_CREATENODEDIALOGSTATICTEXT4,
-              label='Profile:', name='staticText4', parent=self.MainPanel,
-              pos=wx.Point(24, 192), size=wx.Size(47, 17), style=0)
-
-        self.Profile = wx.Choice(choices=[], id=wxID_CREATENODEDIALOGPROFILE,
-              name='Profile', parent=self.MainPanel, pos=wx.Point(24, 216),
-              size=wx.Size(200, 24), style=0)
-        self.Profile.Bind(wx.EVT_CHOICE, self.OnProfileChoice,
-              id=wxID_CREATENODEDIALOGPROFILE)
-
-        self.staticText5 = wx.StaticText(id=wxID_CREATENODEDIALOGSTATICTEXT5,
-              label='Network Management:', name='staticText5',
-              parent=self.MainPanel, pos=wx.Point(256, 24), size=wx.Size(152,
-              16), style=0)
-
-        self.NMT_None = wx.RadioButton(id=wxID_CREATENODEDIALOGNMT_NONE,
-              label='None', name='NMT_None', parent=self.MainPanel,
-              pos=wx.Point(256, 40), size=wx.Size(114, 24), style=0)
-        self.NMT_None.SetValue(True)
-
-        self.NMT_NodeGuarding = wx.RadioButton(id=wxID_CREATENODEDIALOGNMT_NODEGUARDING,
-              label='Node Guarding', name='NMT_NodeGuarding',
-              parent=self.MainPanel, pos=wx.Point(256, 64), size=wx.Size(128,
-              24), style=0)
-        self.NMT_NodeGuarding.SetValue(False)
-
-        self.NMT_Heartbeat = wx.RadioButton(id=wxID_CREATENODEDIALOGNMT_HEARTBEAT,
-              label='Heartbeat', name='NMT_Heartbeat', parent=self.MainPanel,
-              pos=wx.Point(256, 88), size=wx.Size(114, 24), style=0)
-        self.NMT_Heartbeat.SetValue(False)
-
-        self.staticText6 = wx.StaticText(id=wxID_CREATENODEDIALOGSTATICTEXT6,
-              label='Options:', name='staticText6', parent=self.MainPanel,
-              pos=wx.Point(256, 128), size=wx.Size(72, 17), style=0)
-
-        self.DS302 = wx.CheckBox(id=wxID_CREATENODEDIALOGGENSYNC,
-              label='DS-302 Profile', name='DS302', parent=self.MainPanel,
-              pos=wx.Point(256, 144), size=wx.Size(128, 24), style=0)
-        self.DS302.SetValue(False)
-        #self.DS302.Enable(False)
-
-        self.GenSYNC = wx.CheckBox(id=wxID_CREATENODEDIALOGGENSYNC,
-              label='Generate SYNC', name='GenSYNC', parent=self.MainPanel,
-              pos=wx.Point(256, 168), size=wx.Size(128, 24), style=0)
-        self.GenSYNC.SetValue(False)
-
-        self.Emergency = wx.CheckBox(id=wxID_CREATENODEDIALOGEMERGENCY,
-              label='Emergency support', name='Emergency',
-              parent=self.MainPanel, pos=wx.Point(256, 192), size=wx.Size(152,
-              24), style=0)
-        self.Emergency.SetValue(False)
-        self.Emergency.Enable(False)
-
-        self.SaveConfig = wx.CheckBox(id=wxID_CREATENODEDIALOGSAVECONFIG,
-              label='Save Configuration', name='SaveConfig',
-              parent=self.MainPanel, pos=wx.Point(256, 216), size=wx.Size(152,
-              24), style=0)
-        self.SaveConfig.SetValue(False)
-        self.SaveConfig.Enable(False)
-
-#        self.StoreEDS = wx.CheckBox(id=wxID_CREATENODEDIALOGSTOREEDS,
-#              label='Store EDS', name='StoreEDS', parent=self.MainPanel,
-#              pos=wx.Point(256, 240), size=wx.Size(144, 24), style=0)
-#        self.StoreEDS.SetValue(False)
-
-        self.staticText7 = wx.StaticText(id=wxID_CREATENODEDIALOGSTATICTEXT7,
-              label='Description:', name='staticText7', parent=self.MainPanel,
-              pos=wx.Point(24, 248), size=wx.Size(71, 17), style=0)
-
-        self.Description = wx.TextCtrl(id=wxID_CREATENODEDIALOGDESCRIPTION, 
-              name='Description', parent=self.MainPanel, pos=wx.Point(24, 272), 
-              size=wx.Size(400, 25), style=0, value='')
-
-        self._init_sizers()
-
-    def __init__(self, parent):
-        self._init_ctrls(parent)
-        self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL)
-        self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_CENTER)
-        self.NodeID.SetValue("0x00")
-        self.Type.Append("master")
-        self.Type.Append("slave")
-        self.Type.SetStringSelection("slave")
-        self.Description.SetValue("")
-        self.ListProfile = {"None" : ""}
-        self.Profile.Append("None")
-        self.Directory = os.path.join(ScriptDirectory, "config")
-        listfiles = os.listdir(self.Directory)
-        listfiles.sort()
-        for item in listfiles:
-            name, extend = os.path.splitext(item)
-            if os.path.isfile(os.path.join(self.Directory, item)) and extend == ".prf" and name != "DS-302":
-                self.ListProfile[name] = os.path.join(self.Directory, item)
-                self.Profile.Append(name)
-        self.Profile.Append("Other")
-        self.Profile.SetStringSelection("None")
-        self.Name.SetFocus()
-        
-        EVT_BUTTON(self, self.ButtonSizer.GetAffirmativeButton().GetId(), self.OnOK)
-
-    def OnOK(self, event):
-        name = self.Name.GetValue()
-        message = ""
-        if name != "":
-            good = not name[0].isdigit()
-            for item in name.split("_"):
-                good &= item.isalnum()
-            if not good:
-                message = "Node name can't be undefined or start with a digit and must be composed of alphanumerical characters or underscore!"
-        if message != "":
-            try:
-                nodeid = int(self.NodeID.GetValue(), 16)
-            except:
-                message = "Node ID must be an integer!"
-        if message != "":
-            message = wxMessageDialog(self, message, "ERROR", wxOK|wxICON_ERROR)
-            message.ShowModal()
-            message.Destroy()
-            self.Name.SetFocus()
-        else:
-            self.EndModal(wxID_OK)
-
-    def GetValues(self):
-        name = self.Name.GetValue()
-        nodeid = 0
-        if self.NodeID.GetValue() != "":
-            nodeid = int(self.NodeID.GetValue(), 16)
-        type = self.Type.GetStringSelection()
-        description = self.Description.GetValue()
-        return name, nodeid, type, description
-
-    def GetProfile(self):
-        name = self.Profile.GetStringSelection()
-        return name, self.ListProfile[name]
-
-    def GetNMTManagement(self):
-        if self.NMT_None.GetValue():
-            return "None"
-        elif self.NMT_NodeGuarding.GetValue():
-            return "NodeGuarding"
-        elif self.NMT_Heartbeat.GetValue():
-            return "Heartbeat"
-        return None
-    
-    def GetOptions(self):
-        options = []
-        if self.DS302.GetValue():
-            options.append("DS302")
-        if self.GenSYNC.GetValue():
-            options.append("GenSYNC")
-        if self.Emergency.GetValue():
-            options.append("Emergency")
-        if self.SaveConfig.GetValue():
-            options.append("SaveConfig")
-#        if self.StoreEDS.GetValue():
-#            options.append("StoreEDS")
-        return options
-
-    def OnProfileChoice(self, event):
-        if self.Profile.GetStringSelection() == "Other":
-            dialog = wxFileDialog(self, "Choose a file", self.Directory, "",  "OD Profile files (*.prf)|*.prf|All files|*.*", wxOPEN|wxCHANGE_DIR)
-            dialog.ShowModal()
-            filepath = dialog.GetPath()
-            dialog.Destroy()
-            if os.path.isfile(filepath):
-                name = os.path.splitext(os.path.basename(filepath))[0]
-                self.ListProfile[name] = filepath
-                length = self.Profile.GetCount()
-                self.Profile.Insert(name, length - 2)
-                self.Profile.SetStringSelection(name)
-            else:
-                self.Profile.SetStringSelection("None")
-        event.Skip()
     
 
 #-------------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/objdictgen/subindextable.py	Mon May 28 18:08:24 2007 +0200
@@ -0,0 +1,726 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+#This file is part of CanFestival, a library implementing CanOpen Stack. 
+#
+#Copyright (C): Edouard TISSERANT, Francis DUPIN and Laurent BESSARD
+#
+#See COPYING file for copyrights details.
+#
+#This library is free software; you can redistribute it and/or
+#modify it under the terms of the GNU Lesser General Public
+#License as published by the Free Software Foundation; either
+#version 2.1 of the License, or (at your option) any later version.
+#
+#This library is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#Lesser General Public License for more details.
+#
+#You should have received a copy of the GNU Lesser General Public
+#License along with this library; if not, write to the Free Software
+#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+from wxPython.wx import *
+from wxPython.grid import *
+import wx
+import wx.grid
+
+from types import *
+
+
+ColSizes = [75, 250, 150, 125, 100, 60, 250]
+ColAlignements = [wxALIGN_CENTER, wxALIGN_LEFT, wxALIGN_CENTER, wxALIGN_RIGHT, wxALIGN_CENTER, wxALIGN_CENTER, wxALIGN_LEFT]
+AccessList = "Read Only,Write Only,Read/Write"
+RAccessList = "Read Only,Read/Write"
+BoolList = "True,False"
+OptionList = "Yes,No"
+
+DictionaryOrganisation = [
+    {"minIndex" : 0x0001, "maxIndex" : 0x0FFF, "name" : "Data Type Definitions"},
+    {"minIndex" : 0x1000, "maxIndex" : 0x1029, "name" : "Communication Parameters"},
+    {"minIndex" : 0x1200, "maxIndex" : 0x12FF, "name" : "SDO Parameters"},
+    {"minIndex" : 0x1400, "maxIndex" : 0x15FF, "name" : "Receive PDO Parameters"},
+    {"minIndex" : 0x1600, "maxIndex" : 0x17FF, "name" : "Receive PDO Mapping"},
+    {"minIndex" : 0x1800, "maxIndex" : 0x19FF, "name" : "Transmit PDO Parameters"},
+    {"minIndex" : 0x1A00, "maxIndex" : 0x1BFF, "name" : "Transmit PDO Mapping"},
+    {"minIndex" : 0x1C00, "maxIndex" : 0x1FFF, "name" : "Other Communication Parameters"},
+    {"minIndex" : 0x2000, "maxIndex" : 0x5FFF, "name" : "Manufacturer Specific"},
+    {"minIndex" : 0x6000, "maxIndex" : 0x9FFF, "name" : "Standardized Device Profile"},
+    {"minIndex" : 0xA000, "maxIndex" : 0xBFFF, "name" : "Standardized Interface Profile"}]
+
+class SubindexTable(wxPyGridTableBase):
+    
+    """
+    A custom wxGrid Table using user supplied data
+    """
+    def __init__(self, parent, data, editors, colnames):
+        # The base class must be initialized *first*
+        wxPyGridTableBase.__init__(self)
+        self.data = data
+        self.editors = editors
+        self.CurrentIndex = 0
+        self.colnames = colnames
+        self.Parent = parent
+        self.Editable = True
+        # XXX
+        # we need to store the row length and collength to
+        # see if the table has changed size
+        self._rows = self.GetNumberRows()
+        self._cols = self.GetNumberCols()
+    
+    def Disable(self):
+        self.Editable = False
+        
+    def Enable(self):
+        self.Editable = True
+    
+    def GetNumberCols(self):
+        return len(self.colnames)
+        
+    def GetNumberRows(self):
+        return len(self.data)
+
+    def GetColLabelValue(self, col):
+        if col < len(self.colnames):
+            return self.colnames[col]
+
+    def GetRowLabelValues(self, row):
+        return row
+
+    def GetValue(self, row, col):
+        if row < self.GetNumberRows():
+            value = self.data[row].get(self.GetColLabelValue(col), "")
+            if (type(value) == UnicodeType):
+                return value
+            else: 
+                return str(value)
+    
+    def GetEditor(self, row, col):
+        if row < self.GetNumberRows():
+            return self.editors[row].get(self.GetColLabelValue(col), "")
+    
+    def GetValueByName(self, row, colname):
+        return self.data[row].get(colname)
+
+    def SetValue(self, row, col, value):
+        if col < len(self.colnames):
+            self.data[row][self.GetColLabelValue(col)] = value
+        
+    def ResetView(self, grid):
+        """
+        (wxGrid) -> Reset the grid view.   Call this to
+        update the grid if rows and columns have been added or deleted
+        """
+        grid.BeginBatch()
+        for current, new, delmsg, addmsg in [
+            (self._rows, self.GetNumberRows(), wxGRIDTABLE_NOTIFY_ROWS_DELETED, wxGRIDTABLE_NOTIFY_ROWS_APPENDED),
+            (self._cols, self.GetNumberCols(), wxGRIDTABLE_NOTIFY_COLS_DELETED, wxGRIDTABLE_NOTIFY_COLS_APPENDED),
+        ]:
+            if new < current:
+                msg = wxGridTableMessage(self,delmsg,new,current-new)
+                grid.ProcessTableMessage(msg)
+            elif new > current:
+                msg = wxGridTableMessage(self,addmsg,new-current)
+                grid.ProcessTableMessage(msg)
+                self.UpdateValues(grid)
+        grid.EndBatch()
+
+        self._rows = self.GetNumberRows()
+        self._cols = self.GetNumberCols()
+        # update the column rendering scheme
+        self._updateColAttrs(grid)
+
+        # update the scrollbars and the displayed part of the grid
+        grid.AdjustScrollbars()
+        grid.ForceRefresh()
+
+
+    def UpdateValues(self, grid):
+        """Update all displayed values"""
+        # This sends an event to the grid table to update all of the values
+        msg = wxGridTableMessage(self, wxGRIDTABLE_REQUEST_VIEW_GET_VALUES)
+        grid.ProcessTableMessage(msg)
+
+    def _updateColAttrs(self, grid):
+        """
+        wxGrid -> update the column attributes to add the
+        appropriate renderer given the column name.
+
+        Otherwise default to the default renderer.
+        """
+        
+        for col in range(self.GetNumberCols()):
+            attr = wxGridCellAttr()
+            attr.SetAlignment(ColAlignements[col], wxALIGN_CENTRE)
+            grid.SetColAttr(col, attr)
+            grid.SetColSize(col, ColSizes[col])
+        
+        typelist = None
+        maplist = None
+        for row in range(self.GetNumberRows()):
+            editors = self.editors[row]
+            for col in range(self.GetNumberCols()):
+                editor = None
+                renderer = None
+                
+                colname = self.GetColLabelValue(col)
+                editortype = editors[colname]
+                if editortype and self.Editable:
+                    grid.SetReadOnly(row, col, False)
+                    if editortype == "string":
+                        editor = wxGridCellTextEditor()
+                        renderer = wxGridCellStringRenderer()
+                        if colname == "value" and "length" in editors:
+                            editor.SetParameters(editors["length"]) 
+                    elif editortype == "number":
+                        editor = wxGridCellNumberEditor()
+                        renderer = wxGridCellNumberRenderer()
+                        if colname == "value" and "min" in editors and "max" in editors:
+                            editor.SetParameters("%s,%s"%(editors["min"],editors["max"]))
+                    elif editortype == "real":
+                        editor = wxGridCellFloatEditor()
+                        renderer = wxGridCellFloatRenderer()
+                        if colname == "value" and "min" in editors and "max" in editors:
+                            editor.SetParameters("%s,%s"%(editors["min"],editors["max"]))
+                    elif editortype == "bool":
+                        editor = wxGridCellChoiceEditor()
+                        editor.SetParameters(BoolList)
+                    elif editortype == "access":
+                        editor = wxGridCellChoiceEditor()
+                        editor.SetParameters(AccessList)
+                    elif editortype == "raccess":
+                        editor = wxGridCellChoiceEditor()
+                        editor.SetParameters(RAccessList)
+                    elif editortype == "option":
+                        editor = wxGridCellChoiceEditor()
+                        editor.SetParameters(OptionList)
+                    elif editortype == "type":
+                        editor = wxGridCellChoiceEditor()
+                        if typelist == None:
+                            typelist = self.Parent.Manager.GetCurrentTypeList()
+                        editor.SetParameters(typelist)
+                    elif editortype == "map":
+                        editor = wxGridCellChoiceEditor()
+                        if maplist == None:
+                            maplist = self.Parent.Manager.GetCurrentMapList()
+                        editor.SetParameters(maplist)
+                    elif editortype == "time":
+                        editor = wxGridCellTextEditor()
+                        renderer = wxGridCellStringRenderer()
+                    elif editortype == "domain":
+                        editor = wxGridCellTextEditor()
+                        renderer = wxGridCellStringRenderer()
+                else:
+                    grid.SetReadOnly(row, col, True)
+                    
+                grid.SetCellEditor(row, col, editor)
+                grid.SetCellRenderer(row, col, renderer)
+                
+                grid.SetCellBackgroundColour(row, col, wxWHITE)
+    
+    def SetData(self, data):
+        self.data = data
+        
+    def SetEditors(self, editors):
+        self.editors = editors
+    
+    def GetCurrentIndex(self):
+        return self.CurrentIndex
+    
+    def SetCurrentIndex(self, index):
+        self.CurrentIndex = index
+    
+    def AppendRow(self, row_content):
+        self.data.append(row_content)
+
+    def Empty(self):
+        self.data = []
+        self.editors = []
+
+[wxID_EDITINGPANEL, wxID_EDITINGPANELADDBUTTON, wxID_EDITINGPANELINDEXCHOICE, 
+ wxID_EDITINGPANELINDEXLIST, wxID_EDITINGPANELINDEXLISTPANEL, wxID_EDITINGPANELPARTLIST, 
+ wxID_EDITINGPANELSECONDSPLITTER, wxID_EDITINGPANELSUBINDEXGRID,
+ wxID_EDITINGPANELSUBINDEXGRIDPANEL, wxID_EDITINGPANELCALLBACKCHECK,
+] = [wx.NewId() for _init_ctrls in range(10)]
+
+[wxID_EDITINGPANELINDEXLISTMENUITEMS0, wxID_EDITINGPANELINDEXLISTMENUITEMS1, 
+ wxID_EDITINGPANELINDEXLISTMENUITEMS2, 
+] = [wx.NewId() for _init_coll_IndexListMenu_Items in range(3)]
+
+[wxID_EDITINGPANELMENU1ITEMS0, wxID_EDITINGPANELMENU1ITEMS1, 
+] = [wx.NewId() for _init_coll_SubindexGridMenu_Items in range(2)]
+
+class EditingPanel(wx.SplitterWindow):
+    def _init_coll_AddToListSizer_Items(self, parent):
+        # generated method, don't edit
+
+        parent.AddWindow(self.AddButton, 0, border=0, flag=0)
+        parent.AddWindow(self.IndexChoice, 0, border=0, flag=wxGROW)
+
+    def _init_coll_SubindexGridSizer_Items(self, parent):
+        # generated method, don't edit
+
+        parent.AddWindow(self.CallbackCheck, 0, border=0, flag=0)
+        parent.AddWindow(self.SubindexGrid, 0, border=0, flag=wxGROW)
+
+    def _init_coll_IndexListSizer_Items(self, parent):
+        # generated method, don't edit
+
+        parent.AddWindow(self.IndexList, 0, border=0, flag=wxGROW)
+        parent.AddSizer(self.AddToListSizer, 0, border=0, flag=wxGROW)
+
+    def _init_coll_AddToListSizer_Growables(self, parent):
+        # generated method, don't edit
+
+        parent.AddGrowableCol(1)
+
+    def _init_coll_SubindexGridSizer_Growables(self, parent):
+        # generated method, don't edit
+
+        parent.AddGrowableCol(0)
+        parent.AddGrowableRow(1)
+
+    def _init_coll_IndexListSizer_Growables(self, parent):
+        # generated method, don't edit
+
+        parent.AddGrowableCol(0)
+        parent.AddGrowableRow(0)
+
+    def _init_coll_SubindexGridMenu_Items(self, parent):
+        # generated method, don't edit
+
+        parent.Append(help='', id=wxID_EDITINGPANELMENU1ITEMS0,
+              kind=wx.ITEM_NORMAL, text='Add')
+        parent.Append(help='', id=wxID_EDITINGPANELMENU1ITEMS1,
+              kind=wx.ITEM_NORMAL, text='Delete')
+        self.Bind(wx.EVT_MENU, self.OnAddSubindexMenu,
+              id=wxID_EDITINGPANELMENU1ITEMS0)
+        self.Bind(wx.EVT_MENU, self.OnDeleteSubindexMenu,
+              id=wxID_EDITINGPANELMENU1ITEMS1)
+
+    def _init_coll_IndexListMenu_Items(self, parent):
+        # generated method, don't edit
+
+        parent.Append(help='', id=wxID_EDITINGPANELINDEXLISTMENUITEMS0,
+              kind=wx.ITEM_NORMAL, text='Rename')
+        parent.Append(help='', id=wxID_EDITINGPANELINDEXLISTMENUITEMS2,
+              kind=wx.ITEM_NORMAL, text='Modify')
+        parent.Append(help='', id=wxID_EDITINGPANELINDEXLISTMENUITEMS1,
+              kind=wx.ITEM_NORMAL, text='Delete')
+        self.Bind(wx.EVT_MENU, self.OnRenameIndexMenu,
+              id=wxID_EDITINGPANELINDEXLISTMENUITEMS0)
+        self.Bind(wx.EVT_MENU, self.OnDeleteIndexMenu,
+              id=wxID_EDITINGPANELINDEXLISTMENUITEMS1)
+        self.Bind(wx.EVT_MENU, self.OnModifyIndexMenu,
+              id=wxID_EDITINGPANELINDEXLISTMENUITEMS2)
+
+    def _init_utils(self):
+        # generated method, don't edit
+        self.IndexListMenu = wx.Menu(title='')
+
+        self.SubindexGridMenu = wx.Menu(title='')
+
+        self._init_coll_IndexListMenu_Items(self.IndexListMenu)
+        self._init_coll_SubindexGridMenu_Items(self.SubindexGridMenu)
+
+    def _init_sizers(self):
+        # generated method, don't edit
+        self.IndexListSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
+
+        self.SubindexGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
+
+        self.AddToListSizer = wx.FlexGridSizer(cols=2, hgap=0, rows=1, vgap=0)
+
+        self._init_coll_IndexListSizer_Growables(self.IndexListSizer)
+        self._init_coll_IndexListSizer_Items(self.IndexListSizer)
+        self._init_coll_SubindexGridSizer_Growables(self.SubindexGridSizer)
+        self._init_coll_SubindexGridSizer_Items(self.SubindexGridSizer)
+        self._init_coll_AddToListSizer_Growables(self.AddToListSizer)
+        self._init_coll_AddToListSizer_Items(self.AddToListSizer)
+
+        self.SubindexGridPanel.SetSizer(self.SubindexGridSizer)
+        self.IndexListPanel.SetSizer(self.IndexListSizer)
+        
+    def _init_ctrls(self, prnt):
+        wx.SplitterWindow.__init__(self, id=wxID_EDITINGPANEL,
+              name='MainSplitter', parent=prnt, point=wx.Point(0, 0),
+              size=wx.Size(-1, -1), style=wx.SP_3D)
+        self._init_utils()
+        self.SetNeedUpdating(True)
+        self.SetMinimumPaneSize(1)
+
+        self.PartList = wx.ListBox(choices=[], id=wxID_EDITINGPANELPARTLIST,
+              name='PartList', parent=self, pos=wx.Point(0, 0),
+              size=wx.Size(-1, -1), style=0)
+        self.PartList.Bind(wx.EVT_LISTBOX, self.OnPartListBoxClick,
+              id=wxID_EDITINGPANELPARTLIST)
+
+        self.SecondSplitter = wx.SplitterWindow(id=wxID_EDITINGPANELSECONDSPLITTER,
+              name='SecondSplitter', parent=self, point=wx.Point(0,
+              0), size=wx.Size(-1, -1), style=wx.SP_3D)
+        self.SecondSplitter.SetMinimumPaneSize(1)
+        self.SplitHorizontally(self.PartList, self.SecondSplitter,
+              110)
+
+        self.SubindexGridPanel = wx.Panel(id=wxID_EDITINGPANELSUBINDEXGRIDPANEL,
+              name='SubindexGridPanel', parent=self.SecondSplitter, pos=wx.Point(0,
+              0), size=wx.Size(-1, -1), style=wx.TAB_TRAVERSAL)
+
+        self.IndexListPanel = wx.Panel(id=wxID_EDITINGPANELINDEXLISTPANEL,
+              name='IndexListPanel', parent=self.SecondSplitter, pos=wx.Point(0,
+              0), size=wx.Size(-1, -1), style=wx.TAB_TRAVERSAL)
+        self.SecondSplitter.SplitVertically(self.IndexListPanel,
+              self.SubindexGridPanel, 280)
+
+        self.SubindexGrid = wx.grid.Grid(id=wxID_EDITINGPANELSUBINDEXGRID,
+              name='SubindexGrid', parent=self.SubindexGridPanel, pos=wx.Point(0,
+              0), size=wx.Size(-1, -1), style=0)
+        self.SubindexGrid.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False,
+              'Sans'))
+        self.SubindexGrid.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL,
+              False, 'Sans'))
+        self.SubindexGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE,
+              self.OnSubindexGridCellChange)
+        self.SubindexGrid.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK,
+              self.OnSubindexGridRightClick)
+        self.SubindexGrid.Bind(wx.grid.EVT_GRID_SELECT_CELL,
+              self.OnSubindexGridSelectCell)
+
+        self.CallbackCheck = wx.CheckBox(id=wxID_EDITINGPANELCALLBACKCHECK,
+              label='Have Callbacks', name='CallbackCheck',
+              parent=self.SubindexGridPanel, pos=wx.Point(0, 0), size=wx.Size(152,
+              24), style=0)
+        self.CallbackCheck.Bind(wx.EVT_CHECKBOX, self.OnCallbackCheck,
+              id=wxID_EDITINGPANELCALLBACKCHECK)
+
+        self.IndexList = wx.ListBox(choices=[], id=wxID_EDITINGPANELINDEXLIST,
+              name='IndexList', parent=self.IndexListPanel, pos=wx.Point(0, 0),
+              size=wx.Size(-1, -1), style=0)
+        self.IndexList.Bind(wx.EVT_LISTBOX, self.OnIndexListClick,
+              id=wxID_EDITINGPANELINDEXLIST)
+        self.IndexList.Bind(wx.EVT_RIGHT_UP, self.OnIndexListRightUp)
+
+        self.AddButton = wx.Button(id=wxID_EDITINGPANELADDBUTTON, label='Add',
+              name='AddButton', parent=self.IndexListPanel, pos=wx.Point(0, 0),
+              size=wx.Size(50, 30), style=0)
+        self.AddButton.Bind(wx.EVT_BUTTON, self.OnAddButtonClick,
+              id=wxID_EDITINGPANELADDBUTTON)
+
+        self.IndexChoice = wx.Choice(choices=[], id=wxID_EDITINGPANELINDEXCHOICE,
+              name='IndexChoice', parent=self.IndexListPanel, pos=wx.Point(50,
+              0), size=wx.Size(-1, 30), style=0)
+
+        self._init_sizers()
+
+    def __init__(self, parent, manager, editable = True):
+        self._init_ctrls(parent.GetNoteBook())
+        self.Parent = parent
+        self.Manager = manager
+        self.ListIndex = []
+        self.ChoiceIndex = []
+        self.FirstCall = False
+        self.Editable = editable
+        self.Index = None
+        
+        for values in DictionaryOrganisation:
+            text = "   0x%04X-0x%04X      %s"%(values["minIndex"],values["maxIndex"],values["name"])
+            self.PartList.Append(text)
+        self.Table = SubindexTable(self, [], [], ["subindex", "name", "type", "value", "access", "save", "comment"])
+        self.SubindexGrid.SetTable(self.Table)
+        self.SubindexGrid.SetRowLabelSize(0)
+        self.CallbackCheck.Disable()
+        self.Table.ResetView(self.SubindexGrid)
+
+        if not self.Editable:
+            self.AddButton.Disable()
+            self.IndexChoice.Disable()
+            self.CallbackCheck.Disable()
+            self.Table.Disable()
+
+    def GetIndex(self):
+        return self.Index
+    
+    def SetIndex(self, index):
+        self.Index = index
+
+    def GetSelection(self):
+        selected = self.IndexList.GetSelection()
+        if selected != wxNOT_FOUND:
+            index = self.ListIndex[selected]
+            subIndex = self.SubindexGrid.GetGridCursorRow()
+            return index, subIndex
+        return None
+
+    def OnAddButtonClick(self, event):
+        if self.Editable:
+            self.SubindexGrid.SetGridCursor(0, 0)
+            selected = self.IndexChoice.GetStringSelection()
+            if selected != "":
+                if selected == "User Type":
+                    self.Parent.AddUserType()
+                elif selected == "SDO Server":
+                    self.Manager.AddSDOServerToCurrent()
+                elif selected == "SDO Client":
+                    self.Manager.AddSDOClientToCurrent()
+                elif selected == "PDO Receive":
+                    self.Manager.AddPDOReceiveToCurrent()
+                elif selected == "PDO Transmit":
+                    self.Manager.AddPDOTransmitToCurrent()
+                elif selected == "Map Variable":
+                    self.Parent.AddMapVariable()
+                elif selected in [menu for menu, indexes in self.Manager.GetCurrentSpecificMenu()]:
+                    self.Manager.AddSpecificEntryToCurrent(selected)
+                else:
+                    index = self.ChoiceIndex[self.IndexChoice.GetSelection()]
+                    self.Manager.ManageEntriesOfCurrent([index], [])
+                self.Parent.RefreshBufferState()
+                self.RefreshIndexList()
+        event.Skip()
+
+    def OnPartListBoxClick(self, event):
+        self.SubindexGrid.SetGridCursor(0, 0)
+        self.RefreshIndexList()
+        event.Skip()
+
+    def OnIndexListClick(self, event):
+        self.SubindexGrid.SetGridCursor(0, 0)
+        self.RefreshTable()
+        event.Skip()
+
+    def OnSubindexGridSelectCell(self, event):
+        wxCallAfter(self.Parent.RefreshStatusBar)
+        event.Skip()
+
+#-------------------------------------------------------------------------------
+#                             Refresh Functions
+#-------------------------------------------------------------------------------
+
+    def RefreshIndexList(self):
+        selected = self.IndexList.GetSelection()
+        choice = self.IndexChoice.GetStringSelection()
+        choiceindex = self.IndexChoice.GetSelection()
+        if selected != wxNOT_FOUND:
+            selectedindex = self.ListIndex[selected]
+        self.IndexList.Clear()
+        self.IndexChoice.Clear()
+        i = self.PartList.GetSelection()
+        if i < len(DictionaryOrganisation):
+            values = DictionaryOrganisation[i]
+            self.ListIndex = []
+            for name, index in self.Manager.GetCurrentValidIndexes(values["minIndex"], values["maxIndex"]):
+                self.IndexList.Append("0x%04X   %s"%(index, name))
+                self.ListIndex.append(index)
+            if self.Editable:
+                self.ChoiceIndex = []
+                if i == 0:
+                    self.IndexChoice.Append("User Type")
+                    self.IndexChoice.SetStringSelection("User Type")
+                elif i == 2:
+                    self.IndexChoice.Append("SDO Server")
+                    self.IndexChoice.Append("SDO Client")
+                    if choiceindex != wxNOT_FOUND and choice == self.IndexChoice.GetString(choiceindex):
+                         self.IndexChoice.SetStringSelection(choice)
+                elif i in (3, 4):
+                    self.IndexChoice.Append("PDO Receive")
+                    self.IndexChoice.SetStringSelection("PDO Receive")
+                elif i in (5, 6):
+                    self.IndexChoice.Append("PDO Transmit")
+                    self.IndexChoice.SetStringSelection("PDO Transmit")
+                elif i == 8:
+                    self.IndexChoice.Append("Map Variable")
+                    self.IndexChoice.SetStringSelection("Map Variable")
+                else:
+                    for name, index in self.Manager.GetCurrentValidChoices(values["minIndex"], values["maxIndex"]):
+                        if index:
+                            self.IndexChoice.Append("0x%04X   %s"%(index, name))
+                        else:
+                            self.IndexChoice.Append(name)
+                        self.ChoiceIndex.append(index)
+                if choiceindex != wxNOT_FOUND and choice == self.IndexChoice.GetString(choiceindex):
+                    self.IndexChoice.SetStringSelection(choice)
+        if self.Editable:
+            self.IndexChoice.Enable(self.IndexChoice.GetCount() != 0)
+            self.AddButton.Enable(self.IndexChoice.GetCount() != 0)
+        if selected == wxNOT_FOUND or selected >= len(self.ListIndex) or selectedindex != self.ListIndex[selected]:
+            self.Table.Empty()
+            self.CallbackCheck.SetValue(False)
+            self.CallbackCheck.Disable()
+            self.Table.ResetView(self.SubindexGrid)
+            self.Parent.RefreshStatusBar()
+        else:
+            self.IndexList.SetSelection(selected)
+            self.RefreshTable()
+
+    def RefreshTable(self):
+        selected = self.IndexList.GetSelection()
+        if selected != wxNOT_FOUND:
+            index = self.ListIndex[selected]
+            if index > 0x260 and self.Editable:
+                self.CallbackCheck.Enable()
+                self.CallbackCheck.SetValue(self.Manager.HasCurrentEntryCallbacks(index))
+            result = self.Manager.GetCurrentEntryValues(index)
+            if result != None:
+                self.Table.SetCurrentIndex(index)
+                data, editors = result
+                self.Table.SetData(data)
+                self.Table.SetEditors(editors)
+                self.Table.ResetView(self.SubindexGrid)
+        self.Parent.RefreshStatusBar()
+
+#-------------------------------------------------------------------------------
+#                        Editing Table value function
+#-------------------------------------------------------------------------------
+
+    def OnSubindexGridCellChange(self, event):
+        if self.Editable:
+            index = self.Table.GetCurrentIndex()
+            subIndex = event.GetRow()
+            col = event.GetCol()
+            name = self.Table.GetColLabelValue(col)
+            value = self.Table.GetValue(subIndex, col)
+            editor = self.Table.GetEditor(subIndex, col)
+            self.Manager.SetCurrentEntry(index, subIndex, value, name, editor)
+            self.Parent.RefreshBufferState()
+            wxCallAfter(self.RefreshTable)
+        event.Skip()
+
+    def OnCallbackCheck(self, event):
+        if self.Editable:
+            index = self.Table.GetCurrentIndex()
+            self.Manager.SetCurrentEntryCallbacks(index, self.CallbackCheck.GetValue())
+            self.Parent.RefreshBufferState()
+            wxCallAfter(self.RefreshTable)
+        event.Skip()
+
+#-------------------------------------------------------------------------------
+#                          Contextual Menu functions
+#-------------------------------------------------------------------------------
+
+    def OnIndexListRightUp(self, event):
+        if self.Editable:
+            if not self.FirstCall:
+                self.FirstCall = True
+                selected = self.IndexList.GetSelection()
+                if selected != wxNOT_FOUND:
+                    index = self.ListIndex[selected]
+                    if index < 0x260:
+                        self.IndexListMenu.FindItemByPosition(0).Enable(False)
+                        self.IndexListMenu.FindItemByPosition(1).Enable(True)
+                        self.PopupMenu(self.IndexListMenu)
+                    elif 0x1000 <= index <= 0x1BFF:
+                        self.IndexListMenu.FindItemByPosition(0).Enable(False)
+                        self.IndexListMenu.FindItemByPosition(1).Enable(False)
+                        self.PopupMenu(self.IndexListMenu)
+                    elif 0x2000 <= index <= 0x5FFF:
+                        self.IndexListMenu.FindItemByPosition(0).Enable(True)
+                        self.IndexListMenu.FindItemByPosition(1).Enable(False)
+                        self.PopupMenu(self.IndexListMenu)
+                    elif index >= 0x6000:
+                        self.IndexListMenu.FindItemByPosition(0).Enable(False)
+                        self.IndexListMenu.FindItemByPosition(1).Enable(False)
+                        self.PopupMenu(self.IndexListMenu)
+            else:
+                self.FirstCall = False
+        event.Skip()
+
+    def OnSubindexGridRightClick(self, event):
+        if self.Editable:
+            selected = self.IndexList.GetSelection()
+            if selected != wxNOT_FOUND:
+                index = self.ListIndex[selected]
+                if self.Manager.IsCurrentEntry(index):
+                    infos = self.Manager.GetEntryInfos(index)
+                    if index >= 0x2000 and infos["struct"] & OD_MultipleSubindexes or infos["struct"] & OD_IdenticalSubindexes:
+                        self.PopupMenu(self.SubindexGridMenu)
+        event.Skip()
+
+    def OnRenameIndexMenu(self, event):
+        if self.Editable:
+            selected = self.IndexList.GetSelection()
+            if selected != wxNOT_FOUND:
+                index = self.ListIndex[selected]
+                if self.Manager.IsCurrentEntry(index):
+                    infos = self.Manager.GetEntryInfos(index)
+                    dialog = wxTextEntryDialog(self, "Give a new name for index 0x%04X"%index,
+                                 "Rename an index", infos["name"], wxOK|wxCANCEL)
+                    if dialog.ShowModal() == wxID_OK:
+                        self.Manager.SetCurrentEntryName(index, dialog.GetValue())
+                        self.Parent.RefreshBufferState()
+                        self.RefreshIndexList()
+                    dialog.Destroy()
+        event.Skip()
+
+    def OnModifyIndexMenu(self, event):
+        if self.Editable:
+            selected = self.IndexList.GetSelection()
+            if selected != wxNOT_FOUND:
+                index = self.ListIndex[selected]
+                if self.Manager.IsCurrentEntry(index) and index < 0x260:
+                    values, valuetype = self.Manager.GetCustomisedTypeValues(index)
+                    dialog = UserTypeDialog(self)
+                    dialog.SetTypeList(self.Manager.GetCustomisableTypes(), values[1])
+                    if valuetype == 0:
+                        dialog.SetValues(min = values[2], max = values[3])
+                    elif valuetype == 1:
+                        dialog.SetValues(length = values[2])
+                    if dialog.ShowModal() == wxID_OK:
+                        type, min, max, length = dialog.GetValues()
+                        self.Manager.SetCurrentUserType(index, type, min, max, length)
+                        self.Parent.RefreshBufferState()
+                        self.RefreshIndexList()
+        event.Skip()
+        
+    def OnDeleteIndexMenu(self, event):
+        if self.Editable:
+            selected = self.IndexList.GetSelection()
+            if selected != wxNOT_FOUND:
+                index = self.ListIndex[selected]
+                if self.Manager.IsCurrentEntry(index):
+                    self.Manager.ManageEntriesOfCurrent([],[index])
+                    self.Parent.RefreshBufferState()
+                    self.RefreshIndexList()
+        event.Skip()
+
+    def OnAddSubindexMenu(self, event):
+        if self.Editable:
+            selected = self.IndexList.GetSelection()
+            if selected != wxNOT_FOUND:
+                index = self.ListIndex[selected]
+                if self.Manager.IsCurrentEntry(index):
+                    dialog = wxTextEntryDialog(self, "Number of subindexes to add:",
+                                 "Add subindexes", "1", wxOK|wxCANCEL)
+                    if dialog.ShowModal() == wxID_OK:
+                        try:
+                            number = int(dialog.GetValue())
+                            self.Manager.AddSubentriesToCurrent(index, number)
+                            self.Parent.RefreshBufferState()
+                            self.RefreshIndexList()
+                        except:
+                            message = wxMessageDialog(self, "An integer is required!", "ERROR", wxOK|wxICON_ERROR)
+                            message.ShowModal()
+                            message.Destroy()
+                    dialog.Destroy()
+        event.Skip()
+
+    def OnDeleteSubindexMenu(self, event):
+        if self.Editable:
+            selected = self.IndexList.GetSelection()
+            if selected != wxNOT_FOUND:
+                index = self.ListIndex[selected]
+                if self.Manager.IsCurrentEntry(index):
+                    dialog = wxTextEntryDialog(self, "Number of subindexes to delete:",
+                                 "Delete subindexes", "1", wxOK|wxCANCEL)
+                    if dialog.ShowModal() == wxID_OK:
+                        try:
+                            number = int(dialog.GetValue())
+                            self.Manager.RemoveSubentriesFromCurrent(index, number)
+                            self.Parent.RefreshBufferState()
+                            self.RefreshIndexList()
+                        except:
+                            message = wxMessageDialog(self, "An integer is required!", "ERROR", wxOK|wxICON_ERROR)
+                            message.ShowModal()
+                            message.Destroy()
+                    dialog.Destroy()
+        event.Skip()
+