141 |
141 |
142 class ConfTreeNodeEditor(EditorPanel): |
142 class ConfTreeNodeEditor(EditorPanel): |
143 |
143 |
144 SHOW_BASE_PARAMS = True |
144 SHOW_BASE_PARAMS = True |
145 SHOW_PARAMS = True |
145 SHOW_PARAMS = True |
146 |
146 CONFNODEEDITOR_TABS = [] |
147 def _init_ConfNodeEditor(self, prnt): |
|
148 self.ConfNodeEditor = None |
|
149 |
147 |
150 def _init_Editor(self, parent): |
148 def _init_Editor(self, parent): |
151 self.Editor = wx.SplitterWindow(parent, |
149 tabs_num = len(self.CONFNODEEDITOR_TABS) |
152 style=wx.SUNKEN_BORDER|wx.SP_3D) |
|
153 self.SetNeedUpdating(True) |
|
154 self.SetMinimumPaneSize(1) |
|
155 |
|
156 if self.SHOW_PARAMS: |
150 if self.SHOW_PARAMS: |
157 self.ParamsEditor = wx.ScrolledWindow(self.Editor, |
151 tabs_num += 1 |
158 style=wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER|wx.HSCROLL|wx.VSCROLL) |
152 |
|
153 if tabs_num > 1: |
|
154 self.Editor = wx.Panel(parent, |
|
155 style=wx.SUNKEN_BORDER|wx.SP_3D) |
|
156 |
|
157 main_sizer = wx.BoxSizer(wx.VERTICAL) |
|
158 |
|
159 self.ConfNodeNoteBook = wx.Notebook(self.Editor) |
|
160 parent = self.ConfNodeNoteBook |
|
161 main_sizer.AddWindow(self.ConfNodeNoteBook, 1, flag=wx.GROW) |
|
162 |
|
163 self.Editor.SetSizer(main_sizer) |
|
164 else: |
|
165 self.ConfNodeNoteBook = None |
|
166 self.Editor = None |
|
167 |
|
168 for title, create_func_name in self.CONFNODEEDITOR_TABS: |
|
169 editor = getattr(self, create_func_name)(parent) |
|
170 if self.ConfNodeNoteBook is not None: |
|
171 self.ConfNodeNoteBook.AddPage(editor, title) |
|
172 else: |
|
173 self.Editor = editor |
|
174 |
|
175 if self.SHOW_PARAMS: |
|
176 |
|
177 panel_style = wx.TAB_TRAVERSAL|wx.HSCROLL|wx.VSCROLL |
|
178 if self.ConfNodeNoteBook is None: |
|
179 panel_style |= wx.SUNKEN_BORDER |
|
180 self.ParamsEditor = wx.ScrolledWindow(parent, |
|
181 style=panel_style) |
159 self.ParamsEditor.SetBackgroundColour(WINDOW_COLOUR) |
182 self.ParamsEditor.SetBackgroundColour(WINDOW_COLOUR) |
160 self.ParamsEditor.Bind(wx.EVT_SIZE, self.OnWindowResize) |
183 self.ParamsEditor.Bind(wx.EVT_SIZE, self.OnWindowResize) |
161 self.ParamsEditor.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel) |
184 self.ParamsEditor.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel) |
162 |
185 |
163 # Variable allowing disabling of ParamsEditor scroll when Popup shown |
186 # Variable allowing disabling of ParamsEditor scroll when Popup shown |
219 self.ConfNodeParamsSizer = wx.BoxSizer(wx.VERTICAL) |
242 self.ConfNodeParamsSizer = wx.BoxSizer(wx.VERTICAL) |
220 self.ParamsEditorSizer.AddSizer(self.ConfNodeParamsSizer, border=5, |
243 self.ParamsEditorSizer.AddSizer(self.ConfNodeParamsSizer, border=5, |
221 flag=wx.LEFT|wx.RIGHT|wx.BOTTOM) |
244 flag=wx.LEFT|wx.RIGHT|wx.BOTTOM) |
222 |
245 |
223 self.RefreshConfNodeParamsSizer() |
246 self.RefreshConfNodeParamsSizer() |
|
247 |
|
248 if self.ConfNodeNoteBook is not None: |
|
249 self.ConfNodeNoteBook.AddPage(self.ParamsEditor, _("Config")) |
|
250 else: |
|
251 self.Editor = self.ParamsEditor |
224 else: |
252 else: |
225 self.ParamsEditor = None |
253 self.ParamsEditor = None |
226 |
|
227 self._init_ConfNodeEditor(self.Editor) |
|
228 |
|
229 if self.ConfNodeEditor is not None: |
|
230 if self.ParamsEditor is not None: |
|
231 min_size = self.ParamsEditorSizer.GetMinSize() |
|
232 self.Editor.SplitHorizontally(self.ParamsEditor, |
|
233 self.ConfNodeEditor, |
|
234 min(min_size.height, 200)) |
|
235 else: |
|
236 self.Editor.Initialize(self.ConfNodeEditor) |
|
237 elif self.ParamsEditor is not None: |
|
238 self.Editor.Initialize(self.ParamsEditor) |
|
239 |
254 |
240 def __init__(self, parent, controler, window, tagname=""): |
255 def __init__(self, parent, controler, window, tagname=""): |
241 EditorPanel.__init__(self, parent, tagname, window, controler) |
256 EditorPanel.__init__(self, parent, tagname, window, controler) |
242 |
257 |
243 icon_name = self.Controler.GetIconName() |
258 icon_name = self.Controler.GetIconName() |