Commit e84eedd8 authored by Guillaume Seguin's avatar Guillaume Seguin

Rework left pane, rename LeftPane to ControlsSizer

parent 6aad8c63
...@@ -326,10 +326,10 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode ...@@ -326,10 +326,10 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None, mini_mode
for key, btn in extra_buttons.items(): for key, btn in extra_buttons.items():
add(key, btn, flag = wx.EXPAND) add(key, btn, flag = wx.EXPAND)
class LeftPane(wx.GridBagSizer): class ControlsSizer(wx.GridBagSizer):
def __init__(self, root, parentpanel = None, standalone_mode = False, mini_mode = False): def __init__(self, root, parentpanel = None, standalone_mode = False, mini_mode = False):
super(LeftPane, self).__init__() super(ControlsSizer, self).__init__()
if not parentpanel: parentpanel = root.panel if not parentpanel: parentpanel = root.panel
if mini_mode: self.make_mini(root, parentpanel) if mini_mode: self.make_mini(root, parentpanel)
else: self.make_standard(root, parentpanel, standalone_mode) else: self.make_standard(root, parentpanel, standalone_mode)
...@@ -509,13 +509,14 @@ class ToggleablePane(wx.BoxSizer): ...@@ -509,13 +509,14 @@ class ToggleablePane(wx.BoxSizer):
self.button.SetLabel(">" if self.button.GetLabel() == "<" else "<") self.button.SetLabel(">" if self.button.GetLabel() == "<" else "<")
class LeftPaneToggleable(ToggleablePane): class LeftPaneToggleable(ToggleablePane):
def __init__(self, root, parentpanel, parentsizer, mini_mode): def __init__(self, root, parentpanel, parentsizer):
super(LeftPaneToggleable, self).__init__(root, "<", parentpanel, parentsizer) super(LeftPaneToggleable, self).__init__(root, "<", parentpanel, parentsizer)
pane = LeftPane(root, self.panepanel, mini_mode = mini_mode)
self.panepanel.SetSizer(pane)
self.Add(self.panepanel, 0, wx.EXPAND) self.Add(self.panepanel, 0, wx.EXPAND)
self.Add(self.button, 0) self.Add(self.button, 0)
def set_sizer(self, sizer):
self.panepanel.SetSizer(sizer)
def on_show(self): def on_show(self):
self.parentsizer.Layout() self.parentsizer.Layout()
...@@ -637,11 +638,11 @@ class MainWindow(wx.Frame): ...@@ -637,11 +638,11 @@ class MainWindow(wx.Frame):
self.lowersizer = wx.BoxSizer(wx.HORIZONTAL) self.lowersizer = wx.BoxSizer(wx.HORIZONTAL)
page1panel2.SetSizer(self.lowersizer) page1panel2.SetSizer(self.lowersizer)
leftsizer = wx.BoxSizer(wx.VERTICAL) leftsizer = wx.BoxSizer(wx.VERTICAL)
left_pane = LeftPane(self, page1panel2, True) controls_sizer = ControlsSizer(self, page1panel2, True)
leftsizer.Add(left_pane, 1, wx.ALIGN_CENTER) leftsizer.Add(controls_sizer, 1, wx.ALIGN_CENTER)
rightsizer = wx.BoxSizer(wx.VERTICAL) rightsizer = wx.BoxSizer(wx.VERTICAL)
extracontrols = wx.GridBagSizer() extracontrols = wx.GridBagSizer()
add_extra_controls(extracontrols, self, page1panel2, left_pane.extra_buttons) add_extra_controls(extracontrols, self, page1panel2, controls_sizer.extra_buttons)
rightsizer.AddStretchSpacer() rightsizer.AddStretchSpacer()
rightsizer.Add(extracontrols, 0, wx.ALIGN_CENTER) rightsizer.Add(extracontrols, 0, wx.ALIGN_CENTER)
self.lowersizer.Add(leftsizer, 0, wx.ALIGN_CENTER | wx.RIGHT, border = 10) self.lowersizer.Add(leftsizer, 0, wx.ALIGN_CENTER | wx.RIGHT, border = 10)
...@@ -705,12 +706,15 @@ class MainWindow(wx.Frame): ...@@ -705,12 +706,15 @@ class MainWindow(wx.Frame):
upperpanel.SetSizer(self.uppersizer) upperpanel.SetSizer(self.uppersizer)
lowerpanel.SetSizer(self.lowersizer) lowerpanel.SetSizer(self.lowersizer)
leftpanel = self.newPanel(lowerpanel) leftpanel = self.newPanel(lowerpanel)
left_pane = LeftPaneToggleable(self, leftpanel, left_pane = LeftPaneToggleable(self, leftpanel, self.lowersizer)
self.lowersizer, mini_mode = mini) leftpanel.SetSizer(left_pane)
left_pane.Layout() # required to get correct rows/cols counts left_real_panel = left_pane.panepanel
controls_panel = self.newPanel(left_real_panel)
controls_sizer = ControlsSizer(self, controls_panel, mini_mode = mini)
controls_panel.SetSizer(controls_sizer)
left_sizer = wx.BoxSizer(wx.VERTICAL) left_sizer = wx.BoxSizer(wx.VERTICAL)
left_sizer.Add(left_pane, 1, wx.EXPAND) left_sizer.Add(controls_panel, 1, wx.EXPAND)
leftpanel.SetSizer(left_sizer) left_pane.set_sizer(left_sizer)
self.lowersizer.Add(leftpanel, 0, wx.EXPAND) self.lowersizer.Add(leftpanel, 0, wx.EXPAND)
if not compact: # Use a splitterwindow to group viz and log if not compact: # Use a splitterwindow to group viz and log
rightpanel = self.newPanel(lowerpanel) rightpanel = self.newPanel(lowerpanel)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment