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