split loop

This commit is contained in:
2021-05-30 14:59:48 +02:00
parent afb79e4484
commit 24ff59981e

View File

@ -40,22 +40,27 @@ class Director:
def add_pvs(self, pvnames): def add_pvs(self, pvnames):
figs_col = column() figs_col = column()
for line in pvnames: for line in pvnames:
figs_row = row() figs_row = self.make_pvs_row(line)
for n in line:
print("Add PV:", n)
try:
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))
self.add_plot(a)
figs_col.children.append(figs_row) figs_col.children.append(figs_row)
self.plot_container.children.insert(0, figs_col) self.plot_container.children.insert(0, figs_col)
def make_pvs_row(self, pvnames):
figs_row = row()
for n in pvnames:
print("Add PV:", n)
try:
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))
self.add_plot(a)
return figs_row
def add_plot(self, a): def add_plot(self, a):
print("Add plot:", a) print("Add plot:", a)
fig = a.plt.fig fig = a.plt.fig