--- a/objdictgen/commondialogs.py Fri Mar 14 10:55:34 2008 +0100
+++ b/objdictgen/commondialogs.py Wed Mar 19 16:08:12 2008 +0100
@@ -645,11 +645,12 @@
[ID_NODEINFOSDIALOG, ID_NODEINFOSDIALOGNAME,
- ID_NODEINFOSDIALOGNODEID, ID_NODEINFOSDIALOGDESCRIPTION,
- ID_NODEINFOSDIALOGTYPE, ID_NODEINFOSDIALOGSTATICTEXT1,
- ID_NODEINFOSDIALOGSTATICTEXT2, ID_NODEINFOSDIALOGSTATICTEXT3,
- ID_NODEINFOSDIALOGSTATICTEXT4,
-] = [wx.NewId() for _init_ctrls in range(9)]
+ ID_NODEINFOSDIALOGNODEID, ID_NODEINFOSDIALOGTYPE,
+ ID_NODEINFOSDIALOGDEFAULTSTRINGSIZE, ID_NODEINFOSDIALOGDESCRIPTION,
+ ID_NODEINFOSDIALOGSTATICTEXT1, ID_NODEINFOSDIALOGSTATICTEXT2,
+ ID_NODEINFOSDIALOGSTATICTEXT3, ID_NODEINFOSDIALOGSTATICTEXT4,
+ ID_NODEINFOSDIALOGSTATICTEXT5,
+] = [wx.NewId() for _init_ctrls in range(11)]
class NodeInfosDialog(wx.Dialog):
def _init_coll_flexGridSizer1_Items(self, parent):
@@ -668,6 +669,8 @@
parent.AddWindow(self.staticText3, 0, border=0, flag=wx.GROW)
parent.AddWindow(self.Type, 0, border=0, flag=wx.GROW)
parent.AddWindow(self.staticText4, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.DefaultStringSize, 0, border=0, flag=wx.GROW)
+ parent.AddWindow(self.staticText5, 0, border=0, flag=wx.GROW)
parent.AddWindow(self.Description, 0, border=0, flag=wx.GROW)
def _init_coll_MainSizer_Growables(self, parent):
@@ -716,7 +719,15 @@
size=wx.Size(0, 25), style=0)
self.staticText4 = wx.StaticText(id=ID_NODEINFOSDIALOGSTATICTEXT4,
- label='Description:', name='staticText4', parent=self,
+ label='Default String Size:', name='staticText4', parent=self,
+ pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
+
+ self.DefaultStringSize = wx.SpinCtrl(id=ID_NODEINFOSDIALOGDEFAULTSTRINGSIZE,
+ name='DefaultStringSize', parent=self, pos=wx.Point(0, 0),
+ size=wx.Size(0, 25), style=wx.TE_RIGHT)
+
+ self.staticText5 = wx.StaticText(id=ID_NODEINFOSDIALOGSTATICTEXT5,
+ label='Description:', name='staticText5', parent=self,
pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.Description = wx.TextCtrl(id=ID_NODEINFOSDIALOGDESCRIPTION,
@@ -759,18 +770,20 @@
else:
self.EndModal(wx.ID_OK)
- def SetValues(self, name, id, type, description):
+ def SetValues(self, name, id, type, description, defaultstringsize):
self.NodeName.SetValue(name)
self.NodeID.SetValue("0x%02X"%id)
self.Type.SetStringSelection(type)
self.Description.SetValue(description)
+ self.DefaultStringSize.SetValue(defaultstringsize)
def GetValues(self):
name = self.NodeName.GetValue()
nodeid = int(self.NodeID.GetValue(), 16)
type = self.Type.GetStringSelection()
description = self.Description.GetValue()
- return name, nodeid, type, description
+ defaultstringsize = self.DefaultStringSize.GetValue()
+ return name, nodeid, type, description, defaultstringsize
--- a/objdictgen/gen_cfile.py Fri Mar 14 10:55:34 2008 +0100
+++ b/objdictgen/gen_cfile.py Wed Mar 19 16:08:12 2008 +0100
@@ -38,6 +38,7 @@
generated_tag = """\n/* File generated by gen_cfile.py. Should not be modified. */\n"""
internal_types = {}
+default_string_size = 10
# Format a string for making a C++ variable
def FormatName(name):
@@ -45,7 +46,7 @@
return "_".join(wordlist)
# Extract the informations from a given type name
-def GetValidTypeInfos(typename):
+def GetValidTypeInfos(typename, items=[]):
if typename in internal_types:
return internal_types[typename]
else:
@@ -53,20 +54,22 @@
if result:
values = result.groups()
if values[0] == "UNSIGNED" and int(values[1]) in [i * 8 for i in xrange(1, 9)]:
- typeinfos = ("UNS%s"%values[1], "", "uint%s"%values[1], True)
+ typeinfos = ("UNS%s"%values[1], None, "uint%s"%values[1], True)
elif values[0] == "INTEGER" and int(values[1]) in [i * 8 for i in xrange(1, 9)]:
- typeinfos = ("INTEGER%s"%values[1], "", "int%s"%values[1], False)
+ typeinfos = ("INTEGER%s"%values[1], None, "int%s"%values[1], False)
elif values[0] == "REAL" and int(values[1]) in (32, 64):
- typeinfos = ("%s%s"%(values[0], values[1]), "", "real%s"%values[1], False)
+ typeinfos = ("%s%s"%(values[0], values[1]), None, "real%s"%values[1], False)
elif values[0] == "VISIBLE_STRING":
- if values[1] == "":
- typeinfos = ("UNS8", "[10]", "visible_string", False)
- else:
- typeinfos = ("UNS8", "[%s]"%values[1], "visible_string", False)
+ size = default_string_size
+ for item in items:
+ size = max(size, len(item))
+ if values[1] != "":
+ size = max(size, int(values[1]))
+ typeinfos = ("UNS8", size, "visible_string", False)
elif values[0] == "DOMAIN":
- typeinfos = ("UNS8*", "", "domain", True)
+ typeinfos = ("UNS8*", None, "domain", False)
elif values[0] == "BOOLEAN":
- typeinfos = ("UNS8", "", "boolean", True)
+ typeinfos = ("UNS8", None, "boolean", False)
else:
raise ValueError, """!!! %s isn't a valid type for CanFestival."""%typename
internal_types[typename] = typeinfos
@@ -82,6 +85,8 @@
def GenerateFileContent(Node, headerfilepath):
global type
global internal_types
+ global default_string_size
+
texts = {}
texts["maxPDOtransmit"] = 0
texts["NodeName"] = Node.GetNodeName()
@@ -92,6 +97,8 @@
if (texts["NodeType"] == "slave"):
texts["iam_a_slave"] = 1
+ default_string_size = Node.GetDefaultStringSize()
+
# Compiling lists of indexes
rangelist = [idx for idx in Node.GetIndexes() if 0 <= idx <= 0x260]
listIndex = [idx for idx in Node.GetIndexes() if 0x1000 <= idx <= 0xFFFF]
@@ -162,9 +169,12 @@
if type(values) != ListType:
subentry_infos = Node.GetSubentryInfos(index, 0)
typename = Node.GetTypeName(subentry_infos["type"])
- typeinfos = GetValidTypeInfos(typename)
+ typeinfos = GetValidTypeInfos(typename, [values])
texts["subIndexType"] = typeinfos[0]
- texts["suffixe"] = typeinfos[1]
+ if typeinfos[1] is not None:
+ texts["suffixe"] = "[%d]"%typeinfos[1]
+ else:
+ texts["suffixe"] = ""
if typeinfos[2] == "visible_string":
texts["value"] = "\"%s\""%values
texts["comment"] = ""
@@ -198,9 +208,12 @@
if entry_infos["struct"] & OD_IdenticalSubindexes:
subentry_infos = Node.GetSubentryInfos(index, 1)
typename = Node.GetTypeName(subentry_infos["type"])
- typeinfos = GetValidTypeInfos(typename)
+ typeinfos = GetValidTypeInfos(typename, values[1:])
texts["subIndexType"] = typeinfos[0]
- texts["suffixe"] = typeinfos[1]
+ if typeinfos[1] is not None:
+ texts["suffixe"] = "[%d]"%typeinfos[1]
+ else:
+ texts["suffixe"] = ""
texts["length"] = values[0]
if index in variablelist:
texts["name"] = FormatName(entry_infos["name"])
@@ -249,9 +262,12 @@
if subIndex > 0:
subentry_infos = Node.GetSubentryInfos(index, subIndex)
typename = Node.GetTypeName(subentry_infos["type"])
- typeinfos = GetValidTypeInfos(typename)
+ typeinfos = GetValidTypeInfos(typename, [values[subIndex]])
texts["subIndexType"] = typeinfos[0]
- texts["suffixe"] = typeinfos[1]
+ if typeinfos[1] is not None:
+ texts["suffixe"] = "[%d]"%typeinfos[1]
+ else:
+ texts["suffixe"] = ""
if typeinfos[2] == "visible_string":
texts["value"] = "\"%s\""%value
texts["comment"] = ""
@@ -291,7 +307,10 @@
else:
sep = ""
typename = Node.GetTypeName(subentry_infos["type"])
- typeinfos = GetValidTypeInfos(typename)
+ if entry_infos["struct"] & OD_IdenticalSubindexes:
+ typeinfos = GetValidTypeInfos(typename, values)
+ else:
+ typeinfos = GetValidTypeInfos(typename, [values[subIndex]])
if subIndex == 0:
if index == 0x1003:
typeinfos = GetValidTypeInfos("valueRange_EMC")
@@ -312,7 +331,7 @@
else:
name = "%s_obj%04X_%s"%(texts["NodeName"], texts["index"], FormatName(subentry_infos["name"]))
if typeinfos[2] in ["visible_string", "domain"]:
- sizeof = str(len(values[subIndex]))
+ sizeof = typeinfos[1]
else:
sizeof = "sizeof (%s)"%typeinfos[0]
params = Node.GetParamsEntry(index, subIndex)
--- a/objdictgen/networkedit.py Fri Mar 14 10:55:34 2008 +0100
+++ b/objdictgen/networkedit.py Wed Mar 19 16:08:12 2008 +0100
@@ -113,33 +113,20 @@
ID_NETWORKEDITHELPBAR,
] = [wx.NewId() for _init_ctrls in range(3)]
-[ID_NETWORKEDITADDMENUITEMS0, ID_NETWORKEDITADDMENUITEMS1,
- ID_NETWORKEDITADDMENUITEMS2, ID_NETWORKEDITADDMENUITEMS3,
- ID_NETWORKEDITADDMENUITEMS4, ID_NETWORKEDITADDMENUITEMS5,
+[ID_NETWORKEDITNETWORKMENUBUILDMASTER,
+] = [wx.NewId() for _init_coll_AddMenu_Items in range(1)]
+
+[ID_NETWORKEDITEDITMENUNODEINFOS, ID_NETWORKEDITEDITMENUDS301PROFILE,
+ ID_NETWORKEDITEDITMENUDS302PROFILE, ID_NETWORKEDITEDITMENUOTHERPROFILE,
+] = [wx.NewId() for _init_coll_EditMenu_Items in range(4)]
+
+[ID_NETWORKEDITADDMENUSDOSERVER, ID_NETWORKEDITADDMENUSDOCLIENT,
+ ID_NETWORKEDITADDMENUPDOTRANSMIT, ID_NETWORKEDITADDMENUPDORECEIVE,
+ ID_NETWORKEDITADDMENUMAPVARIABLE, ID_NETWORKEDITADDMENUUSERTYPE,
] = [wx.NewId() for _init_coll_AddMenu_Items in range(6)]
-[ID_NETWORKEDITFILEMENUITEMS0, ID_NETWORKEDITFILEMENUITEMS1,
- ID_NETWORKEDITFILEMENUITEMS2, ID_NETWORKEDITFILEMENUITEMS4,
- ID_NETWORKEDITFILEMENUITEMS5, ID_NETWORKEDITFILEMENUITEMS6,
-] = [wx.NewId() for _init_coll_FileMenu_Items in range(6)]
-
-[ID_NETWORKEDITNETWORKMENUITEMS0, ID_NETWORKEDITNETWORKMENUITEMS1,
- ID_NETWORKEDITNETWORKMENUITEMS3,
-] = [wx.NewId() for _init_coll_AddMenu_Items in range(3)]
-
-
-[ID_NETWORKEDITEDITMENUITEMS0, ID_NETWORKEDITEDITMENUITEMS1,
- ID_NETWORKEDITEDITMENUITEMS2, ID_NETWORKEDITEDITMENUITEMS4,
- ID_NETWORKEDITEDITMENUITEMS6, ID_NETWORKEDITEDITMENUITEMS7,
- ID_NETWORKEDITEDITMENUITEMS8,
-] = [wx.NewId() for _init_coll_EditMenu_Items in range(7)]
-
-[ID_NETWORKEDITHELPMENUITEMS0, ID_NETWORKEDITHELPMENUITEMS1,
- ID_NETWORKEDITHELPMENUITEMS2,
-] = [wx.NewId() for _init_coll_HelpMenu_Items in range(3)]
-
class networkedit(wx.Frame):
- def _init_coll_menuBar1_Menus(self, parent):
+ def _init_coll_MenuBar_Menus(self, parent):
if self.ModeSolo:
parent.Append(menu=self.FileMenu, title='File')
parent.Append(menu=self.NetworkMenu, title='Network')
@@ -147,116 +134,104 @@
parent.Append(menu=self.AddMenu, title='Add')
parent.Append(menu=self.HelpMenu, title='Help')
+ def _init_coll_FileMenu_Items(self, parent):
+ parent.Append(help='', id=wx.ID_NEW,
+ kind=wx.ITEM_NORMAL, text='New\tCTRL+N')
+ parent.Append(help='', id=wx.ID_OPEN,
+ kind=wx.ITEM_NORMAL, text='Open\tCTRL+O')
+ parent.Append(help='', id=wx.ID_CLOSE,
+ kind=wx.ITEM_NORMAL, text='Close\tCTRL+W')
+ parent.AppendSeparator()
+ parent.Append(help='', id=wx.ID_SAVE,
+ kind=wx.ITEM_NORMAL, text='Save\tCTRL+S')
+ parent.AppendSeparator()
+ parent.Append(help='', id=wx.ID_EXIT,
+ kind=wx.ITEM_NORMAL, text='Exit')
+ self.Bind(wx.EVT_MENU, self.OnNewProjectMenu, id=wx.ID_NEW)
+ self.Bind(wx.EVT_MENU, self.OnOpenProjectMenu, id=wx.ID_OPEN)
+ self.Bind(wx.EVT_MENU, self.OnCloseProjectMenu, id=wx.ID_CLOSE)
+ self.Bind(wx.EVT_MENU, self.OnSaveProjectMenu, id=wx.ID_SAVE)
+ self.Bind(wx.EVT_MENU, self.OnQuitMenu, id=wx.ID_EXIT)
+
+ def _init_coll_NetworkMenu_Items(self, parent):
+ parent.Append(help='', id=wx.ID_ADD,
+ kind=wx.ITEM_NORMAL, text='Add Slave Node')
+ parent.Append(help='', id=wx.ID_DELETE,
+ kind=wx.ITEM_NORMAL, text='Remove Slave Node')
+ parent.AppendSeparator()
+ parent.Append(help='', id=ID_NETWORKEDITNETWORKMENUBUILDMASTER,
+ kind=wx.ITEM_NORMAL, text='Build Master Dictionary')
+ self.Bind(wx.EVT_MENU, self.OnAddSlaveMenu, id=wx.ID_ADD)
+ self.Bind(wx.EVT_MENU, self.OnRemoveSlaveMenu, id=wx.ID_DELETE)
+## self.Bind(wx.EVT_MENU, self.OnBuildMasterMenu,
+## id=ID_NETWORKEDITNETWORKMENUBUILDMASTER)
+
def _init_coll_EditMenu_Items(self, parent):
- parent.Append(help='', id=ID_NETWORKEDITEDITMENUITEMS4,
+ parent.Append(help='', id=wx.ID_REFRESH,
kind=wx.ITEM_NORMAL, text='Refresh\tCTRL+R')
parent.AppendSeparator()
- parent.Append(help='', id=ID_NETWORKEDITEDITMENUITEMS1,
+ parent.Append(help='', id=wx.ID_UNDO,
kind=wx.ITEM_NORMAL, text='Undo\tCTRL+Z')
- parent.Append(help='', id=ID_NETWORKEDITEDITMENUITEMS0,
+ parent.Append(help='', id=wx.ID_REDO,
kind=wx.ITEM_NORMAL, text='Redo\tCTRL+Y')
parent.AppendSeparator()
- parent.Append(help='', id=ID_NETWORKEDITEDITMENUITEMS6,
+ parent.Append(help='', id=ID_NETWORKEDITEDITMENUNODEINFOS,
kind=wx.ITEM_NORMAL, text='Node infos')
- parent.Append(help='', id=ID_NETWORKEDITEDITMENUITEMS2,
+ parent.Append(help='', id=ID_NETWORKEDITEDITMENUDS301PROFILE,
kind=wx.ITEM_NORMAL, text='DS-301 Profile')
- parent.Append(help='', id=ID_NETWORKEDITEDITMENUITEMS8,
+ parent.Append(help='', id=ID_NETWORKEDITEDITMENUDS302PROFILE,
kind=wx.ITEM_NORMAL, text='DS-302 Profile')
- parent.Append(help='', id=ID_NETWORKEDITEDITMENUITEMS7,
+ parent.Append(help='', id=ID_NETWORKEDITEDITMENUOTHERPROFILE,
kind=wx.ITEM_NORMAL, text='Other Profile')
- self.Bind(wx.EVT_MENU, self.OnUndoMenu,
- id=ID_NETWORKEDITEDITMENUITEMS1)
- self.Bind(wx.EVT_MENU, self.OnRedoMenu,
- id=ID_NETWORKEDITEDITMENUITEMS0)
+ self.Bind(wx.EVT_MENU, self.OnRefreshMenu, id=wx.ID_REFRESH)
+ self.Bind(wx.EVT_MENU, self.OnUndoMenu, id=wx.ID_UNDO)
+ self.Bind(wx.EVT_MENU, self.OnRedoMenu, id=wx.ID_REDO)
+ self.Bind(wx.EVT_MENU, self.OnNodeInfosMenu,
+ id=ID_NETWORKEDITEDITMENUNODEINFOS)
self.Bind(wx.EVT_MENU, self.OnCommunicationMenu,
- id=ID_NETWORKEDITEDITMENUITEMS2)
- self.Bind(wx.EVT_MENU, self.OnRefreshMenu,
- id=ID_NETWORKEDITEDITMENUITEMS4)
- self.Bind(wx.EVT_MENU, self.OnNodeInfosMenu,
- id=ID_NETWORKEDITEDITMENUITEMS6)
+ id=ID_NETWORKEDITEDITMENUDS301PROFILE)
+ self.Bind(wx.EVT_MENU, self.OnOtherCommunicationMenu,
+ id=ID_NETWORKEDITEDITMENUDS302PROFILE)
self.Bind(wx.EVT_MENU, self.OnEditProfileMenu,
- id=ID_NETWORKEDITEDITMENUITEMS7)
- self.Bind(wx.EVT_MENU, self.OnOtherCommunicationMenu,
- id=ID_NETWORKEDITEDITMENUITEMS8)
-
- def _init_coll_HelpMenu_Items(self, parent):
- parent.Append(help='', id=ID_NETWORKEDITHELPMENUITEMS0,
- kind=wx.ITEM_NORMAL, text='DS-301 Standard\tF1')
- self.Bind(wx.EVT_MENU, self.OnHelpDS301Menu,
- id=ID_NETWORKEDITHELPMENUITEMS0)
- parent.Append(help='', id=ID_NETWORKEDITHELPMENUITEMS1,
- kind=wx.ITEM_NORMAL, text='CAN Festival Docs\tF2')
- self.Bind(wx.EVT_MENU, self.OnHelpCANFestivalMenu,
- id=ID_NETWORKEDITHELPMENUITEMS1)
- if Html_Window and self.ModeSolo:
- parent.Append(help='', id=ID_NETWORKEDITHELPMENUITEMS2,
- kind=wx.ITEM_NORMAL, text='About')
- self.Bind(wx.EVT_MENU, self.OnAboutMenu,
- id=ID_NETWORKEDITHELPMENUITEMS2)
-
- def _init_coll_FileMenu_Items(self, parent):
- parent.Append(help='', id=ID_NETWORKEDITFILEMENUITEMS5,
- kind=wx.ITEM_NORMAL, text='New\tCTRL+N')
- parent.Append(help='', id=ID_NETWORKEDITFILEMENUITEMS0,
- kind=wx.ITEM_NORMAL, text='Open\tCTRL+O')
- parent.Append(help='', id=ID_NETWORKEDITFILEMENUITEMS1,
- kind=wx.ITEM_NORMAL, text='Save\tCTRL+S')
- parent.Append(help='', id=ID_NETWORKEDITFILEMENUITEMS2,
- kind=wx.ITEM_NORMAL, text='Close\tCTRL+W')
- parent.AppendSeparator()
- parent.Append(help='', id=ID_NETWORKEDITFILEMENUITEMS4,
- kind=wx.ITEM_NORMAL, text='Exit')
- self.Bind(wx.EVT_MENU, self.OnOpenProjectMenu,
- id=ID_NETWORKEDITFILEMENUITEMS0)
- self.Bind(wx.EVT_MENU, self.OnSaveProjectMenu,
- id=ID_NETWORKEDITFILEMENUITEMS1)
- self.Bind(wx.EVT_MENU, self.OnCloseProjectMenu,
- id=ID_NETWORKEDITFILEMENUITEMS2)
- self.Bind(wx.EVT_MENU, self.OnQuitMenu,
- id=ID_NETWORKEDITFILEMENUITEMS4)
- self.Bind(wx.EVT_MENU, self.OnNewProjectMenu,
- id=ID_NETWORKEDITFILEMENUITEMS5)
-
- def _init_coll_NetworkMenu_Items(self, parent):
- parent.Append(help='', id=ID_NETWORKEDITNETWORKMENUITEMS0,
- kind=wx.ITEM_NORMAL, text='Add Slave Node')
- parent.Append(help='', id=ID_NETWORKEDITNETWORKMENUITEMS1,
- kind=wx.ITEM_NORMAL, text='Remove Slave Node')
- parent.AppendSeparator()
- parent.Append(help='', id=ID_NETWORKEDITNETWORKMENUITEMS3,
- kind=wx.ITEM_NORMAL, text='Build Master Dictionary')
- self.Bind(wx.EVT_MENU, self.OnAddSlaveMenu,
- id=ID_NETWORKEDITNETWORKMENUITEMS0)
- self.Bind(wx.EVT_MENU, self.OnRemoveSlaveMenu,
- id=ID_NETWORKEDITNETWORKMENUITEMS1)
-## self.Bind(wx.EVT_MENU, self.OnBuildMasterMenu,
-## id=ID_NETWORKEDITNETWORKMENUITEMS3)
-
+ id=ID_NETWORKEDITEDITMENUOTHERPROFILE)
+
def _init_coll_AddMenu_Items(self, parent):
- parent.Append(help='', id=ID_NETWORKEDITADDMENUITEMS0,
+ parent.Append(help='', id=ID_NETWORKEDITADDMENUSDOSERVER,
kind=wx.ITEM_NORMAL, text='SDO Server')
- parent.Append(help='', id=ID_NETWORKEDITADDMENUITEMS1,
+ parent.Append(help='', id=ID_NETWORKEDITADDMENUSDOCLIENT,
kind=wx.ITEM_NORMAL, text='SDO Client')
- parent.Append(help='', id=ID_NETWORKEDITADDMENUITEMS2,
+ parent.Append(help='', id=ID_NETWORKEDITADDMENUPDOTRANSMIT,
kind=wx.ITEM_NORMAL, text='PDO Transmit')
- parent.Append(help='', id=ID_NETWORKEDITADDMENUITEMS3,
+ parent.Append(help='', id=ID_NETWORKEDITADDMENUPDORECEIVE,
kind=wx.ITEM_NORMAL, text='PDO Receive')
- parent.Append(help='', id=ID_NETWORKEDITADDMENUITEMS4,
+ parent.Append(help='', id=ID_NETWORKEDITADDMENUMAPVARIABLE,
kind=wx.ITEM_NORMAL, text='Map Variable')
- parent.Append(help='', id=ID_NETWORKEDITADDMENUITEMS5,
+ parent.Append(help='', id=ID_NETWORKEDITADDMENUUSERTYPE,
kind=wx.ITEM_NORMAL, text='User Type')
self.Bind(wx.EVT_MENU, self.OnAddSDOServerMenu,
- id=ID_NETWORKEDITADDMENUITEMS0)
+ id=ID_NETWORKEDITADDMENUSDOSERVER)
self.Bind(wx.EVT_MENU, self.OnAddSDOClientMenu,
- id=ID_NETWORKEDITADDMENUITEMS1)
+ id=ID_NETWORKEDITADDMENUSDOCLIENT)
self.Bind(wx.EVT_MENU, self.OnAddPDOTransmitMenu,
- id=ID_NETWORKEDITADDMENUITEMS2)
+ id=ID_NETWORKEDITADDMENUPDOTRANSMIT)
self.Bind(wx.EVT_MENU, self.OnAddPDOReceiveMenu,
- id=ID_NETWORKEDITADDMENUITEMS3)
+ id=ID_NETWORKEDITADDMENUPDORECEIVE)
self.Bind(wx.EVT_MENU, self.OnAddMapVariableMenu,
- id=ID_NETWORKEDITADDMENUITEMS4)
+ id=ID_NETWORKEDITADDMENUMAPVARIABLE)
self.Bind(wx.EVT_MENU, self.OnAddUserTypeMenu,
- id=ID_NETWORKEDITADDMENUITEMS5)
+ id=ID_NETWORKEDITADDMENUUSERTYPE)
+
+ def _init_coll_HelpMenu_Items(self, parent):
+ parent.Append(help='', id=wx.ID_HELP,
+ kind=wx.ITEM_NORMAL, text='DS-301 Standard\tF1')
+ self.Bind(wx.EVT_MENU, self.OnHelpDS301Menu, id=wx.ID_HELP)
+ parent.Append(help='', id=wx.ID_HELP_CONTEXT,
+ kind=wx.ITEM_NORMAL, text='CAN Festival Docs\tF2')
+ self.Bind(wx.EVT_MENU, self.OnHelpCANFestivalMenu, id=wx.ID_HELP_CONTEXT)
+ if Html_Window and self.ModeSolo:
+ parent.Append(help='', id=wx.ID_ABOUT,
+ kind=wx.ITEM_NORMAL, text='About')
+ self.Bind(wx.EVT_MENU, self.OnAboutMenu, id=wx.ID_ABOUT)
def _init_coll_HelpBar_Fields(self, parent):
parent.SetFieldsCount(3)
@@ -268,8 +243,8 @@
parent.SetStatusWidths([100, 110, -1])
def _init_utils(self):
- self.menuBar1 = wx.MenuBar()
- self.menuBar1.SetEvtHandlerEnabled(True)
+ self.MenuBar = wx.MenuBar()
+ self.MenuBar.SetEvtHandlerEnabled(True)
if self.ModeSolo:
self.FileMenu = wx.Menu(title='')
@@ -278,7 +253,7 @@
self.AddMenu = wx.Menu(title='')
self.HelpMenu = wx.Menu(title='')
- self._init_coll_menuBar1_Menus(self.menuBar1)
+ self._init_coll_MenuBar_Menus(self.MenuBar)
if self.ModeSolo:
self._init_coll_FileMenu_Items(self.FileMenu)
self._init_coll_NetworkMenu_Items(self.NetworkMenu)
@@ -292,11 +267,11 @@
style=wx.DEFAULT_FRAME_STYLE, title='Networkedit')
self._init_utils()
self.SetClientSize(wx.Size(1000, 700))
- self.SetMenuBar(self.menuBar1)
+ self.SetMenuBar(self.MenuBar)
self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
if not self.ModeSolo:
- self.Bind(wx.EVT_MENU, self.OnSaveProjectMenu, id=ID_NETWORKEDITFILEMENUITEMS1)
- accel = wx.AcceleratorTable([wx.AcceleratorEntry(wx.ACCEL_CTRL, 83, ID_NETWORKEDITFILEMENUITEMS1)])
+ self.Bind(wx.EVT_MENU, self.OnSaveProjectMenu, id=wx.ID_SAVE)
+ accel = wx.AcceleratorTable([wx.AcceleratorEntry(wx.ACCEL_CTRL, 83, wx.ID_SAVE)])
self.SetAcceleratorTable(accel)
self.NetworkNodes = wx.Notebook(id=ID_NETWORKEDITNETWORKNODES,
@@ -621,45 +596,45 @@
self.HelpBar.SetStatusText("", i)
def RefreshMainMenu(self):
- if self.menuBar1:
- self.NetworkMenu.Enable(ID_NETWORKEDITNETWORKMENUITEMS3, False)
+ if self.MenuBar:
+ self.NetworkMenu.Enable(ID_NETWORKEDITNETWORKMENUBUILDMASTER, False)
if self.NodeList == None:
if self.ModeSolo:
- self.menuBar1.EnableTop(1, False)
- self.menuBar1.EnableTop(2, False)
- self.menuBar1.EnableTop(3, False)
+ self.MenuBar.EnableTop(1, False)
+ self.MenuBar.EnableTop(2, False)
+ self.MenuBar.EnableTop(3, False)
if self.FileMenu:
- self.FileMenu.Enable(ID_NETWORKEDITFILEMENUITEMS1, False)
- self.FileMenu.Enable(ID_NETWORKEDITFILEMENUITEMS2, False)
+ self.FileMenu.Enable(wx.ID_CLOSE, False)
+ self.FileMenu.Enable(wx.ID_SAVE, False)
else:
- self.menuBar1.EnableTop(0, False)
- self.menuBar1.EnableTop(1, False)
- self.menuBar1.EnableTop(2, False)
+ self.MenuBar.EnableTop(0, False)
+ self.MenuBar.EnableTop(1, False)
+ self.MenuBar.EnableTop(2, False)
else:
if self.ModeSolo:
- self.menuBar1.EnableTop(1, True)
+ self.MenuBar.EnableTop(1, True)
if self.FileMenu:
- self.FileMenu.Enable(ID_NETWORKEDITFILEMENUITEMS1, True)
- self.FileMenu.Enable(ID_NETWORKEDITFILEMENUITEMS2, True)
+ self.FileMenu.Enable(wx.ID_CLOSE, True)
+ self.FileMenu.Enable(wx.ID_SAVE, True)
if self.NetworkNodes.GetSelection() == 0:
- self.menuBar1.EnableTop(2, True)
- self.menuBar1.EnableTop(3, True)
+ self.MenuBar.EnableTop(2, True)
+ self.MenuBar.EnableTop(3, True)
else:
- self.menuBar1.EnableTop(2, False)
- self.menuBar1.EnableTop(3, False)
+ self.MenuBar.EnableTop(2, False)
+ self.MenuBar.EnableTop(3, False)
else:
- self.menuBar1.EnableTop(0, True)
+ self.MenuBar.EnableTop(0, True)
if self.NetworkNodes.GetSelection() == 0:
- self.menuBar1.EnableTop(1, True)
- self.menuBar1.EnableTop(2, True)
+ self.MenuBar.EnableTop(1, True)
+ self.MenuBar.EnableTop(2, True)
else:
- self.menuBar1.EnableTop(1, False)
- self.menuBar1.EnableTop(2, False)
+ self.MenuBar.EnableTop(1, False)
+ self.MenuBar.EnableTop(2, False)
def RefreshProfileMenu(self):
if self.EditMenu:
profile = self.Manager.GetCurrentProfileName()
- edititem = self.EditMenu.FindItemById(ID_NETWORKEDITEDITMENUITEMS7)
+ edititem = self.EditMenu.FindItemById(ID_NETWORKEDITEDITMENUOTHERPROFILE)
if edititem:
length = self.AddMenu.GetMenuItemCount()
for i in xrange(length-6):
@@ -812,10 +787,12 @@
def OnNodeInfosMenu(self, event):
dialog = NodeInfosDialog(self)
name, id, type, description = self.Manager.GetCurrentNodeInfos()
- dialog.SetValues(name, id, type, description)
+ defaultstringsize = self.Manager.GetCurrentNodeDefaultStringSize()
+ dialog.SetValues(name, id, type, description, defaultstringsize)
if dialog.ShowModal() == wx.ID_OK:
- name, id, type, description = dialog.GetValues()
+ name, id, type, description, defaultstringsize = dialog.GetValues()
self.Manager.SetCurrentNodeInfos(name, id, type, description)
+ self.Manager.SetCurrentNodeDefaultStringSize(defaultstringsize)
self.RefreshBufferState()
self.RefreshProfileMenu()
selected = self.NetworkNodes.GetSelection()
--- a/objdictgen/node.py Fri Mar 14 10:55:34 2008 +0100
+++ b/objdictgen/node.py Wed Mar 19 16:08:12 2008 +0100
@@ -391,6 +391,8 @@
class Node:
+ DefaultStringSize = 10
+
def __init__(self, name = "", type = "slave", id = 0, description = "", profilename = "DS-301", profile = {}, specificmenu = []):
self.Name = name
self.Type = type
@@ -480,6 +482,18 @@
self.Profile = profile
"""
+ Return the default string size
+ """
+ def GetDefaultStringSize(self):
+ return self.DefaultStringSize
+
+ """
+ Define the default string size
+ """
+ def SetDefaultStringSize(self, size):
+ self.DefaultStringSize = size
+
+ """
Define the DS-302 Profile
"""
def SetDS302Profile(self, profile):
--- a/objdictgen/nodemanager.py Fri Mar 14 10:55:34 2008 +0100
+++ b/objdictgen/nodemanager.py Wed Mar 19 16:08:12 2008 +0100
@@ -922,7 +922,7 @@
type = self.CurrentNode.GetNodeType()
description = self.CurrentNode.GetNodeDescription()
return name, id, type, description
-
+
def SetCurrentNodeInfos(self, name, id, type, description):
self.CurrentNode.SetNodeName(name)
self.CurrentNode.SetNodeID(id)
@@ -930,6 +930,18 @@
self.CurrentNode.SetNodeDescription(description)
self.BufferCurrentNode()
+ def GetCurrentNodeDefaultStringSize(self):
+ if self.CurrentNode:
+ return self.CurrentNode.GetDefaultStringSize()
+ else:
+ return Node.DefaultStringSize
+
+ def SetCurrentNodeDefaultStringSize(self, size):
+ if self.CurrentNode:
+ self.CurrentNode.SetDefaultStringSize(size)
+ else:
+ Node.DefaultStringSize = size
+
def GetCurrentProfileName(self):
if self.CurrentNode:
return self.CurrentNode.GetProfileName()
--- a/objdictgen/objdictedit.py Fri Mar 14 10:55:34 2008 +0100
+++ b/objdictgen/objdictedit.py Wed Mar 19 16:08:12 2008 +0100
@@ -111,147 +111,127 @@
ID_OBJDICTEDITHELPBAR,
] = [wx.NewId() for _init_ctrls in range(3)]
-[ID_OBJDICTEDITADDMENUITEMS0, ID_OBJDICTEDITADDMENUITEMS1,
- ID_OBJDICTEDITADDMENUITEMS2, ID_OBJDICTEDITADDMENUITEMS3,
- ID_OBJDICTEDITADDMENUITEMS4, ID_OBJDICTEDITADDMENUITEMS5,
+[ID_OBJDICTEDITFILEMENUIMPORTEDS, ID_OBJDICTEDITFILEMENUEXPORTEDS,
+ ID_OBJDICTEDITFILEMENUEXPORTC,
+] = [wx.NewId() for _init_coll_FileMenu_Items in range(3)]
+
+[ID_OBJDICTEDITEDITMENUNODEINFOS, ID_OBJDICTEDITEDITMENUDS301PROFILE,
+ ID_OBJDICTEDITEDITMENUDS302PROFILE, ID_OBJDICTEDITEDITMENUOTHERPROFILE,
+] = [wx.NewId() for _init_coll_EditMenu_Items in range(4)]
+
+[ID_OBJDICTEDITADDMENUSDOSERVER, ID_OBJDICTEDITADDMENUSDOCLIENT,
+ ID_OBJDICTEDITADDMENUPDOTRANSMIT, ID_OBJDICTEDITADDMENUPDORECEIVE,
+ ID_OBJDICTEDITADDMENUMAPVARIABLE, ID_OBJDICTEDITADDMENUUSERTYPE,
] = [wx.NewId() for _init_coll_AddMenu_Items in range(6)]
-[ID_OBJDICTEDITFILEMENUITEMS0, ID_OBJDICTEDITFILEMENUITEMS1,
- ID_OBJDICTEDITFILEMENUITEMS2, ID_OBJDICTEDITFILEMENUITEMS4,
- ID_OBJDICTEDITFILEMENUITEMS5, ID_OBJDICTEDITFILEMENUITEMS6,
- ID_OBJDICTEDITFILEMENUITEMS7, ID_OBJDICTEDITFILEMENUITEMS8,
- ID_OBJDICTEDITFILEMENUITEMS9,
-] = [wx.NewId() for _init_coll_FileMenu_Items in range(9)]
-
-[ID_OBJDICTEDITEDITMENUITEMS0, ID_OBJDICTEDITEDITMENUITEMS1,
- ID_OBJDICTEDITEDITMENUITEMS2, ID_OBJDICTEDITEDITMENUITEMS4,
- ID_OBJDICTEDITEDITMENUITEMS6, ID_OBJDICTEDITEDITMENUITEMS7,
- ID_OBJDICTEDITEDITMENUITEMS8,
-] = [wx.NewId() for _init_coll_EditMenu_Items in range(7)]
-
-[ID_OBJDICTEDITHELPMENUITEMS0, ID_OBJDICTEDITHELPMENUITEMS1,
- ID_OBJDICTEDITHELPMENUITEMS2,
-] = [wx.NewId() for _init_coll_HelpMenu_Items in range(3)]
-
class objdictedit(wx.Frame):
- def _init_coll_menuBar1_Menus(self, parent):
+ def _init_coll_MenuBar_Menus(self, parent):
parent.Append(menu=self.FileMenu, title='File')
parent.Append(menu=self.EditMenu, title='Edit')
parent.Append(menu=self.AddMenu, title='Add')
parent.Append(menu=self.HelpMenu, title='Help')
+ def _init_coll_FileMenu_Items(self, parent):
+ parent.Append(help='', id=wx.ID_NEW,
+ kind=wx.ITEM_NORMAL, text='New\tCTRL+N')
+ parent.Append(help='', id=wx.ID_OPEN,
+ kind=wx.ITEM_NORMAL, text='Open\tCTRL+O')
+ parent.Append(help='', id=wx.ID_CLOSE,
+ kind=wx.ITEM_NORMAL, text='Close\tCTRL+W')
+ parent.AppendSeparator()
+ parent.Append(help='', id=wx.ID_SAVE,
+ kind=wx.ITEM_NORMAL, text='Save\tCTRL+S')
+ parent.Append(help='', id=wx.ID_SAVEAS,
+ kind=wx.ITEM_NORMAL, text='Save As...\tALT+S')
+ parent.AppendSeparator()
+ parent.Append(help='', id=ID_OBJDICTEDITFILEMENUIMPORTEDS,
+ kind=wx.ITEM_NORMAL, text='Import EDS file')
+ parent.Append(help='', id=ID_OBJDICTEDITFILEMENUEXPORTEDS,
+ kind=wx.ITEM_NORMAL, text='Export to EDS file')
+ parent.Append(help='', id=ID_OBJDICTEDITFILEMENUEXPORTC,
+ kind=wx.ITEM_NORMAL, text='Build Dictionary\tCTRL+B')
+ parent.AppendSeparator()
+ parent.Append(help='', id=wx.ID_EXIT,
+ kind=wx.ITEM_NORMAL, text='Exit')
+ self.Bind(wx.EVT_MENU, self.OnNewMenu, id=wx.ID_NEW)
+ self.Bind(wx.EVT_MENU, self.OnOpenMenu, id=wx.ID_OPEN)
+ self.Bind(wx.EVT_MENU, self.OnCloseMenu, id=wx.ID_CLOSE)
+ self.Bind(wx.EVT_MENU, self.OnSaveMenu, id=wx.ID_SAVE)
+ self.Bind(wx.EVT_MENU, self.OnSaveAsMenu, id=wx.ID_SAVEAS)
+ self.Bind(wx.EVT_MENU, self.OnImportEDSMenu,
+ id=ID_OBJDICTEDITFILEMENUIMPORTEDS)
+ self.Bind(wx.EVT_MENU, self.OnExportEDSMenu,
+ id=ID_OBJDICTEDITFILEMENUEXPORTEDS)
+ self.Bind(wx.EVT_MENU, self.OnExportCMenu,
+ id=ID_OBJDICTEDITFILEMENUEXPORTC)
+ self.Bind(wx.EVT_MENU, self.OnQuitMenu, id=wx.ID_EXIT)
+
def _init_coll_EditMenu_Items(self, parent):
- parent.Append(help='', id=ID_OBJDICTEDITEDITMENUITEMS4,
+ parent.Append(help='', id=wx.ID_REFRESH,
kind=wx.ITEM_NORMAL, text='Refresh\tCTRL+R')
parent.AppendSeparator()
- parent.Append(help='', id=ID_OBJDICTEDITEDITMENUITEMS1,
+ parent.Append(help='', id=wx.ID_UNDO,
kind=wx.ITEM_NORMAL, text='Undo\tCTRL+Z')
- parent.Append(help='', id=ID_OBJDICTEDITEDITMENUITEMS0,
+ parent.Append(help='', id=wx.ID_REDO,
kind=wx.ITEM_NORMAL, text='Redo\tCTRL+Y')
parent.AppendSeparator()
- parent.Append(help='', id=ID_OBJDICTEDITEDITMENUITEMS6,
+ parent.Append(help='', id=ID_OBJDICTEDITEDITMENUNODEINFOS,
kind=wx.ITEM_NORMAL, text='Node infos')
- parent.Append(help='', id=ID_OBJDICTEDITEDITMENUITEMS2,
+ parent.Append(help='', id=ID_OBJDICTEDITEDITMENUDS301PROFILE,
kind=wx.ITEM_NORMAL, text='DS-301 Profile')
- parent.Append(help='', id=ID_OBJDICTEDITEDITMENUITEMS8,
+ parent.Append(help='', id=ID_OBJDICTEDITEDITMENUDS302PROFILE,
kind=wx.ITEM_NORMAL, text='DS-302 Profile')
- parent.Append(help='', id=ID_OBJDICTEDITEDITMENUITEMS7,
+ parent.Append(help='', id=ID_OBJDICTEDITEDITMENUOTHERPROFILE,
kind=wx.ITEM_NORMAL, text='Other Profile')
- self.Bind(wx.EVT_MENU, self.OnUndoMenu,
- id=ID_OBJDICTEDITEDITMENUITEMS1)
- self.Bind(wx.EVT_MENU, self.OnRedoMenu,
- id=ID_OBJDICTEDITEDITMENUITEMS0)
+ self.Bind(wx.EVT_MENU, self.OnRefreshMenu, id=wx.ID_REFRESH)
+ self.Bind(wx.EVT_MENU, self.OnUndoMenu, id=wx.ID_UNDO)
+ self.Bind(wx.EVT_MENU, self.OnRedoMenu, id=wx.ID_REDO)
+ self.Bind(wx.EVT_MENU, self.OnNodeInfosMenu,
+ id=ID_OBJDICTEDITEDITMENUNODEINFOS)
self.Bind(wx.EVT_MENU, self.OnCommunicationMenu,
- id=ID_OBJDICTEDITEDITMENUITEMS2)
- self.Bind(wx.EVT_MENU, self.OnRefreshMenu,
- id=ID_OBJDICTEDITEDITMENUITEMS4)
- self.Bind(wx.EVT_MENU, self.OnNodeInfosMenu,
- id=ID_OBJDICTEDITEDITMENUITEMS6)
+ id=ID_OBJDICTEDITEDITMENUDS301PROFILE)
+ self.Bind(wx.EVT_MENU, self.OnOtherCommunicationMenu,
+ id=ID_OBJDICTEDITEDITMENUDS302PROFILE)
self.Bind(wx.EVT_MENU, self.OnEditProfileMenu,
- id=ID_OBJDICTEDITEDITMENUITEMS7)
- self.Bind(wx.EVT_MENU, self.OnOtherCommunicationMenu,
- id=ID_OBJDICTEDITEDITMENUITEMS8)
-
- def _init_coll_HelpMenu_Items(self, parent):
- parent.Append(help='', id=ID_OBJDICTEDITHELPMENUITEMS0,
- kind=wx.ITEM_NORMAL, text='DS-301 Standard\tF1')
- self.Bind(wx.EVT_MENU, self.OnHelpDS301Menu,
- id=ID_OBJDICTEDITHELPMENUITEMS0)
- parent.Append(help='', id=ID_OBJDICTEDITHELPMENUITEMS1,
- kind=wx.ITEM_NORMAL, text='CAN Festival Docs\tF2')
- self.Bind(wx.EVT_MENU, self.OnHelpCANFestivalMenu,
- id=ID_OBJDICTEDITHELPMENUITEMS1)
- if Html_Window:
- parent.Append(help='', id=ID_OBJDICTEDITHELPMENUITEMS2,
- kind=wx.ITEM_NORMAL, text='About')
- self.Bind(wx.EVT_MENU, self.OnAboutMenu,
- id=ID_OBJDICTEDITHELPMENUITEMS2)
-
- def _init_coll_FileMenu_Items(self, parent):
- parent.Append(help='', id=ID_OBJDICTEDITFILEMENUITEMS5,
- kind=wx.ITEM_NORMAL, text='New\tCTRL+N')
- parent.Append(help='', id=ID_OBJDICTEDITFILEMENUITEMS0,
- kind=wx.ITEM_NORMAL, text='Open\tCTRL+O')
- parent.Append(help='', id=ID_OBJDICTEDITFILEMENUITEMS1,
- kind=wx.ITEM_NORMAL, text='Save\tCTRL+S')
- parent.Append(help='', id=ID_OBJDICTEDITFILEMENUITEMS6,
- kind=wx.ITEM_NORMAL, text='Save As...\tALT+S')
- parent.Append(help='', id=ID_OBJDICTEDITFILEMENUITEMS2,
- kind=wx.ITEM_NORMAL, text='Close\tCTRL+W')
- parent.AppendSeparator()
- parent.Append(help='', id=ID_OBJDICTEDITFILEMENUITEMS7,
- kind=wx.ITEM_NORMAL, text='Import EDS file')
- parent.Append(help='', id=ID_OBJDICTEDITFILEMENUITEMS9,
- kind=wx.ITEM_NORMAL, text='Export to EDS file')
- parent.Append(help='', id=ID_OBJDICTEDITFILEMENUITEMS8,
- kind=wx.ITEM_NORMAL, text='Build Dictionary\tCTRL+B')
- parent.AppendSeparator()
- parent.Append(help='', id=ID_OBJDICTEDITFILEMENUITEMS4,
- kind=wx.ITEM_NORMAL, text='Exit')
- self.Bind(wx.EVT_MENU, self.OnOpenMenu,
- id=ID_OBJDICTEDITFILEMENUITEMS0)
- self.Bind(wx.EVT_MENU, self.OnSaveMenu,
- id=ID_OBJDICTEDITFILEMENUITEMS1)
- self.Bind(wx.EVT_MENU, self.OnCloseMenu,
- id=ID_OBJDICTEDITFILEMENUITEMS2)
- self.Bind(wx.EVT_MENU, self.OnQuitMenu,
- id=ID_OBJDICTEDITFILEMENUITEMS4)
- self.Bind(wx.EVT_MENU, self.OnNewMenu,
- id=ID_OBJDICTEDITFILEMENUITEMS5)
- self.Bind(wx.EVT_MENU, self.OnSaveAsMenu,
- id=ID_OBJDICTEDITFILEMENUITEMS6)
- self.Bind(wx.EVT_MENU, self.OnImportEDSMenu,
- id=ID_OBJDICTEDITFILEMENUITEMS7)
- self.Bind(wx.EVT_MENU, self.OnExportCMenu,
- id=ID_OBJDICTEDITFILEMENUITEMS8)
- self.Bind(wx.EVT_MENU, self.OnExportEDSMenu,
- id=ID_OBJDICTEDITFILEMENUITEMS9)
+ id=ID_OBJDICTEDITEDITMENUOTHERPROFILE)
def _init_coll_AddMenu_Items(self, parent):
- parent.Append(help='', id=ID_OBJDICTEDITADDMENUITEMS0,
+ parent.Append(help='', id=ID_OBJDICTEDITADDMENUSDOSERVER,
kind=wx.ITEM_NORMAL, text='SDO Server')
- parent.Append(help='', id=ID_OBJDICTEDITADDMENUITEMS1,
+ parent.Append(help='', id=ID_OBJDICTEDITADDMENUSDOCLIENT,
kind=wx.ITEM_NORMAL, text='SDO Client')
- parent.Append(help='', id=ID_OBJDICTEDITADDMENUITEMS2,
+ parent.Append(help='', id=ID_OBJDICTEDITADDMENUPDOTRANSMIT,
kind=wx.ITEM_NORMAL, text='PDO Transmit')
- parent.Append(help='', id=ID_OBJDICTEDITADDMENUITEMS3,
+ parent.Append(help='', id=ID_OBJDICTEDITADDMENUPDORECEIVE,
kind=wx.ITEM_NORMAL, text='PDO Receive')
- parent.Append(help='', id=ID_OBJDICTEDITADDMENUITEMS4,
+ parent.Append(help='', id=ID_OBJDICTEDITADDMENUMAPVARIABLE,
kind=wx.ITEM_NORMAL, text='Map Variable')
- parent.Append(help='', id=ID_OBJDICTEDITADDMENUITEMS5,
+ parent.Append(help='', id=ID_OBJDICTEDITADDMENUUSERTYPE,
kind=wx.ITEM_NORMAL, text='User Type')
self.Bind(wx.EVT_MENU, self.OnAddSDOServerMenu,
- id=ID_OBJDICTEDITADDMENUITEMS0)
+ id=ID_OBJDICTEDITADDMENUSDOSERVER)
self.Bind(wx.EVT_MENU, self.OnAddSDOClientMenu,
- id=ID_OBJDICTEDITADDMENUITEMS1)
+ id=ID_OBJDICTEDITADDMENUSDOCLIENT)
self.Bind(wx.EVT_MENU, self.OnAddPDOTransmitMenu,
- id=ID_OBJDICTEDITADDMENUITEMS2)
+ id=ID_OBJDICTEDITADDMENUPDOTRANSMIT)
self.Bind(wx.EVT_MENU, self.OnAddPDOReceiveMenu,
- id=ID_OBJDICTEDITADDMENUITEMS3)
+ id=ID_OBJDICTEDITADDMENUPDORECEIVE)
self.Bind(wx.EVT_MENU, self.OnAddMapVariableMenu,
- id=ID_OBJDICTEDITADDMENUITEMS4)
+ id=ID_OBJDICTEDITADDMENUMAPVARIABLE)
self.Bind(wx.EVT_MENU, self.OnAddUserTypeMenu,
- id=ID_OBJDICTEDITADDMENUITEMS5)
+ id=ID_OBJDICTEDITADDMENUUSERTYPE)
+
+ def _init_coll_HelpMenu_Items(self, parent):
+ parent.Append(help='', id=wx.ID_HELP,
+ kind=wx.ITEM_NORMAL, text='DS-301 Standard\tF1')
+ self.Bind(wx.EVT_MENU, self.OnHelpDS301Menu, id=wx.ID_HELP)
+ parent.Append(help='', id=wx.ID_HELP_CONTEXT,
+ kind=wx.ITEM_NORMAL, text='CAN Festival Docs\tF2')
+ self.Bind(wx.EVT_MENU, self.OnHelpCANFestivalMenu, id=wx.ID_HELP_CONTEXT)
+ if Html_Window:
+ parent.Append(help='', id=wx.ID_ABOUT,
+ kind=wx.ITEM_NORMAL, text='About')
+ self.Bind(wx.EVT_MENU, self.OnAboutMenu, id=wx.ID_ABOUT)
def _init_coll_HelpBar_Fields(self, parent):
parent.SetFieldsCount(3)
@@ -263,15 +243,15 @@
parent.SetStatusWidths([100, 110, -1])
def _init_utils(self):
- self.menuBar1 = wx.MenuBar()
- self.menuBar1.SetEvtHandlerEnabled(True)
+ self.MenuBar = wx.MenuBar()
+ self.MenuBar.SetEvtHandlerEnabled(True)
self.FileMenu = 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)
+ self._init_coll_MenuBar_Menus(self.MenuBar)
self._init_coll_FileMenu_Items(self.FileMenu)
self._init_coll_EditMenu_Items(self.EditMenu)
self._init_coll_AddMenu_Items(self.AddMenu)
@@ -283,7 +263,7 @@
style=wx.DEFAULT_FRAME_STYLE, title='Objdictedit')
self._init_utils()
self.SetClientSize(wx.Size(1000, 700))
- self.SetMenuBar(self.menuBar1)
+ self.SetMenuBar(self.MenuBar)
self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
self.FileOpened = wx.Notebook(id=ID_OBJDICTEDITFILEOPENED,
@@ -317,9 +297,9 @@
self.Manager.ChangeCurrentNode(window.GetIndex())
self.FileOpened.SetSelection(0)
if self.Manager.CurrentDS302Defined():
- self.EditMenu.Enable(ID_OBJDICTEDITEDITMENUITEMS8, True)
+ self.EditMenu.Enable(ID_OBJDICTEDITEDITMENUDS302PROFILE, True)
else:
- self.EditMenu.Enable(ID_OBJDICTEDITEDITMENUITEMS8, False)
+ self.EditMenu.Enable(ID_OBJDICTEDITEDITMENUDS302PROFILE, False)
self.RefreshEditMenu()
self.RefreshBufferState()
self.RefreshProfileMenu()
@@ -499,36 +479,36 @@
def RefreshMainMenu(self):
if self.FileMenu:
if self.FileOpened.GetPageCount() > 0:
- self.menuBar1.EnableTop(1, True)
- self.menuBar1.EnableTop(2, True)
- self.FileMenu.Enable(ID_OBJDICTEDITFILEMENUITEMS1, True)
- self.FileMenu.Enable(ID_OBJDICTEDITFILEMENUITEMS2, True)
- self.FileMenu.Enable(ID_OBJDICTEDITFILEMENUITEMS6, True)
- self.FileMenu.Enable(ID_OBJDICTEDITFILEMENUITEMS8, True)
- self.FileMenu.Enable(ID_OBJDICTEDITFILEMENUITEMS9, True)
+ self.MenuBar.EnableTop(1, True)
+ self.MenuBar.EnableTop(2, True)
+ self.FileMenu.Enable(wx.ID_CLOSE, True)
+ self.FileMenu.Enable(wx.ID_SAVE, True)
+ self.FileMenu.Enable(wx.ID_SAVEAS, True)
+ self.FileMenu.Enable(ID_OBJDICTEDITFILEMENUEXPORTEDS, True)
+ self.FileMenu.Enable(ID_OBJDICTEDITFILEMENUEXPORTC, True)
else:
- self.menuBar1.EnableTop(1, False)
- self.menuBar1.EnableTop(2, False)
- self.FileMenu.Enable(ID_OBJDICTEDITFILEMENUITEMS1, False)
- self.FileMenu.Enable(ID_OBJDICTEDITFILEMENUITEMS2, False)
- self.FileMenu.Enable(ID_OBJDICTEDITFILEMENUITEMS6, False)
- self.FileMenu.Enable(ID_OBJDICTEDITFILEMENUITEMS8, False)
- self.FileMenu.Enable(ID_OBJDICTEDITFILEMENUITEMS9, False)
+ self.MenuBar.EnableTop(1, False)
+ self.MenuBar.EnableTop(2, False)
+ self.FileMenu.Enable(wx.ID_CLOSE, False)
+ self.FileMenu.Enable(wx.ID_SAVE, False)
+ self.FileMenu.Enable(wx.ID_SAVEAS, False)
+ self.FileMenu.Enable(ID_OBJDICTEDITFILEMENUEXPORTEDS, False)
+ self.FileMenu.Enable(ID_OBJDICTEDITFILEMENUEXPORTC, False)
def RefreshEditMenu(self):
- if self.FileMenu:
+ if self.EditMenu:
if self.FileOpened.GetPageCount() > 0:
undo, redo = self.Manager.GetCurrentBufferState()
- self.EditMenu.Enable(ID_OBJDICTEDITEDITMENUITEMS1, undo)
- self.EditMenu.Enable(ID_OBJDICTEDITEDITMENUITEMS0, redo)
+ self.EditMenu.Enable(wx.ID_UNDO, undo)
+ self.EditMenu.Enable(wx.ID_REDO, redo)
else:
- self.EditMenu.Enable(ID_OBJDICTEDITEDITMENUITEMS1, False)
- self.EditMenu.Enable(ID_OBJDICTEDITEDITMENUITEMS0, False)
+ self.EditMenu.Enable(wx.ID_UNDO, False)
+ self.EditMenu.Enable(wx.ID_REDO, False)
def RefreshProfileMenu(self):
if self.EditMenu:
profile = self.Manager.GetCurrentProfileName()
- edititem = self.EditMenu.FindItemById(ID_OBJDICTEDITEDITMENUITEMS7)
+ edititem = self.EditMenu.FindItemById(ID_OBJDICTEDITEDITMENUOTHERPROFILE)
if edititem:
length = self.AddMenu.GetMenuItemCount()
for i in xrange(length-6):
@@ -589,9 +569,9 @@
new_editingpanel.SetIndex(result)
self.FileOpened.AddPage(new_editingpanel, "")
self.FileOpened.SetSelection(self.FileOpened.GetPageCount() - 1)
- self.EditMenu.Enable(ID_OBJDICTEDITEDITMENUITEMS8, False)
+ self.EditMenu.Enable(ID_OBJDICTEDITEDITMENUDS302PROFILE, False)
if "DS302" in options:
- self.EditMenu.Enable(ID_OBJDICTEDITEDITMENUITEMS8, True)
+ self.EditMenu.Enable(ID_OBJDICTEDITEDITMENUDS302PROFILE, True)
self.RefreshBufferState()
self.RefreshProfileMenu()
self.RefreshMainMenu()
@@ -619,9 +599,9 @@
self.FileOpened.AddPage(new_editingpanel, "")
self.FileOpened.SetSelection(self.FileOpened.GetPageCount() - 1)
if self.Manager.CurrentDS302Defined():
- self.EditMenu.Enable(ID_OBJDICTEDITEDITMENUITEMS8, True)
+ self.EditMenu.Enable(ID_OBJDICTEDITEDITMENUDS302PROFILE, True)
else:
- self.EditMenu.Enable(ID_OBJDICTEDITEDITMENUITEMS8, False)
+ self.EditMenu.Enable(ID_OBJDICTEDITEDITMENUDS302PROFILE, False)
self.RefreshEditMenu()
self.RefreshBufferState()
self.RefreshProfileMenu()
@@ -837,10 +817,12 @@
def OnNodeInfosMenu(self, event):
dialog = NodeInfosDialog(self)
name, id, type, description = self.Manager.GetCurrentNodeInfos()
- dialog.SetValues(name, id, type, description)
+ defaultstringsize = self.Manager.GetCurrentNodeDefaultStringSize()
+ dialog.SetValues(name, id, type, description, defaultstringsize)
if dialog.ShowModal() == wx.ID_OK:
- name, id, type, description = dialog.GetValues()
+ name, id, type, description, defaultstringsize = dialog.GetValues()
self.Manager.SetCurrentNodeInfos(name, id, type, description)
+ self.Manager.SetCurrentNodeDefaultStringSize(defaultstringsize)
self.RefreshBufferState()
self.RefreshProfileMenu()
selected = self.FileOpened.GetSelection()