smarteh-dev@680: smarteh-dev@680: import wx smarteh-dev@680: smarteh-dev@680: from subindextable import EditingPanel smarteh-dev@680: from nodeeditor import NodeEditorTemplate laurent@762: from ConfTreeNodeEditor import ConfTreeNodeEditor smarteh-dev@680: Edouard@717: [ID_SLAVEEDITORCONFNODEMENUNODEINFOS, ID_SLAVEEDITORCONFNODEMENUDS301PROFILE, Edouard@717: ID_SLAVEEDITORCONFNODEMENUDS302PROFILE, ID_SLAVEEDITORCONFNODEMENUDSOTHERPROFILE, Edouard@717: ID_SLAVEEDITORCONFNODEMENUADD, Edouard@717: ] = [wx.NewId() for _init_coll_ConfNodeMenu_Items in range(5)] smarteh-dev@680: smarteh-dev@680: [ID_SLAVEEDITORADDMENUSDOSERVER, ID_SLAVEEDITORADDMENUSDOCLIENT, smarteh-dev@680: ID_SLAVEEDITORADDMENUPDOTRANSMIT, ID_SLAVEEDITORADDMENUPDORECEIVE, smarteh-dev@680: ID_SLAVEEDITORADDMENUMAPVARIABLE, ID_SLAVEEDITORADDMENUUSERTYPE, smarteh-dev@680: ] = [wx.NewId() for _init_coll_AddMenu_Items in range(6)] smarteh-dev@680: laurent@762: class SlaveEditor(ConfTreeNodeEditor, NodeEditorTemplate): smarteh-dev@680: laurent@762: def _init_ConfNodeEditor(self, prnt): laurent@762: self.ConfNodeEditor = EditingPanel(prnt, self, self.Controler, self.Editable) smarteh-dev@680: smarteh-dev@680: def __init__(self, parent, controler, window, editable=True): smarteh-dev@680: self.Editable = editable laurent@762: ConfTreeNodeEditor.__init__(self, parent, controler, window) smarteh-dev@680: NodeEditorTemplate.__init__(self, controler, window, False) smarteh-dev@680: smarteh-dev@680: def __del__(self): smarteh-dev@680: self.Controler.OnCloseEditor(self) smarteh-dev@680: Edouard@717: def GetConfNodeMenuItems(self): smarteh-dev@680: if self.Editable: smarteh-dev@680: add_menu = [(wx.ITEM_NORMAL, (_('SDO Server'), ID_SLAVEEDITORADDMENUSDOSERVER, '', self.OnAddSDOServerMenu)), smarteh-dev@680: (wx.ITEM_NORMAL, (_('SDO Client'), ID_SLAVEEDITORADDMENUSDOCLIENT, '', self.OnAddSDOClientMenu)), smarteh-dev@680: (wx.ITEM_NORMAL, (_('PDO Transmit'), ID_SLAVEEDITORADDMENUPDOTRANSMIT, '', self.OnAddPDOTransmitMenu)), smarteh-dev@680: (wx.ITEM_NORMAL, (_('PDO Receive'), ID_SLAVEEDITORADDMENUPDORECEIVE, '', self.OnAddPDOReceiveMenu)), smarteh-dev@680: (wx.ITEM_NORMAL, (_('Map Variable'), ID_SLAVEEDITORADDMENUMAPVARIABLE, '', self.OnAddMapVariableMenu)), smarteh-dev@680: (wx.ITEM_NORMAL, (_('User Type'), ID_SLAVEEDITORADDMENUUSERTYPE, '', self.OnAddUserTypeMenu))] smarteh-dev@680: smarteh-dev@680: profile = self.Controler.GetCurrentProfileName() smarteh-dev@680: if profile not in ("None", "DS-301"): smarteh-dev@680: other_profile_text = _("%s Profile") % profile smarteh-dev@680: add_menu.append((wx.ITEM_SEPARATOR, None)) smarteh-dev@680: for text, indexes in self.Manager.GetCurrentSpecificMenu(): smarteh-dev@680: add_menu.append((wx.ITEM_NORMAL, (text, wx.NewId(), '', self.GetProfileCallBack(text)))) smarteh-dev@680: else: smarteh-dev@680: other_profile_text = _('Other Profile') smarteh-dev@680: Edouard@717: return [(wx.ITEM_NORMAL, (_('Node infos'), ID_SLAVEEDITORCONFNODEMENUNODEINFOS, '', self.OnNodeInfosMenu)), Edouard@717: (wx.ITEM_NORMAL, (_('DS-301 Profile'), ID_SLAVEEDITORCONFNODEMENUDS301PROFILE, '', self.OnCommunicationMenu)), Edouard@717: (wx.ITEM_NORMAL, (_('DS-302 Profile'), ID_SLAVEEDITORCONFNODEMENUDS302PROFILE, '', self.OnOtherCommunicationMenu)), Edouard@717: (wx.ITEM_NORMAL, (other_profile_text, ID_SLAVEEDITORCONFNODEMENUDSOTHERPROFILE, '', self.OnEditProfileMenu)), smarteh-dev@680: (wx.ITEM_SEPARATOR, None), Edouard@717: (add_menu, (_('Add'), ID_SLAVEEDITORCONFNODEMENUADD))] smarteh-dev@680: return [] smarteh-dev@680: Edouard@717: def RefreshConfNodeMenu(self, confnode_menu): Edouard@717: confnode_menu.Enable(ID_SLAVEEDITORCONFNODEMENUDSOTHERPROFILE, False) smarteh-dev@680: smarteh-dev@680: def RefreshView(self): laurent@762: ConfTreeNodeEditor.RefreshView(self) laurent@762: self.ConfNodeEditor.RefreshIndexList() smarteh-dev@680: smarteh-dev@680: def RefreshCurrentIndexList(self): smarteh-dev@680: self.RefreshView() smarteh-dev@680: smarteh-dev@680: def RefreshBufferState(self): smarteh-dev@680: self.ParentWindow.RefreshTitle() smarteh-dev@680: self.ParentWindow.RefreshFileMenu() smarteh-dev@680: self.ParentWindow.RefreshEditMenu() smarteh-dev@680: self.ParentWindow.RefreshPageTitles() laurent@777: laurent@777: class MasterViewer(SlaveEditor): laurent@777: SHOW_PARAMS = False laurent@777: laurent@777: def __init__(self, parent, controler, window): laurent@777: SlaveEditor.__init__(self, parent, controler, window, False) laurent@777: