--- a/graphics/LD_Objects.py Fri Oct 19 17:08:46 2007 +0200
+++ b/graphics/LD_Objects.py Wed Oct 24 15:59:46 2007 +0200
@@ -53,6 +53,20 @@
def __del__(self):
self.Connectors = []
+ # Make a clone of this LD_PowerRail
+ def Clone(self, id = None, pos = None):
+ powerrail = LD_PowerRail(self.Parent, self.Type, id)
+ powerrail.SetSize(self.Size[0], self.Size[1])
+ if pos is not None:
+ powerrail.SetPosition(pos.x, pos.y)
+ powerrail.Connectors = []
+ for connector in self.Connectors:
+ if connector is not None:
+ powerrail.Connectors.append(connector.Clone(powerrail))
+ else:
+ powerrail.Connectors.append(None)
+ return powerrail
+
# Forbids to change the power rail size
def SetSize(self, width, height):
if self.Parent.GetDrawingMode() == FREEDRAWING_MODE:
@@ -345,6 +359,16 @@
self.Input = None
self.Output = None
+ # Make a clone of this LD_Contact
+ def Clone(self, id = None, pos = None):
+ contact = LD_Contact(self.Parent, self.Type, self.Name, id)
+ contact.SetSize(self.Size[0], self.Size[1])
+ if pos is not None:
+ contact.SetPosition(pos.x, pos.y)
+ contact.Input = self.Input.Clone(contact)
+ contact.Output = self.Output.Clone(contact)
+ return contact
+
# Forbids to change the contact size
def SetSize(self, width, height):
if self.Parent.GetDrawingMode() == FREEDRAWING_MODE:
@@ -534,6 +558,16 @@
self.Input = None
self.Output = None
+ # Make a clone of this LD_Coil
+ def Clone(self, id = None, pos = None):
+ coil = LD_Coil(self.Parent, self.Type, self.Name, id)
+ coil.SetSize(self.Size[0], self.Size[1])
+ if pos is not None:
+ coil.SetPosition(pos.x, pos.y)
+ coil.Input = self.Input.Clone(coil)
+ coil.Output = self.Output.Clone(coil)
+ return coil
+
# Forbids to change the contact size
def SetSize(self, width, height):
if self.Parent.GetDrawingMode() == FREEDRAWING_MODE: