Skip to content

Commit aa80964

Browse files
committed
many tweaks to config panel, making Tab navigation more sensible
1 parent 84c5133 commit aa80964

File tree

1 file changed

+65
-65
lines changed

1 file changed

+65
-65
lines changed

wxmplot/plotconfigframe.py

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,12 @@ def make_range_panel(self, parent, font=None):
258258
auto_b.SetValue(self.conf.user_limits[laxes] == 4*[None])
259259
except:
260260
pass
261-
261+
262+
self.vpad_val = FloatSpin(panel, value=2.5, min_val=0, max_val=100,
263+
increment=0.5, digits=2,
264+
size=(FSPINSIZE, -1), action=self.onViewPadEvent)
265+
self.wids['viewpad'] = self.vpad_val
266+
262267
xb0, xb1 = laxes.get_xlim()
263268
yb0, yb1 = laxes.get_ylim()
264269
if user_lims[0] is not None:
@@ -318,11 +323,6 @@ def make_range_panel(self, parent, font=None):
318323
max_val=0.8, increment=0.01, digits=3,
319324
size=(FSPINSIZE, -1), action=self.onY3Offset)
320325

321-
self.vpad_val = FloatSpin(panel, value=2.5, min_val=0, max_val=100,
322-
increment=0.5, digits=2,
323-
size=(FSPINSIZE, -1), action=self.onViewPadEvent)
324-
self.wids['viewpad'] = self.vpad_val
325-
326326
if user_lims == 4*[None]:
327327
[w.Disable() for w in self.xbounds]
328328
[w.Disable() for w in self.ybounds]
@@ -505,6 +505,9 @@ def make_text_panel(self, parent, font=None):
505505
self.titl = LabeledTextCtrl(panel, self.conf.title.replace('\n', '\\n'),
506506
action = partial(self.onText, item='title'),
507507
labeltext='Title: ', size=(475, -1))
508+
self.xlab = LabeledTextCtrl(panel, self.conf.xlabel.replace('\n', '\\n'),
509+
action = partial(self.onText, item='xlabel'),
510+
labeltext='X Label: ', size=(475, -1))
508511
self.ylab = LabeledTextCtrl(panel, self.conf.ylabel.replace('\n', '\\n'),
509512
action = partial(self.onText, item='ylabel'),
510513
labeltext='Y Label: ', size=(475, -1))
@@ -517,9 +520,6 @@ def make_text_panel(self, parent, font=None):
517520
self.y4lab= LabeledTextCtrl(panel, self.conf.y4label.replace('\n', '\\n'),
518521
action = partial(self.onText, item='y4label'),
519522
labeltext='Y4 Label: ', size=(475, -1))
520-
self.xlab = LabeledTextCtrl(panel, self.conf.xlabel.replace('\n', '\\n'),
521-
action = partial(self.onText, item='xlabel'),
522-
labeltext='X Label: ', size=(475, -1))
523523

524524
self.yax_color = wx.CheckBox(panel,-1, 'Use Trace Color for Y Axes', (-1, -1), (-1, -1))
525525
self.yax_color.Bind(wx.EVT_CHECKBOX, self.onYaxes_tracecolor)
@@ -535,18 +535,18 @@ def make_text_panel(self, parent, font=None):
535535
self.y4lab.Enable(len(axes) > 3)
536536

537537
sizer.Add(self.titl.label, (0, 0), (1, 1), labstyle)
538-
sizer.Add(self.titl, (0, 1), (1, 4), labstyle)
538+
sizer.Add(self.titl, (0, 1), (1, 6), labstyle)
539539
sizer.Add(self.xlab.label, (1, 0), (1, 1), labstyle)
540-
sizer.Add(self.xlab, (1, 1), (1, 4), labstyle)
540+
sizer.Add(self.xlab, (1, 1), (1, 6), labstyle)
541541
sizer.Add(self.ylab.label, (2, 0), (1, 1), labstyle)
542-
sizer.Add(self.ylab, (2, 1), (1, 4), labstyle)
542+
sizer.Add(self.ylab, (2, 1), (1, 6), labstyle)
543543
sizer.Add(self.y2lab.label, (3, 0), (1, 1), labstyle)
544-
sizer.Add(self.y2lab, (3, 1), (1, 4), labstyle)
544+
sizer.Add(self.y2lab, (3, 1), (1, 6), labstyle)
545545
sizer.Add(self.y3lab.label, (4, 0), (1, 1), labstyle)
546-
sizer.Add(self.y3lab, (4, 1), (1, 4), labstyle)
546+
sizer.Add(self.y3lab, (4, 1), (1, 6), labstyle)
547547
sizer.Add(self.y4lab.label, (5, 0), (1, 1), labstyle)
548-
sizer.Add(self.y4lab, (5, 1), (1, 4), labstyle)
549-
sizer.Add(self.yax_color, (6, 0), (1, 4), labstyle)
548+
sizer.Add(self.y4lab, (5, 1), (1, 6), labstyle)
549+
sizer.Add(self.yax_color, (6, 0), (1, 6), labstyle)
550550

551551
irow = 7
552552

@@ -559,13 +559,12 @@ def make_text_panel(self, parent, font=None):
559559
ttl_size = FloatSpin(panel, value=self.conf.labelfont.get_size(),
560560
action=partial(self.onText, item='titlesize'),
561561
**fsopts)
562-
563-
leg_size = FloatSpin(panel, value=self.conf.legendfont.get_size(),
564-
action=partial(self.onText, item='legendsize'),
565-
**fsopts)
566562
lab_size = FloatSpin(panel, value=self.conf.labelfont.get_size(),
567563
action=partial(self.onText, item='labelsize'),
568564
**fsopts)
565+
leg_size = FloatSpin(panel, value=self.conf.legendfont.get_size(),
566+
action=partial(self.onText, item='legendsize'),
567+
**fsopts)
569568

570569
self.title_fontsize = ttl_size
571570
self.legend_fontsize = leg_size
@@ -577,19 +576,34 @@ def make_text_panel(self, parent, font=None):
577576

578577
sizer.Add(t0, (irow, 0), (1, 1), labstyle)
579578
sizer.Add(t1, (irow, 1), (1, 1), labstyle)
580-
sizer.Add(ttl_size, (irow, 2), (1, 2), labstyle)
581-
sizer.Add(t2, (irow+1, 1), (1, 1), labstyle)
582-
sizer.Add(lab_size, (irow+1, 2), (1, 2), labstyle)
583-
sizer.Add(t3, (irow+2, 1), (1, 1), labstyle)
584-
sizer.Add(leg_size, (irow+2, 2), (1, 2), labstyle)
579+
sizer.Add(ttl_size, (irow, 2), (1, 1), labstyle)
580+
sizer.Add(t2, (irow, 3), (1, 1), labstyle)
581+
sizer.Add(lab_size, (irow, 4), (1, 1), labstyle)
582+
sizer.Add(t3, (irow, 5), (1, 1), labstyle)
583+
sizer.Add(leg_size, (irow, 6), (1, 1), labstyle)
585584

586-
irow = irow + 3
585+
irow = irow + 1
587586
# Legend
588587
# bstyle = wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ST_NO_AUTORESIZE
589588
labstyle = wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL
590589

591590
# ax = self.axes[0]
591+
show_leg = wx.CheckBox(panel,-1, 'Show Legend', (-1, -1), (-1, -1))
592+
show_leg.Bind(wx.EVT_CHECKBOX,partial(self.onShowLegend, item='legend'))
593+
show_leg.SetValue(self.conf.show_legend)
594+
if show_leg not in self.show_legend_cbs:
595+
self.show_legend_cbs.append(show_leg)
596+
597+
show_lfr = wx.CheckBox(panel,-1, 'Show Legend Frame', (-1, -1), (-1, -1))
598+
show_lfr.Bind(wx.EVT_CHECKBOX,partial(self.onShowLegend,item='frame'))
599+
show_lfr.SetValue(self.conf.show_legend_frame)
600+
601+
togg_leg = wx.CheckBox(panel,-1, 'Click Legend to Show/Hide Line',
602+
(-1, -1), (-1, -1))
603+
togg_leg.Bind(wx.EVT_CHECKBOX, self.onHideWithLegend)
604+
togg_leg.SetValue(self.conf.hidewith_legend)
592605

606+
593607
leg_ttl = wx.StaticText(panel, -1, 'Legend:', size=(-1, -1), style=labstyle)
594608
loc_ttl = wx.StaticText(panel, -1, 'Location:', size=(-1, -1), style=labstyle)
595609
leg_loc = wx.Choice(panel, -1, choices=self.conf.legend_locs, size=(150, -1))
@@ -601,21 +615,6 @@ def make_text_panel(self, parent, font=None):
601615
leg_onax.Bind(wx.EVT_CHOICE,partial(self.onShowLegend, item='onaxis'))
602616
leg_onax.SetStringSelection(self.conf.legend_onaxis)
603617

604-
togg_leg = wx.CheckBox(panel,-1, 'Click Legend to Show/Hide Line',
605-
(-1, -1), (-1, -1))
606-
togg_leg.Bind(wx.EVT_CHECKBOX, self.onHideWithLegend)
607-
togg_leg.SetValue(self.conf.hidewith_legend)
608-
609-
show_leg = wx.CheckBox(panel,-1, 'Show Legend', (-1, -1), (-1, -1))
610-
show_leg.Bind(wx.EVT_CHECKBOX,partial(self.onShowLegend, item='legend'))
611-
show_leg.SetValue(self.conf.show_legend)
612-
if show_leg not in self.show_legend_cbs:
613-
self.show_legend_cbs.append(show_leg)
614-
615-
show_lfr = wx.CheckBox(panel,-1, 'Show Legend Frame', (-1, -1), (-1, -1))
616-
show_lfr.Bind(wx.EVT_CHECKBOX,partial(self.onShowLegend,item='frame'))
617-
show_lfr.SetValue(self.conf.show_legend_frame)
618-
619618
self.wids['hidewith_legend'] = togg_leg
620619
self.wids['legend_loc'] = leg_loc
621620
self.wids['legend_onaxis'] = leg_onax
@@ -631,7 +630,7 @@ def make_text_panel(self, parent, font=None):
631630

632631
lsizer = wx.BoxSizer(wx.HORIZONTAL)
633632
lsizer.AddMany((loc_ttl, leg_loc, leg_onax))
634-
sizer.Add(lsizer, (irow, 1), (1, 4), labstyle, 2)
633+
sizer.Add(lsizer, (irow, 1), (1, 5), labstyle, 2)
635634
autopack(panel, sizer)
636635
return panel
637636

@@ -674,18 +673,19 @@ def make_linetrace_panel(self, parent, font=None):
674673
show_grid.Bind(wx.EVT_CHECKBOX,self.onShowGrid)
675674
show_grid.SetValue(cnf.show_grid)
676675
self.wids['show_grid'] = show_grid
677-
678-
show_box = wx.CheckBox(panel,-1, ' Show Top/Right Axes ')
679-
show_box.Bind(wx.EVT_CHECKBOX, self.onShowBox)
680-
show_box.SetValue(cnf.axes_style == 'box')
681-
self.wids['axes_style'] = show_box
682-
676+
683677
show_leg = wx.CheckBox(panel,-1, 'Show Legend ')
684678
show_leg.Bind(wx.EVT_CHECKBOX,partial(self.onShowLegend, item='legend'))
685679
show_leg.SetValue(cnf.show_legend)
686680
if show_leg not in self.show_legend_cbs:
687681
self.show_legend_cbs.append(show_leg)
688682
self.wids['show_legend'] = show_leg
683+
684+
show_box = wx.CheckBox(panel,-1, ' Show Top/Right Axes ')
685+
show_box.Bind(wx.EVT_CHECKBOX, self.onShowBox)
686+
show_box.SetValue(cnf.axes_style == 'box')
687+
self.wids['axes_style'] = show_box
688+
689689

690690
tsizer = wx.BoxSizer(wx.HORIZONTAL)
691691
tsizer.Add(wx.StaticText(panel, -1, ' Theme: '), 0, labstyle, 3)
@@ -758,47 +758,47 @@ def make_linetrace_panel(self, parent, font=None):
758758
col = csel.ColourSelect(panel, -1, "", dcol, size=(25, 25))
759759
col.Bind(csel.EVT_COLOURSELECT, partial(self.onColor, trace=i))
760760

761+
alp = FloatSpin(panel, size=(FSPINSIZE, -1), value=dalp,
762+
min_val=0, max_val=1, increment=0.05, digits=2,
763+
action=partial(self.onAlpha, trace=i))
764+
765+
ffil = wx.CheckBox(panel, -1, '')
766+
ffil.Bind(wx.EVT_CHECKBOX, partial(self.onFill, trace=i))
767+
ffil.SetValue(dfill)
768+
769+
sty = Choice(panel, choices=cnf.styles, size=(150,-1),
770+
action=partial(self.onStyle,trace=i))
771+
sty.SetStringSelection(dsty)
772+
761773
thk = FloatSpin(panel, size=(ISPINSIZE, -1), value=dthk,
762774
min_val=0, max_val=20, increment=0.5, digits=1,
763775
action=partial(self.onThickness, trace=i))
764776
self.choice_linewidths.append(thk)
765777

766-
sty = Choice(panel, choices=cnf.styles, size=(150,-1),
767-
action=partial(self.onStyle,trace=i))
768-
sty.SetStringSelection(dsty)
778+
sym = Choice(panel, choices=cnf.symbols, size=(125,-1),
779+
action=partial(self.onSymbol,trace=i))
769780

781+
sym.SetStringSelection(dsym)
782+
770783
msz = FloatSpin(panel, size=(FSPINSIZE, -1), value=dmsz,
771784
min_val=0, max_val=30, increment=0.5, digits=1,
772785
action=partial(self.onMarkerSize, trace=i))
773786
self.choice_markersizes.append(msz)
787+
774788
zor = FloatSpin(panel, size=(ISPINSIZE, -1), value=dzord,
775789
min_val=-500, max_val=500, increment=1, digits=0,
776790
action=partial(self.onZorder, trace=i))
777791

778-
sym = Choice(panel, choices=cnf.symbols, size=(125,-1),
779-
action=partial(self.onSymbol,trace=i))
780-
781-
sym.SetStringSelection(dsym)
782792

783793
jsty = wx.Choice(panel, -1, choices=cnf.drawstyles, size=(125,-1))
784794
jsty.Bind(wx.EVT_CHOICE, partial(self.onJoinStyle, trace=i))
785795
jsty.SetStringSelection(djsty)
786796

787-
ffil = wx.CheckBox(panel, -1, '')
788-
ffil.Bind(wx.EVT_CHECKBOX, partial(self.onFill, trace=i))
789-
ffil.SetValue(dfill)
790-
791-
alp = FloatSpin(panel, size=(FSPINSIZE, -1), value=dalp,
792-
min_val=0, max_val=1, increment=0.05, digits=2,
793-
action=partial(self.onAlpha, trace=i))
794-
795-
796797
self.wids[f'trace_{i}'] = {'color': col, 'alpha': alp, 'fill': ffil,
797798
'style': sty, 'linewidth': thk,
798799
'marker': sym, 'markersize': msz,
799800
'zorder': zor, 'drawstyle': jsty}
800801

801-
802802
sizer.Add(lab.label,(irow,0),(1,1),wx.ALIGN_LEFT|wx.ALL, 4)
803803
sizer.Add(lab, (irow,1),(1,1),wx.ALIGN_LEFT|wx.ALL, 4)
804804
sizer.Add(col, (irow,2),(1,1),wx.ALIGN_LEFT|wx.ALL, 4)

0 commit comments

Comments
 (0)