do not replace plot with frame

This commit is contained in:
2021-06-02 20:29:02 +02:00
parent 0bf8c1dc30
commit 84a326a7bd
3 changed files with 11 additions and 9 deletions
+7 -5
View File
@@ -56,17 +56,19 @@ class Actor:
def __init__(self, pvname, cache_size=100):
self.pvname = pvname
self.src, plt, self.cache, self._update = decide_src_plt_cache_update(pvname)
self.plt = Frame(plt)
self.src, plt, cache, self._update = decide_src_plt_cache_update(pvname)
self.cache = cache
self.plt = plt
self.frm = frm = Frame(plt)
self.plt.cfg_ti_cache_size.value = str(self.cache.size)
self.plt.cfg_ti_cache_size.on_change("value", self.do_update_cache_size)
self.frm.cfg_ti_cache_size.value = str(cache.size)
self.frm.cfg_ti_cache_size.on_change("value", self.do_update_cache_size)
def do_update_cache_size(self, attr, old, new):
print(f"CB Update cache size: attribute \"{attr}\" changed from \"{old}\" to \"{new}\"")
self.cache.set_size(int(new))
self.plt.cfg_ti_cache_size.value = str(self.cache.size)
self.frm.cfg_ti_cache_size.value = str(self.cache.size)
def update(self):
+3 -3
View File
@@ -64,9 +64,9 @@ class Director:
def add_actor(self, a, container):
print("Add:", a)
print("Connect close button")
a.plt.on_click_close(lambda: self.remove_actor(a, container))
a.frm.on_click_close(lambda: self.remove_actor(a, container))
print("Add plot")
container.append(a.plt)
container.append(a.frm)
print("Add update")
self.updates.append(a.update)
@@ -76,7 +76,7 @@ class Director:
print("Remove update")
self.updates.remove(a.update)
print("Remove plot")
container.remove(a.plt)
container.remove(a.frm)
+1 -1
View File
@@ -12,7 +12,7 @@ class Frame(Column):
def __init__(self, plt):
self.plt = plt
self.set = plt.set # make frame act like contained plot
# self.set = plt.set # make frame act like contained plot
name = plt.name
inner_fig = plt.layout