diff --git a/director.py b/director.py index 0309e88..114817a 100644 --- a/director.py +++ b/director.py @@ -40,22 +40,27 @@ class Director: def add_pvs(self, pvnames): figs_col = column() for line in pvnames: - figs_row = row() - 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_row = self.make_pvs_row(line) figs_col.children.append(figs_row) 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): print("Add plot:", a) fig = a.plt.fig