Commit a6b824ca authored by Guillaume Seguin's avatar Guillaume Seguin

Rename centersizer to cbuttonssizer

Better name will ease understanding the code :)
parent daa62329
...@@ -163,11 +163,11 @@ class MainWindow(wx.Frame): ...@@ -163,11 +163,11 @@ class MainWindow(wx.Frame):
self.Bind(wx.EVT_CLOSE, self.kill) self.Bind(wx.EVT_CLOSE, self.kill)
# Custom buttons # Custom buttons
if wx.VERSION > (2, 9): self.centersizer = wx.WrapSizer(wx.HORIZONTAL) if wx.VERSION > (2, 9): self.cbuttonssizer = wx.WrapSizer(wx.HORIZONTAL)
else: self.centersizer = wx.GridBagSizer() else: self.cbuttonssizer = wx.GridBagSizer()
self.centersizer = wx.GridBagSizer() self.cbuttonssizer = wx.GridBagSizer()
self.centerpanel = self.newPanel(page1panel2) self.centerpanel = self.newPanel(page1panel2)
self.centerpanel.SetSizer(self.centersizer) self.centerpanel.SetSizer(self.cbuttonssizer)
rightsizer.Add(self.centerpanel, 0, wx.ALIGN_CENTER) rightsizer.Add(self.centerpanel, 0, wx.ALIGN_CENTER)
rightsizer.AddStretchSpacer() rightsizer.AddStretchSpacer()
...@@ -214,10 +214,10 @@ class MainWindow(wx.Frame): ...@@ -214,10 +214,10 @@ class MainWindow(wx.Frame):
logpanel = self.newPanel(left_real_panel) logpanel = self.newPanel(left_real_panel)
viz_pane = VizPane(self, vizpanel) viz_pane = VizPane(self, vizpanel)
# Custom buttons # Custom buttons
if wx.VERSION > (2, 9): self.centersizer = wx.WrapSizer(wx.HORIZONTAL) if wx.VERSION > (2, 9): self.cbuttonssizer = wx.WrapSizer(wx.HORIZONTAL)
else: self.centersizer = wx.GridBagSizer() else: self.cbuttonssizer = wx.GridBagSizer()
self.centerpanel = self.newPanel(vizpanel) self.centerpanel = self.newPanel(vizpanel)
self.centerpanel.SetSizer(self.centersizer) self.centerpanel.SetSizer(self.cbuttonssizer)
viz_pane.Add(self.centerpanel, 0, flag = wx.ALIGN_CENTER) viz_pane.Add(self.centerpanel, 0, flag = wx.ALIGN_CENTER)
vizpanel.SetSizer(viz_pane) vizpanel.SetSizer(viz_pane)
if compact: if compact:
......
...@@ -1000,7 +1000,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>.""" ...@@ -1000,7 +1000,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
def cbuttons_reload(self): def cbuttons_reload(self):
allcbs = getattr(self, "custombuttons_widgets", []) allcbs = getattr(self, "custombuttons_widgets", [])
for button in allcbs: for button in allcbs:
self.centersizer.Detach(button) self.cbuttonssizer.Detach(button)
button.Destroy() button.Destroy()
self.custombuttons_widgets = [] self.custombuttons_widgets = []
custombuttons = self.custombuttons[:] + [None] custombuttons = self.custombuttons[:] + [None]
...@@ -1028,10 +1028,10 @@ Printrun. If not, see <http://www.gnu.org/licenses/>.""" ...@@ -1028,10 +1028,10 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
b.Bind(wx.EVT_BUTTON, self.procbutton) b.Bind(wx.EVT_BUTTON, self.procbutton)
b.Bind(wx.EVT_MOUSE_EVENTS, self.editbutton) b.Bind(wx.EVT_MOUSE_EVENTS, self.editbutton)
self.custombuttons_widgets.append(b) self.custombuttons_widgets.append(b)
if type(self.centersizer) == wx.GridBagSizer: if type(self.cbuttonssizer) == wx.GridBagSizer:
self.centersizer.Add(b, pos = (i // 4, i % 4), flag = wx.EXPAND) self.cbuttonssizer.Add(b, pos = (i // 4, i % 4), flag = wx.EXPAND)
else: else:
self.centersizer.Add(b, flag = wx.EXPAND) self.cbuttonssizer.Add(b, flag = wx.EXPAND)
self.centerpanel.Layout() self.centerpanel.Layout()
self.centerpanel.GetContainingSizer().Layout() self.centerpanel.GetContainingSizer().Layout()
...@@ -1223,9 +1223,9 @@ Printrun. If not, see <http://www.gnu.org/licenses/>.""" ...@@ -1223,9 +1223,9 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
#if dst is None and self.panel.GetScreenRect().Contains(scrpos): #if dst is None and self.panel.GetScreenRect().Contains(scrpos):
# # try to check if it is after buttons at the end # # try to check if it is after buttons at the end
# tspos = self.panel.ClientToScreen(self.toolbarsizer.GetPosition()) # tspos = self.panel.ClientToScreen(self.toolbarsizer.GetPosition())
# bspos = self.panel.ClientToScreen(self.centersizer.GetPosition()) # bspos = self.panel.ClientToScreen(self.cbuttonssizer.GetPosition())
# tsrect = wx.Rect(*(tspos.Get()+self.toolbarsizer.GetSize().Get())) # tsrect = wx.Rect(*(tspos.Get()+self.toolbarsizer.GetSize().Get()))
# bsrect = wx.Rect(*(bspos.Get()+self.centersizer.GetSize().Get())) # bsrect = wx.Rect(*(bspos.Get()+self.cbuttonssizer.GetSize().Get()))
# lbrect = btns[-1].GetScreenRect() # lbrect = btns[-1].GetScreenRect()
# p = scrpos.Get() # p = scrpos.Get()
# if len(btns)<4 and tsrect.Contains(scrpos): # if len(btns)<4 and tsrect.Contains(scrpos):
......
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