|
1 |
|
2 import wx |
|
3 |
|
4 from controls import ProjectPropertiesPanel, VariablePanel |
|
5 from EditorPanel import EditorPanel |
|
6 from ConfTreeNodeEditor import ConfTreeNodeEditor |
|
7 |
|
8 class ProjectNodeEditor(ConfTreeNodeEditor): |
|
9 |
|
10 SHOW_BASE_PARAMS = False |
|
11 ENABLE_REQUIRED = True |
|
12 CONFNODEEDITOR_TABS = [ |
|
13 (_("Config variables"), "_create_VariablePanel"), |
|
14 (_("Project properties"), "_create_ProjectPropertiesPanel")] |
|
15 |
|
16 def _create_VariablePanel(self, prnt): |
|
17 self.VariableEditorPanel = VariablePanel(prnt, self, self.Controler, "config", self.Debug) |
|
18 self.VariableEditorPanel.SetTagName(self.TagName) |
|
19 |
|
20 return self.VariableEditorPanel |
|
21 |
|
22 def _create_ProjectPropertiesPanel(self, prnt): |
|
23 self.ProjectProperties = ProjectPropertiesPanel(prnt, self.Controler, self.ParentWindow, self.ENABLE_REQUIRED) |
|
24 |
|
25 return self.ProjectProperties |
|
26 |
|
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 |
|
34 ConfTreeNodeEditor.__init__(self, parent, controler, window, tagname) |
|
35 |
|
36 buttons_sizer = self.GenerateMethodButtonSizer() |
|
37 self.ParamsEditorSizer.InsertSizer(0, buttons_sizer, 0, border=5, |
|
38 flag=wx.LEFT|wx.RIGHT|wx.TOP) |
|
39 self.ParamsEditorSizer.Layout() |
|
40 |
|
41 self.VariableEditor = self.VariableEditorPanel |
|
42 |
|
43 def GetTagName(self): |
|
44 return self.Controler.CTNName() |
|
45 |
|
46 def SetTagName(self, tagname): |
|
47 self.TagName = tagname |
|
48 if self.VariableEditor is not None: |
|
49 self.VariableEditor.SetTagName(tagname) |
|
50 |
|
51 def GetTitle(self): |
|
52 fullname = _(self.Controler.CTNName()) |
|
53 if self.Controler.CTNTestModified(): |
|
54 return "~%s~" % fullname |
|
55 return fullname |
|
56 |
|
57 def RefreshView(self, variablepanel=True): |
|
58 ConfTreeNodeEditor.RefreshView(self) |
|
59 if variablepanel: |
|
60 self.VariableEditor.RefreshView() |
|
61 #self.ProjectProperties.RefreshView() |
|
62 |
|
63 def GetBufferState(self): |
|
64 return self.Controler.GetBufferState() |
|
65 |
|
66 def Undo(self): |
|
67 self.Controler.LoadPrevious() |
|
68 self.ParentWindow.CloseTabsWithoutModel() |
|
69 |
|
70 def Redo(self): |
|
71 self.Controler.LoadNext() |
|
72 self.ParentWindow.CloseTabsWithoutModel() |
|
73 |