use empty-container deletion of Container class

This commit is contained in:
2021-06-02 16:51:29 +02:00
parent 968dc07c1b
commit 445d82caa6
2 changed files with 5 additions and 6 deletions
+5 -3
View File
@@ -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:
-3
View File
@@ -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)