Actor constructor takes container as argument

This commit is contained in:
2021-05-29 19:34:10 +02:00
parent aba92fd20a
commit afb79e4484
2 changed files with 3 additions and 5 deletions
+2 -2
View File
@@ -54,10 +54,10 @@ def decide_src_plt_cache_update(pvname):
class Actor:
def __init__(self, pvname, cache_size=100):
def __init__(self, container, pvname, cache_size=100):
self.container = container
self.src, plt, self.cache, self._update = decide_src_plt_cache_update(pvname)
self.plt = Frame(plt)
self.container = None
def update(self):
self._update(self.plt, self.cache)
+1 -3
View File
@@ -44,15 +44,13 @@ class Director:
for n in line:
print("Add PV:", n)
try:
a = Actor(n)
a = Actor(figs_row, n)
except Exception as e:
print("caught:", type(e), e)
else:
def make_remover(x): #TODO: fix this
return lambda: self.remove_plot(x)
a.plt.on_click_close(make_remover(a))
assert a.container is None
a.container = figs_row
self.add_plot(a)
figs_col.children.append(figs_row)
self.plot_container.children.insert(0, figs_col)