graphics/GraphicCommons.py
changeset 2 93bc4c2cf376
parent 0 b622defdfd98
child 3 86ccc89d7b0b
--- a/graphics/GraphicCommons.py	Thu Feb 01 18:09:34 2007 +0100
+++ b/graphics/GraphicCommons.py	Wed Feb 07 18:43:32 2007 +0100
@@ -701,7 +701,7 @@
         return None
     
     # Unconnect a wire or all wires connected to the connector
-    def UnConnect(self, wire = None, unconnect = True):
+    def UnConnect(self, wire = None, unconnect = True, delete = False):
         i = 0
         found = False
         while i < len(self.Wires) and not found:
@@ -709,9 +709,9 @@
                 # If Unconnect haven't been called from a wire, disconnect the connector in the wire
                 if unconnect:
                     if self.Wires[i][1] == 0:
-                        self.Wires[i][0].UnConnectStartPoint()
+                        self.Wires[i][0].UnConnectStartPoint(delete)
                     else:
-                        self.Wires[i][0].UnConnectEndPoint()
+                        self.Wires[i][0].UnConnectEndPoint(delete)
                 # Remove wire from connected
                 if wire:
                     self.Wires.pop(i)
@@ -1336,9 +1336,12 @@
         self.StartConnected = connector
     
     # Unconnects wire start point
-    def UnConnectStartPoint(self):
+    def UnConnectStartPoint(self, delete = False):
         self.StartConnected.UnConnect(self, False)
-        self.StartConnected = None
+        if delete:
+            self.Delete()
+        else:
+            self.StartConnected = None
     
     # Moves the wire end point and update the wire points
     def MoveEndPoint(self, point):
@@ -1365,9 +1368,12 @@
         self.EndConnected = connector
     
     # Unconnects wire end point
-    def UnConnectEndPoint(self):
+    def UnConnectEndPoint(self, delete = False):
         self.EndConnected.UnConnect(self, False)
-        self.EndConnected = None
+        if delete:
+            self.Delete()
+        else:
+            self.EndConnected = None
     
     # Moves the wire segment given by its index
     def MoveSegment(self, idx, movex, movey):