author | laurent |
Thu, 13 Sep 2012 02:13:40 +0200 | |
changeset 831 | dec885ba1f2b |
parent 815 | e4f24593a758 |
child 920 | 1499a4d225db |
permissions | -rw-r--r-- |
738 | 1 |
|
2 |
import wx |
|
3 |
||
814 | 4 |
from controls import ProjectPropertiesPanel |
5 |
from EditorPanel import EditorPanel |
|
738 | 6 |
from ConfTreeNodeEditor import ConfTreeNodeEditor, WINDOW_COLOUR |
7 |
||
8 |
class ProjectNodeEditor(ConfTreeNodeEditor): |
|
9 |
||
10 |
VARIABLE_PANEL_TYPE = "config" |
|
762
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
756
diff
changeset
|
11 |
ENABLE_REQUIRED = True |
738 | 12 |
|
13 |
def _init_Editor(self, prnt): |
|
14 |
self.Editor = wx.ScrolledWindow(prnt, -1, size=wx.Size(-1, -1), |
|
15 |
style=wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER|wx.HSCROLL|wx.VSCROLL) |
|
16 |
self.Editor.SetBackgroundColour(WINDOW_COLOUR) |
|
743 | 17 |
self.Editor.Bind(wx.EVT_SIZE, self.OnWindowResize) |
18 |
self.Editor.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel) |
|
738 | 19 |
self.ParamsEditor = self.Editor |
20 |
||
21 |
# Variable allowing disabling of Editor scroll when Popup shown |
|
22 |
self.ScrollingEnabled = True |
|
23 |
||
24 |
self.ParamsEditorSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5) |
|
25 |
self.ParamsEditorSizer.AddGrowableCol(0) |
|
26 |
self.ParamsEditorSizer.AddGrowableRow(1) |
|
27 |
||
28 |
self.Editor.SetSizer(self.ParamsEditorSizer) |
|
29 |
||
30 |
||
31 |
buttons_sizer = self.GenerateMethodButtonSizer() |
|
32 |
self.ParamsEditorSizer.AddSizer(buttons_sizer, 0, border=5, |
|
33 |
flag=wx.GROW|wx.LEFT|wx.RIGHT|wx.TOP) |
|
34 |
||
756
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
35 |
projectproperties_sizer = wx.BoxSizer(wx.HORIZONTAL) |
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
36 |
self.ParamsEditorSizer.AddSizer(projectproperties_sizer, 0, border=5, |
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
37 |
flag=wx.LEFT|wx.RIGHT|wx.BOTTOM) |
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
38 |
|
762
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
756
diff
changeset
|
39 |
if self.SHOW_PARAMS: |
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
756
diff
changeset
|
40 |
self.ConfNodeParamsSizer = wx.BoxSizer(wx.VERTICAL) |
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
756
diff
changeset
|
41 |
projectproperties_sizer.AddSizer(self.ConfNodeParamsSizer, 0, border=5, |
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
756
diff
changeset
|
42 |
flag=wx.RIGHT) |
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
756
diff
changeset
|
43 |
else: |
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
756
diff
changeset
|
44 |
self.ConfNodeParamsSizer = None |
756
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
45 |
|
762
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
756
diff
changeset
|
46 |
self.ProjectProperties = ProjectPropertiesPanel(self.Editor, self.Controler, self.ParentWindow, self.ENABLE_REQUIRED) |
756
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
47 |
projectproperties_sizer.AddWindow(self.ProjectProperties, 0, border=0, flag=0) |
738 | 48 |
|
49 |
def __init__(self, parent, controler, window): |
|
50 |
configuration = controler.GetProjectMainConfigurationName() |
|
51 |
if configuration is not None: |
|
52 |
tagname = controler.ComputeConfigurationName(configuration) |
|
53 |
else: |
|
54 |
tagname = "" |
|
55 |
||
743 | 56 |
ConfTreeNodeEditor.__init__(self, parent, controler, window, tagname) |
738 | 57 |
|
58 |
def GetTagName(self): |
|
59 |
return self.Controler.CTNName() |
|
60 |
||
61 |
def GetTitle(self): |
|
815
e4f24593a758
Adding support for extending internationalization to extensions
laurent
parents:
814
diff
changeset
|
62 |
fullname = _(self.Controler.CTNName()) |
738 | 63 |
if self.Controler.CTNTestModified(): |
64 |
return "~%s~" % fullname |
|
65 |
return fullname |
|
746
2e09777a40d3
Fix refresh of ConfTreeNodeEditors content when values change
laurent
parents:
743
diff
changeset
|
66 |
|
800
e9406586bb14
Fix bug when modifying configuration global variable in ProjectNodeEditor
laurent
parents:
762
diff
changeset
|
67 |
def RefreshView(self, variablepanel=True): |
e9406586bb14
Fix bug when modifying configuration global variable in ProjectNodeEditor
laurent
parents:
762
diff
changeset
|
68 |
EditorPanel.RefreshView(self, variablepanel) |
762
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
756
diff
changeset
|
69 |
if self.ConfNodeParamsSizer is not None: |
aaacc83aa86b
Modifying canfestival plugin to following the new Beremiz confnode paradigm
laurent
parents:
756
diff
changeset
|
70 |
self.RefreshConfNodeParamsSizer() |
756
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
71 |
self.ProjectProperties.RefreshView() |
738 | 72 |
|
756
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
73 |
def GetBufferState(self): |
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
74 |
return self.Controler.GetBufferState() |
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
75 |
|
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
76 |
def Undo(self): |
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
77 |
self.Controler.LoadPrevious() |
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
78 |
self.ParentWindow.CloseTabsWithoutModel() |
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
79 |
|
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
80 |
def Redo(self): |
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
81 |
self.Controler.LoadNext() |
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
82 |
self.ParentWindow.CloseTabsWithoutModel() |
35cd28825be7
Integrating project properties panel into project window
laurent
parents:
746
diff
changeset
|
83 |