added a MINIMIZED marker, simplified non-expanding checkboxes
This commit is contained in:
@@ -3,7 +3,7 @@ import wx
|
||||
from slic.utils import nice_arange, printed_exception
|
||||
from slic.utils.reprate import get_pvname_reprate
|
||||
|
||||
from ..widgets import EXPANDING, STRETCH, TwoButtons, LabeledEntry, LabeledMathEntry, LabeledFilenameEntry, make_filled_vbox, make_filled_hbox, post_event
|
||||
from ..widgets import EXPANDING, MINIMIZED, STRETCH, TwoButtons, LabeledEntry, LabeledMathEntry, LabeledFilenameEntry, make_filled_vbox, make_filled_hbox, post_event
|
||||
from .tools import AdjustableComboBox, ETADisplay, correct_n_pulses, run
|
||||
|
||||
|
||||
@@ -34,10 +34,7 @@ class Scan2DPanel(wx.Panel):
|
||||
btn_go.Bind2(wx.EVT_BUTTON, self.on_stop)
|
||||
|
||||
# sizers:
|
||||
widgets = (cb_return,) # make sure checkbox does not stretch horizontally
|
||||
vb_cbs = make_filled_vbox(widgets, flag=wx.ALL)
|
||||
|
||||
widgets = (EXPANDING, adjbox1, EXPANDING, adjbox2, vb_cbs, le_npulses, le_nrepeat, le_fname, eta, btn_go)
|
||||
widgets = (EXPANDING, adjbox1, EXPANDING, adjbox2, MINIMIZED, cb_return, le_npulses, le_nrepeat, le_fname, eta, btn_go)
|
||||
vbox = make_filled_vbox(widgets, border=10)
|
||||
self.SetSizerAndFit(vbox)
|
||||
|
||||
@@ -133,10 +130,7 @@ class AdjustableBox(wx.StaticBoxSizer):
|
||||
widgets = (le_start, le_stop, le_step, le_nsteps)
|
||||
hb_pos = make_filled_hbox(widgets)
|
||||
|
||||
widgets = (cb_relative,) # make sure checkbox does not stretch horizontally
|
||||
vb_cbs = make_filled_vbox(widgets, flag=wx.ALL)
|
||||
|
||||
widgets = (cb_adjs, st_adj, STRETCH, hb_pos, vb_cbs)
|
||||
widgets = (cb_adjs, st_adj, STRETCH, hb_pos, MINIMIZED, cb_relative)
|
||||
make_filled_vbox(widgets, border=10, box=self)
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ from .completers import ContainsTextCompleter, FuzzyTextCompleter
|
||||
from .entries import LabeledEntry, LabeledFilenameEntry, LabeledMathEntry, LabeledTweakEntry
|
||||
from .lists import AutoWidthListCtrl, show_list, show_two_lists
|
||||
from .mods import MainPanel, NotebookDX
|
||||
from .tools import EXPANDING, STRETCH, make_filled_vbox, make_filled_hbox, copy_to_clipboard, post_event
|
||||
from .tools import EXPANDING, MINIMIZED, STRETCH, make_filled_vbox, make_filled_hbox, copy_to_clipboard, post_event
|
||||
from .twobuttons import TwoButtons
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ WX_DEFAULT_RESIZABLE_DIALOG_STYLE = wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.
|
||||
|
||||
|
||||
class EXPANDING: pass
|
||||
class MINIMIZED: pass
|
||||
class STRETCH: pass
|
||||
|
||||
|
||||
@@ -40,18 +41,25 @@ def make_filled_box(orient, widgets, proportion, flag, border, box):
|
||||
}
|
||||
|
||||
expand = False
|
||||
minimal = False
|
||||
|
||||
for i in widgets:
|
||||
if i is STRETCH:
|
||||
box.AddStretchSpacer()
|
||||
elif i is EXPANDING:
|
||||
expand = True # store for (and then apply to) next widget
|
||||
elif i is MINIMIZED:
|
||||
minimal = True # store for (and then apply to) next widget
|
||||
else:
|
||||
prop = proportion
|
||||
iprop = proportion
|
||||
iflag = flag
|
||||
if expand:
|
||||
expand = False # apply only once
|
||||
prop = OTHER_PROP[prop] # other proportion makes widget expanding
|
||||
box.Add(i, proportion=prop, flag=flag, border=border)
|
||||
iprop = OTHER_PROP[iprop] # other proportion makes widget expanding
|
||||
if minimal:
|
||||
minimal = False # apply only once
|
||||
iflag = wx.ALL #TODO: calculate actual flag without wx.EXPAND?
|
||||
box.Add(i, proportion=iprop, flag=iflag, border=border)
|
||||
|
||||
return box
|
||||
|
||||
|
||||
Reference in New Issue
Block a user