author | Laurent Bessard |
Tue, 23 Apr 2013 12:50:53 +0200 | |
changeset 1048 | b450202605ab |
parent 1036 | a6718197caf2 |
child 1055 | da483f620668 |
permissions | -rw-r--r-- |
738 | 1 |
|
2 |
import wx |
|
3 |
||
920
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
4 |
from controls import ProjectPropertiesPanel, VariablePanel |
814 | 5 |
from EditorPanel import EditorPanel |
920
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
6 |
from ConfTreeNodeEditor import ConfTreeNodeEditor |
738 | 7 |
|
8 |
class ProjectNodeEditor(ConfTreeNodeEditor): |
|
9 |
||
920
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
10 |
SHOW_BASE_PARAMS = False |
762
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
756
diff
changeset
|
11 |
ENABLE_REQUIRED = True |
920
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
12 |
CONFNODEEDITOR_TABS = [ |
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
13 |
(_("Config variables"), "_create_VariablePanel"), |
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
14 |
(_("Project properties"), "_create_ProjectPropertiesPanel")] |
738 | 15 |
|
920
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
16 |
def _create_VariablePanel(self, prnt): |
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
17 |
self.VariableEditorPanel = VariablePanel(prnt, self, self.Controler, "config", self.Debug) |
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
18 |
self.VariableEditorPanel.SetTagName(self.TagName) |
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
19 |
|
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
20 |
return self.VariableEditorPanel |
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
21 |
|
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
22 |
def _create_ProjectPropertiesPanel(self, prnt): |
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
23 |
self.ProjectProperties = ProjectPropertiesPanel(prnt, self.Controler, self.ParentWindow, self.ENABLE_REQUIRED) |
738 | 24 |
|
920
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
25 |
return self.ProjectProperties |
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
26 |
|
738 | 27 |
def __init__(self, parent, controler, window): |
28 |
configuration = controler.GetProjectMainConfigurationName() |
|
29 |
if configuration is not None: |
|
30 |
tagname = controler.ComputeConfigurationName(configuration) |
|
31 |
else: |
|
32 |
tagname = "" |
|
33 |
||
743 | 34 |
ConfTreeNodeEditor.__init__(self, parent, controler, window, tagname) |
920
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
35 |
|
1036
a6718197caf2
Fixed bug in ProjectNodeEditor when base params panel is not shown
Laurent Bessard
parents:
920
diff
changeset
|
36 |
if self.SHOW_BASE_PARAMS: |
a6718197caf2
Fixed bug in ProjectNodeEditor when base params panel is not shown
Laurent Bessard
parents:
920
diff
changeset
|
37 |
buttons_sizer = self.GenerateMethodButtonSizer() |
a6718197caf2
Fixed bug in ProjectNodeEditor when base params panel is not shown
Laurent Bessard
parents:
920
diff
changeset
|
38 |
self.ParamsEditorSizer.InsertSizer(0, buttons_sizer, 0, border=5, |
a6718197caf2
Fixed bug in ProjectNodeEditor when base params panel is not shown
Laurent Bessard
parents:
920
diff
changeset
|
39 |
flag=wx.LEFT|wx.RIGHT|wx.TOP) |
a6718197caf2
Fixed bug in ProjectNodeEditor when base params panel is not shown
Laurent Bessard
parents:
920
diff
changeset
|
40 |
self.ParamsEditorSizer.Layout() |
a6718197caf2
Fixed bug in ProjectNodeEditor when base params panel is not shown
Laurent Bessard
parents:
920
diff
changeset
|
41 |
|
920
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
42 |
self.VariableEditor = self.VariableEditorPanel |
738 | 43 |
|
44 |
def GetTagName(self): |
|
45 |
return self.Controler.CTNName() |
|
46 |
||
920
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
47 |
def SetTagName(self, tagname): |
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
48 |
self.TagName = tagname |
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
49 |
if self.VariableEditor is not None: |
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
50 |
self.VariableEditor.SetTagName(tagname) |
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
51 |
|
738 | 52 |
def GetTitle(self): |
815
e4f24593a758
Adding support for extending internationalization to extensions
laurent
parents:
814
diff
changeset
|
53 |
fullname = _(self.Controler.CTNName()) |
738 | 54 |
if self.Controler.CTNTestModified(): |
55 |
return "~%s~" % fullname |
|
56 |
return fullname |
|
746
2e09777a40d3
Fix refresh of ConfTreeNodeEditors content when values change
laurent
parents:
743
diff
changeset
|
57 |
|
800
e9406586bb14
Fix bug when modifying configuration global variable in ProjectNodeEditor
laurent
parents:
762
diff
changeset
|
58 |
def RefreshView(self, variablepanel=True): |
920
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
59 |
ConfTreeNodeEditor.RefreshView(self) |
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
60 |
if variablepanel: |
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
61 |
self.VariableEditor.RefreshView() |
1499a4d225db
Replaced SplitterWindow in ConfTreeNodeEditor by Notebook
Laurent Bessard
parents:
815
diff
changeset
|
62 |
#self.ProjectProperties.RefreshView() |
738 | 63 |
|
756
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
64 |
def GetBufferState(self): |
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
65 |
return self.Controler.GetBufferState() |
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
66 |
|
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
67 |
def Undo(self): |
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
68 |
self.Controler.LoadPrevious() |
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
69 |
self.ParentWindow.CloseTabsWithoutModel() |
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
70 |
|
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
71 |
def Redo(self): |
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
72 |
self.Controler.LoadNext() |
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
73 |
self.ParentWindow.CloseTabsWithoutModel() |
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
74 |