diff --git a/buki.py b/buki.py index 02ef39a..a3051eb 100644 --- a/buki.py +++ b/buki.py @@ -15,6 +15,8 @@ class Object: def delete(self): if self.parent is not None: self.parent.remove(self) + else: + print(self, "has no parent") def __repr__(self): return repr(self.layout) @@ -55,9 +57,9 @@ class Container(Object): obj.parent = None self.children.remove(obj) self.layout.children.remove(obj.layout) -# if not self.children: -# print("Delete emptied container") -# self.delete() + if not self.children: + print("Delete emptied container", self) + self.delete() def delete(self): for obj in self.children: diff --git a/director.py b/director.py index c6712fc..a73cdc4 100644 --- a/director.py +++ b/director.py @@ -77,9 +77,6 @@ class Director: self.updates.remove(a.update) print("Remove plot") a.container.remove(a.plt) - if not a.container: - print("Remove emptied container") - self.plot_container.remove(a.container)