use empty-container deletion of Container class
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user