canfestival/NetworkEditor.py
branch1.1 Korean release
changeset 968 eee7625de1f7
parent 920 1499a4d225db
child 1003 de812e258213
equal deleted inserted replaced
808:6e205c1f05a0 968:eee7625de1f7
     1 
     1 
     2 import wx
     2 import wx
     3 
     3 
     4 from subindextable import EditingPanel
     4 from subindextable import EditingPanel
     5 from networkedit import NetworkEditorTemplate
     5 from networkedit import NetworkEditorTemplate
     6 from ConfTreeNodeEditor import ConfTreeNodeEditor
     6 from editors.ConfTreeNodeEditor import ConfTreeNodeEditor
     7 
     7 
     8 [ID_NETWORKEDITOR, 
     8 [ID_NETWORKEDITOR, 
     9 ] = [wx.NewId() for _init_ctrls in range(1)]
     9 ] = [wx.NewId() for _init_ctrls in range(1)]
    10 
    10 
    11 [ID_NETWORKEDITORCONFNODEMENUADDSLAVE, ID_NETWORKEDITORCONFNODEMENUREMOVESLAVE, 
    11 [ID_NETWORKEDITORCONFNODEMENUADDSLAVE, ID_NETWORKEDITORCONFNODEMENUREMOVESLAVE, 
    23 ] = [wx.NewId() for _init_coll_AddMenu_Items in range(6)]
    23 ] = [wx.NewId() for _init_coll_AddMenu_Items in range(6)]
    24 
    24 
    25 class NetworkEditor(ConfTreeNodeEditor, NetworkEditorTemplate):
    25 class NetworkEditor(ConfTreeNodeEditor, NetworkEditorTemplate):
    26     
    26     
    27     ID = ID_NETWORKEDITOR
    27     ID = ID_NETWORKEDITOR
       
    28     CONFNODEEDITOR_TABS = [
       
    29         (_("CANOpen network"), "_create_NetworkEditor")]
    28     
    30     
    29     def _init_coll_MainSizer_Items(self, parent):
    31     def _create_NetworkEditor(self, prnt):
    30         parent.AddWindow(self.NetworkNodes, 0, border=5, flag=wx.GROW|wx.ALL)
    32         self.NetworkEditor = wx.Panel(id=-1, parent=prnt, pos=wx.Point(0, 0), 
    31 
       
    32     def _init_coll_MainSizer_Growables(self, parent):
       
    33         parent.AddGrowableCol(0)
       
    34         parent.AddGrowableRow(0)
       
    35     
       
    36     def _init_sizers(self):
       
    37         self.MainSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=1, vgap=0)
       
    38         
       
    39         self._init_coll_MainSizer_Items(self.MainSizer)
       
    40         self._init_coll_MainSizer_Growables(self.MainSizer)
       
    41         
       
    42         self.ConfNodeEditor.SetSizer(self.MainSizer)
       
    43     
       
    44     def _init_ConfNodeEditor(self, prnt):
       
    45         self.ConfNodeEditor = wx.Panel(id=-1, parent=prnt, pos=wx.Point(0, 0), 
       
    46                 size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
    33                 size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
    47         
    34         
    48         NetworkEditorTemplate._init_ctrls(self, self.ConfNodeEditor)
    35         NetworkEditorTemplate._init_ctrls(self, self.NetworkEditor)
    49         
    36         
    50         self._init_sizers()
    37         main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=1, vgap=0)
       
    38         main_sizer.AddGrowableCol(0)
       
    39         main_sizer.AddGrowableRow(0)
    51         
    40         
       
    41         main_sizer.AddWindow(self.NetworkNodes, 0, border=5, flag=wx.GROW|wx.ALL)
       
    42     
       
    43         self.NetworkEditor.SetSizer(main_sizer)
       
    44     
       
    45         return self.NetworkEditor
       
    46     
    52     def __init__(self, parent, controler, window):
    47     def __init__(self, parent, controler, window):
    53         ConfTreeNodeEditor.__init__(self, parent, controler, window)
    48         ConfTreeNodeEditor.__init__(self, parent, controler, window)
    54         NetworkEditorTemplate.__init__(self, controler, window, False)
    49         NetworkEditorTemplate.__init__(self, controler, window, False)
    55     
    50     
    56         self.RefreshNetworkNodes()
    51         self.RefreshNetworkNodes()
    74             for text, indexes in self.Manager.GetCurrentSpecificMenu():
    69             for text, indexes in self.Manager.GetCurrentSpecificMenu():
    75                 add_menu.append((wx.ITEM_NORMAL, (text, wx.NewId(), '', self.GetProfileCallBack(text))))
    70                 add_menu.append((wx.ITEM_NORMAL, (text, wx.NewId(), '', self.GetProfileCallBack(text))))
    76         else:
    71         else:
    77             other_profile_text = _('Other Profile')
    72             other_profile_text = _('Other Profile')
    78         
    73         
    79         master_menu = [(wx.ITEM_NORMAL, (_('Node infos'), ID_NETWORKEDITORMASTERMENUNODEINFOS, '', self.OnNodeInfosMenu)),
    74         master_menu = [(wx.ITEM_NORMAL, (_('DS-301 Profile'), ID_NETWORKEDITORMASTERMENUDS301PROFILE, '', self.OnCommunicationMenu)),
    80                        (wx.ITEM_NORMAL, (_('DS-301 Profile'), ID_NETWORKEDITORMASTERMENUDS301PROFILE, '', self.OnCommunicationMenu)),
       
    81                        (wx.ITEM_NORMAL, (_('DS-302 Profile'), ID_NETWORKEDITORMASTERMENUDS302PROFILE, '', self.OnOtherCommunicationMenu)),
    75                        (wx.ITEM_NORMAL, (_('DS-302 Profile'), ID_NETWORKEDITORMASTERMENUDS302PROFILE, '', self.OnOtherCommunicationMenu)),
    82                        (wx.ITEM_NORMAL, (other_profile_text, ID_NETWORKEDITORMASTERMENUDSOTHERPROFILE, '', self.OnEditProfileMenu)),
    76                        (wx.ITEM_NORMAL, (other_profile_text, ID_NETWORKEDITORMASTERMENUDSOTHERPROFILE, '', self.OnEditProfileMenu)),
    83                        (wx.ITEM_SEPARATOR, None),
    77                        (wx.ITEM_SEPARATOR, None),
    84                        (add_menu, (_('Add'), ID_NETWORKEDITORMASTERMENUADD))]
    78                        (add_menu, (_('Add'), ID_NETWORKEDITORMASTERMENUADD))]
    85         
    79