Try to fix up breakGroup.

With the new CursesReporter, I'm able to observe groups getting built
and broken; and I observed that sometimes a Bond (between a Letter and
a Group) would apparently survive the Group's breaking.
Reorder the operations in `breakGroup` so that the higher-level ones
("detach this Group from its external bonds") come strictly before
the lower-level ones ("ungroup this Group's members and remove this
Group from the Workspace, thus destroying it").

However, the "buggy" behavior I observed turned out to be due to a bug
in my display code and not due to anything wrong with `breakGroup`.
I suspect this patch is actually purely cosmetic.
This commit is contained in:
Arthur O'Dwyer
2017-05-02 13:00:51 -07:00
parent 730239f464
commit ef4a9c56c5

View File

@ -140,25 +140,26 @@ class Group(WorkspaceObject):
def breakGroup(self):
workspace = self.ctx.workspace
if self.correspondence:
self.correspondence.breakCorrespondence()
if self.group:
self.group.breakGroup()
if self.leftBond:
self.leftBond.breakBond()
if self.rightBond:
self.rightBond.breakBond()
while len(self.descriptions):
description = self.descriptions[-1]
description.breakDescription()
for objekt in self.objectList:
objekt.group = None
if self.group:
self.group.breakGroup()
for o in self.objectList:
o.group = None
if self in workspace.structures:
workspace.structures.remove(self)
if self in workspace.objects:
workspace.objects.remove(self)
if self in self.string.objects:
self.string.objects.remove(self)
if self.correspondence:
self.correspondence.breakCorrespondence()
if self.leftBond:
self.leftBond.breakBond()
if self.rightBond:
self.rightBond.breakBond()
def updateInternalStrength(self):
slipnet = self.ctx.slipnet