Commit d46b470d authored by Guillaume Seguin's avatar Guillaume Seguin

Cleanup custom buttons positionning

parent 895c14e4
......@@ -390,7 +390,8 @@ class MainWindow(wx.Frame):
rightsizer = wx.BoxSizer(wx.VERTICAL)
extracontrols = wx.GridBagSizer()
add_extra_controls(extracontrols, self, page1panel2, left_pane.extra_buttons)
rightsizer.Add(extracontrols, 1, wx.ALIGN_CENTER)
rightsizer.AddStretchSpacer()
rightsizer.Add(extracontrols, 0, wx.ALIGN_CENTER)
self.lowersizer.Add(leftsizer, 1, wx.ALIGN_CENTER)
self.lowersizer.Add(rightsizer, 1, wx.ALIGN_CENTER)
self.mainsizer_page1.Add(page1panel2, 1, wx.EXPAND)
......@@ -420,7 +421,8 @@ class MainWindow(wx.Frame):
self.Bind(wx.EVT_CLOSE, self.kill)
vizpane.Detach(self.centersizer)
rightsizer.Add(self.centersizer, 0, wx.EXPAND)
rightsizer.Add(self.centersizer, 0, wx.ALIGN_CENTER)
rightsizer.AddStretchSpacer()
self.panel.SetSizerAndFit(self.notesizer)
......@@ -431,7 +433,7 @@ class MainWindow(wx.Frame):
i.Disable()
#self.panel.Fit()
self.cbuttons_panel = page1panel
self.cbuttons_panel = page1panel2
self.cbuttons_reload()
def createGui(self):
......
......@@ -723,26 +723,15 @@ class PronterWindow(MainWindow, pronsole.pronsole):
pass
def cbuttons_reload(self):
allcbs = []
ubs = self.uppersizer
allcbs = getattr(self, "custombuttonbuttons", [])
cs = self.centersizer
#for item in ubs.GetChildren():
# if hasattr(item.GetWindow(),"custombutton"):
# allcbs += [(ubs, item.GetWindow())]
for item in cs.GetChildren():
if hasattr(item.GetWindow(),"custombutton"):
allcbs += [(cs, item.GetWindow())]
for sizer, button in allcbs:
#sizer.Remove(button)
button.Destroy()
for button in allcbs:
cs.Detach(button)
self.custombuttonbuttons = []
newbuttonbuttonindex = len(self.custombuttons)
while newbuttonbuttonindex>0 and self.custombuttons[newbuttonbuttonindex-1] is None:
newbuttonbuttonindex -= 1
while len(self.custombuttons) < 13:
self.custombuttons.append(None)
for i in xrange(len(self.custombuttons)):
btndef = self.custombuttons[i]
for i, btndef in enumerate(self.custombuttons):
try:
b = wx.Button(self.cbuttons_panel, -1, btndef.label, style = wx.BU_EXACTFIT)
b.SetToolTip(wx.ToolTip(_("Execute command: ")+btndef.command))
......@@ -768,14 +757,8 @@ class PronterWindow(MainWindow, pronsole.pronsole):
if btndef is not None:
b.Bind(wx.EVT_BUTTON, self.procbutton)
b.Bind(wx.EVT_MOUSE_EVENTS, self.editbutton)
#else:
# b.Bind(wx.EVT_BUTTON, lambda e:e.Skip())
self.custombuttonbuttons.append(b)
#if i<4:
# ubs.Add(b)
#else:
cs.Add(b, pos = ((i)/4, (i)%4))
self.mainsizer.Layout()
cs.Add(b, pos = (i // 4, i % 4))
def help_button(self):
print _('Defines custom button. Usage: button <num> "title" [/c "colour"] command')
......
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