author | laurent |
Mon, 27 Aug 2012 23:36:57 +0200 | |
changeset 806 | abf1afc1f04d |
parent 777 | daa6941fe21a |
child 814 | 5743cbdff669 |
permissions | -rw-r--r-- |
680
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
1 |
|
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
2 |
import wx |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
3 |
|
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
4 |
from subindextable import EditingPanel |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
5 |
from nodeeditor import NodeEditorTemplate |
762
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
738
diff
changeset
|
6 |
from ConfTreeNodeEditor import ConfTreeNodeEditor |
680
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
7 |
|
717 | 8 |
[ID_SLAVEEDITORCONFNODEMENUNODEINFOS, ID_SLAVEEDITORCONFNODEMENUDS301PROFILE, |
9 |
ID_SLAVEEDITORCONFNODEMENUDS302PROFILE, ID_SLAVEEDITORCONFNODEMENUDSOTHERPROFILE, |
|
10 |
ID_SLAVEEDITORCONFNODEMENUADD, |
|
11 |
] = [wx.NewId() for _init_coll_ConfNodeMenu_Items in range(5)] |
|
680
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
12 |
|
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
13 |
[ID_SLAVEEDITORADDMENUSDOSERVER, ID_SLAVEEDITORADDMENUSDOCLIENT, |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
14 |
ID_SLAVEEDITORADDMENUPDOTRANSMIT, ID_SLAVEEDITORADDMENUPDORECEIVE, |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
15 |
ID_SLAVEEDITORADDMENUMAPVARIABLE, ID_SLAVEEDITORADDMENUUSERTYPE, |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
16 |
] = [wx.NewId() for _init_coll_AddMenu_Items in range(6)] |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
17 |
|
762
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
738
diff
changeset
|
18 |
class SlaveEditor(ConfTreeNodeEditor, NodeEditorTemplate): |
680
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
19 |
|
762
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
738
diff
changeset
|
20 |
def _init_ConfNodeEditor(self, prnt): |
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
738
diff
changeset
|
21 |
self.ConfNodeEditor = EditingPanel(prnt, self, self.Controler, self.Editable) |
680
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
22 |
|
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
23 |
def __init__(self, parent, controler, window, editable=True): |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
24 |
self.Editable = editable |
762
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
738
diff
changeset
|
25 |
ConfTreeNodeEditor.__init__(self, parent, controler, window) |
680
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
26 |
NodeEditorTemplate.__init__(self, controler, window, False) |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
27 |
|
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
28 |
def __del__(self): |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
29 |
self.Controler.OnCloseEditor(self) |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
30 |
|
717 | 31 |
def GetConfNodeMenuItems(self): |
680
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
32 |
if self.Editable: |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
33 |
add_menu = [(wx.ITEM_NORMAL, (_('SDO Server'), ID_SLAVEEDITORADDMENUSDOSERVER, '', self.OnAddSDOServerMenu)), |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
34 |
(wx.ITEM_NORMAL, (_('SDO Client'), ID_SLAVEEDITORADDMENUSDOCLIENT, '', self.OnAddSDOClientMenu)), |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
35 |
(wx.ITEM_NORMAL, (_('PDO Transmit'), ID_SLAVEEDITORADDMENUPDOTRANSMIT, '', self.OnAddPDOTransmitMenu)), |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
36 |
(wx.ITEM_NORMAL, (_('PDO Receive'), ID_SLAVEEDITORADDMENUPDORECEIVE, '', self.OnAddPDOReceiveMenu)), |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
37 |
(wx.ITEM_NORMAL, (_('Map Variable'), ID_SLAVEEDITORADDMENUMAPVARIABLE, '', self.OnAddMapVariableMenu)), |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
38 |
(wx.ITEM_NORMAL, (_('User Type'), ID_SLAVEEDITORADDMENUUSERTYPE, '', self.OnAddUserTypeMenu))] |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
39 |
|
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
40 |
profile = self.Controler.GetCurrentProfileName() |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
41 |
if profile not in ("None", "DS-301"): |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
42 |
other_profile_text = _("%s Profile") % profile |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
43 |
add_menu.append((wx.ITEM_SEPARATOR, None)) |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
44 |
for text, indexes in self.Manager.GetCurrentSpecificMenu(): |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
45 |
add_menu.append((wx.ITEM_NORMAL, (text, wx.NewId(), '', self.GetProfileCallBack(text)))) |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
46 |
else: |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
47 |
other_profile_text = _('Other Profile') |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
48 |
|
717 | 49 |
return [(wx.ITEM_NORMAL, (_('Node infos'), ID_SLAVEEDITORCONFNODEMENUNODEINFOS, '', self.OnNodeInfosMenu)), |
50 |
(wx.ITEM_NORMAL, (_('DS-301 Profile'), ID_SLAVEEDITORCONFNODEMENUDS301PROFILE, '', self.OnCommunicationMenu)), |
|
51 |
(wx.ITEM_NORMAL, (_('DS-302 Profile'), ID_SLAVEEDITORCONFNODEMENUDS302PROFILE, '', self.OnOtherCommunicationMenu)), |
|
52 |
(wx.ITEM_NORMAL, (other_profile_text, ID_SLAVEEDITORCONFNODEMENUDSOTHERPROFILE, '', self.OnEditProfileMenu)), |
|
680
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
53 |
(wx.ITEM_SEPARATOR, None), |
717 | 54 |
(add_menu, (_('Add'), ID_SLAVEEDITORCONFNODEMENUADD))] |
680
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
55 |
return [] |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
56 |
|
717 | 57 |
def RefreshConfNodeMenu(self, confnode_menu): |
58 |
confnode_menu.Enable(ID_SLAVEEDITORCONFNODEMENUDSOTHERPROFILE, False) |
|
680
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
59 |
|
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
60 |
def RefreshView(self): |
762
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
738
diff
changeset
|
61 |
ConfTreeNodeEditor.RefreshView(self) |
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
738
diff
changeset
|
62 |
self.ConfNodeEditor.RefreshIndexList() |
680
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
63 |
|
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
64 |
def RefreshCurrentIndexList(self): |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
65 |
self.RefreshView() |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
66 |
|
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
67 |
def RefreshBufferState(self): |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
68 |
self.ParentWindow.RefreshTitle() |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
69 |
self.ParentWindow.RefreshFileMenu() |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
70 |
self.ParentWindow.RefreshEditMenu() |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
71 |
self.ParentWindow.RefreshPageTitles() |
777 | 72 |
|
73 |
class MasterViewer(SlaveEditor): |
|
74 |
SHOW_PARAMS = False |
|
75 |
||
76 |
def __init__(self, parent, controler, window): |
|
77 |
SlaveEditor.__init__(self, parent, controler, window, False) |
|
78 |