From 24ff59981e848fb2053da1f48c48a4a3fa061222 Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Sun, 30 May 2021 14:59:48 +0200 Subject: [PATCH] split loop --- director.py | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) 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