moved cfg on_click/on_change code to respective dialogs

This commit is contained in:
2021-06-15 18:48:09 +02:00
parent 21a189ea8a
commit a0d6afd9e6
4 changed files with 30 additions and 25 deletions

View File

@ -1,6 +1,5 @@
from .frame import Frame
from .logic import decide_src_plt_cfg
from .utils import bind
from .cfgdlgs import ConfigDialog1D, ConfigDialog2D #TODO
@ -19,29 +18,7 @@ class Actor:
cfg.sp_cache_size.value = cache.size
bind(cfg.sp_cache_size, self.do_update_cache_size)
if isinstance(cfg, ConfigDialog1D): #TODO
cfg.cb_curves_latest.active = plt.line_latest.visible
cfg.cb_curves_average.active = plt.line_average.visible
cfg.cb_error_bands.active = plt.errband_latest.visible
cfg.cb_error_bars.active = plt.errbars_latest.visible
cfg.cb_curves_latest.on_click(plt.show_curve_latest)
cfg.cb_curves_average.on_click(plt.show_curve_average)
cfg.cb_error_bands.on_click(plt.show_error_bands)
cfg.cb_error_bars.on_click(plt.show_error_bars)
if isinstance(cfg, ConfigDialog2D): #TODO
cfg.sel_cmap_palette.value = plt.cmap_palette
cfg.cb_cmap_reverse.active = plt.cmap_reverse
cfg.sp_binning.value = plt.binning
bind(cfg.sel_cmap_palette, plt.change_cmap_palette)
cfg.cb_cmap_reverse.on_click(plt.change_cmap_reverse)
bind(cfg.sp_vmin, plt.change_vmin)
bind(cfg.sp_vmax, plt.change_vmax)
bind(cfg.sp_binning, plt.change_binning)
cfg.connect(plt)
def delete(self):

View File

@ -9,6 +9,9 @@ class ConfigDialog0D(Column):
self.sp_cache_size = sp_cache_size = Spinner(title="Cache size:")
super().__init__(sp_cache_size)
def connect(self, plt):
pass
#TODO:

View File

@ -1,7 +1,7 @@
from bokeh.models import Div, Spinner
from ..buki import Column, Row
from ..utils import adjust_margin
from ..utils import adjust_margin, bind
from ..widgets import Checkbox
@ -22,6 +22,17 @@ class ConfigDialog1D(Column):
make_entry("Errors", cb_error_bars, cb_error_bands)
)
def connect(self, plt):
self.cb_curves_latest.active = plt.line_latest.visible
self.cb_curves_average.active = plt.line_average.visible
self.cb_error_bands.active = plt.errband_latest.visible
self.cb_error_bars.active = plt.errbars_latest.visible
self.cb_curves_latest.on_click(plt.show_curve_latest)
self.cb_curves_average.on_click(plt.show_curve_average)
self.cb_error_bands.on_click(plt.show_error_bands)
self.cb_error_bars.on_click(plt.show_error_bars)
def make_entry(title, *args):

View File

@ -2,6 +2,7 @@ from bokeh.models import Select, Spinner
from ..buki import Column, Row
from ..colormaps import cmaps
from ..utils import bind
from ..widgets import Checkbox
@ -23,6 +24,19 @@ class ConfigDialog2D(Column):
sp_binning
)
def connect(self, plt):
self.sel_cmap_palette.value = plt.cmap_palette
self.cb_cmap_reverse.active = plt.cmap_reverse
self.sp_binning.value = plt.binning
bind(self.sel_cmap_palette, plt.change_cmap_palette)
self.cb_cmap_reverse.on_click(plt.change_cmap_reverse)
bind(self.sp_vmin, plt.change_vmin)
bind(self.sp_vmax, plt.change_vmax)
bind(self.sp_binning, plt.change_binning)
#TODO: