From 4cb272d26862b809d182aff9819e72ab26181150 Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Fri, 28 May 2021 14:36:57 +0200 Subject: [PATCH] separate root layout and plot-container layout --- director.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/director.py b/director.py index 85e0a4e..685c5b8 100644 --- a/director.py +++ b/director.py @@ -16,7 +16,8 @@ class Director: self.ti_add_pv = ti_add_pv = TextInput(value="", title="Add PV:") ti_add_pv.on_change("value", self.on_add_pv) - self.layout = layout = column(ti_add_pv) + self.plot_container = plot_container = column() + layout = column(ti_add_pv, plot_container) doc.add_root(layout) @@ -60,8 +61,8 @@ class Director: def add_plot(self, a): print("Add plot:", a) fig = a.plt.fig -# self.layout.children.append(fig) - self.layout.children.insert(1, fig) # 1 to skip TextInput +# self.plot_container.children.append(fig) + self.plot_container.children.insert(0, fig) assert a.cb is None #TODO a.cb = self.doc.add_periodic_callback(a.update, 1000) @@ -69,7 +70,7 @@ class Director: def remove_plot(self, a): print("Remove plot:", a) fig = a.plt.fig - self.layout.children.remove(fig) + self.plot_container.children.remove(fig) assert a.cb is not None #TODO self.doc.remove_periodic_callback(a.cb)