Commit 5baef287 authored by cmaffeo2's avatar cmaffeo2
Browse files

Made changes that should improve handling of connections within a segment

parent dbc26c65
......@@ -111,7 +111,8 @@ class Connection():
def delete(self):
self.A.container.connections.remove(self)
self.B.container.connections.remove(self)
if self.B.container is not self.A.container:
self.B.container.connections.remove(self)
self.A.connection = None
self.B.connection = None
......@@ -188,7 +189,8 @@ class ConnectableElement():
A.connection = B.connection = connection
self.connections.append(connection)
other.connections.append(connection)
if other is not self:
other.connections.append(connection)
l = A.container.locations
if A not in l: l.append(A)
l = B.container.locations
......@@ -532,9 +534,11 @@ class Segment(ConnectableElement, Group):
def clear_all(self):
Group.clear_all(self) # TODO: use super?
self.beads = []
for c,loc,other in self.get_connections_and_locations():
loc.particle = None
other.particle = None
# for c,loc,other in self.get_connections_and_locations():
# loc.particle = None
# other.particle = None
for l in self.locations:
l.particle = None
def contour_to_nt_pos(self, contour_pos, round_nt=False):
nt = contour_pos*(self.num_nt) - 0.5
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment