graphics/LD_Objects.py
changeset 1258 441f31474b50
parent 1176 f4b434672204
child 1356 2d4cc768a1bc
equal deleted inserted replaced
1257:4b7ef7ea318f 1258:441f31474b50
   118     def RefreshSize(self):
   118     def RefreshSize(self):
   119         self.Size = wx.Size(LD_POWERRAIL_WIDTH, max(LD_LINE_SIZE * len(self.Connectors), self.Size[1]))
   119         self.Size = wx.Size(LD_POWERRAIL_WIDTH, max(LD_LINE_SIZE * len(self.Connectors), self.Size[1]))
   120         self.RefreshBoundingBox()
   120         self.RefreshBoundingBox()
   121     
   121     
   122     # Returns the block minimum size
   122     # Returns the block minimum size
   123     def GetMinSize(self):
   123     def GetMinSize(self, default=False):
   124         return LD_POWERRAIL_WIDTH, self.Extensions[0] + self.Extensions[1]
   124         height = (LD_LINE_SIZE * (len(self.Connectors) - 1)
       
   125                   if default else 0)
       
   126         return LD_POWERRAIL_WIDTH, height + self.Extensions[0] + self.Extensions[1]
   125     
   127     
   126     # Add a connector or a blank to this power rail at the last place
   128     # Add a connector or a blank to this power rail at the last place
   127     def AddConnector(self):
   129     def AddConnector(self):
   128         self.InsertConnector(len(self.Connectors))
   130         self.InsertConnector(len(self.Connectors))
   129     
   131     
   277         self.Parent.EditPowerRailContent(self)
   279         self.Parent.EditPowerRailContent(self)
   278     
   280     
   279     # Method called when a RightUp event have been generated
   281     # Method called when a RightUp event have been generated
   280     def OnRightUp(self, event, dc, scaling):
   282     def OnRightUp(self, event, dc, scaling):
   281         handle_type, handle = self.Handle
   283         handle_type, handle = self.Handle
   282         if handle_type == HANDLE_CONNECTOR:
   284         if handle_type == HANDLE_CONNECTOR and self.Dragging and self.oldPos:
   283             wires = handle.GetWires()
   285             wires = handle.GetWires()
   284             if len(wires) == 1:
   286             if len(wires) == 1:
   285                 if handle == wires[0][0].StartConnected:
   287                 if handle == wires[0][0].StartConnected:
   286                     block = wires[0][0].EndConnected.GetParentBlock()
   288                     block = wires[0][0].EndConnected.GetParentBlock()
   287                 else:
   289                 else: