author | laurent |
Tue, 11 Sep 2012 16:33:39 +0200 | |
changeset 822 | 050045c32d98 |
parent 816 | 079ed646266f |
child 845 | 412a9f05070f |
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 |
814 | 6 |
from editors.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): |
816
079ed646266f
Fix bug in canfestivel extension when Show Master Generated on Windows
laurent
parents:
814
diff
changeset
|
58 |
if self.Editable: |
079ed646266f
Fix bug in canfestivel extension when Show Master Generated on Windows
laurent
parents:
814
diff
changeset
|
59 |
confnode_menu.Enable(ID_SLAVEEDITORCONFNODEMENUDSOTHERPROFILE, False) |
680
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
60 |
|
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
61 |
def RefreshView(self): |
762
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
738
diff
changeset
|
62 |
ConfTreeNodeEditor.RefreshView(self) |
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
738
diff
changeset
|
63 |
self.ConfNodeEditor.RefreshIndexList() |
680
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
64 |
|
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
65 |
def RefreshCurrentIndexList(self): |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
66 |
self.RefreshView() |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
67 |
|
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
68 |
def RefreshBufferState(self): |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
69 |
self.ParentWindow.RefreshTitle() |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
70 |
self.ParentWindow.RefreshFileMenu() |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
71 |
self.ParentWindow.RefreshEditMenu() |
61746934df41
Adding support for integrating CanFestival plugin panels in Beremiz main frame
smarteh-dev
parents:
diff
changeset
|
72 |
self.ParentWindow.RefreshPageTitles() |
777 | 73 |
|
74 |
class MasterViewer(SlaveEditor): |
|
75 |
SHOW_PARAMS = False |
|
76 |
||
77 |
def __init__(self, parent, controler, window): |
|
78 |
SlaveEditor.__init__(self, parent, controler, window, False) |
|
79 |