equal
deleted
inserted
replaced
247 if height > 0: |
247 if height > 0: |
248 for connector in self.Connectors: |
248 for connector in self.Connectors: |
249 position = connector.GetRelPosition() |
249 position = connector.GetRelPosition() |
250 self.RealConnectors.append(max(0., min(float(position.y - self.Extensions[0]) / float(height), 1.))) |
250 self.RealConnectors.append(max(0., min(float(position.y - self.Extensions[0]) / float(height), 1.))) |
251 elif len(self.Connectors) > 1: |
251 elif len(self.Connectors) > 1: |
252 self.RealConnectors = map(lambda x : x * 1 / (len(self.Connectors) - 1), xrange(len(self.Connectors))) |
252 self.RealConnectors = map(lambda x: x * 1 / (len(self.Connectors) - 1), xrange(len(self.Connectors))) |
253 else: |
253 else: |
254 self.RealConnectors = [0.5] |
254 self.RealConnectors = [0.5] |
255 Graphic_Element.OnLeftDown(self, event, dc, scaling) |
255 Graphic_Element.OnLeftDown(self, event, dc, scaling) |
256 |
256 |
257 # Method called when a LeftUp event have been generated |
257 # Method called when a LeftUp event have been generated |
426 contact.Input = self.Input.Clone(contact) |
426 contact.Input = self.Input.Clone(contact) |
427 contact.Output = self.Output.Clone(contact) |
427 contact.Output = self.Output.Clone(contact) |
428 return contact |
428 return contact |
429 |
429 |
430 def GetConnectorTranslation(self, element): |
430 def GetConnectorTranslation(self, element): |
431 return {self.Input : element.Input, self.Output : element.Output} |
431 return {self.Input: element.Input, self.Output: element.Output} |
432 |
432 |
433 # Returns the RedrawRect |
433 # Returns the RedrawRect |
434 def GetRedrawRect(self, movex = 0, movey = 0): |
434 def GetRedrawRect(self, movex = 0, movey = 0): |
435 rect = Graphic_Element.GetRedrawRect(self, movex, movey) |
435 rect = Graphic_Element.GetRedrawRect(self, movex, movey) |
436 rect = rect.Union(self.Input.GetRedrawRect(movex, movey)) |
436 rect = rect.Union(self.Input.GetRedrawRect(movex, movey)) |
741 coil.Input = self.Input.Clone(coil) |
741 coil.Input = self.Input.Clone(coil) |
742 coil.Output = self.Output.Clone(coil) |
742 coil.Output = self.Output.Clone(coil) |
743 return coil |
743 return coil |
744 |
744 |
745 def GetConnectorTranslation(self, element): |
745 def GetConnectorTranslation(self, element): |
746 return {self.Input : element.Input, self.Output : element.Output} |
746 return {self.Input: element.Input, self.Output: element.Output} |
747 |
747 |
748 # Returns the RedrawRect |
748 # Returns the RedrawRect |
749 def GetRedrawRect(self, movex = 0, movey = 0): |
749 def GetRedrawRect(self, movex = 0, movey = 0): |
750 rect = Graphic_Element.GetRedrawRect(self, movex, movey) |
750 rect = Graphic_Element.GetRedrawRect(self, movex, movey) |
751 rect = rect.Union(self.Input.GetRedrawRect(movex, movey)) |
751 rect = rect.Union(self.Input.GetRedrawRect(movex, movey)) |