graphics/LD_Objects.py
changeset 110 29b6b70e1721
parent 96 d178cfa9e77f
child 112 317148fc1225
equal deleted inserted replaced
109:734e02ab4018 110:29b6b70e1721
   129         self.Pos.y = min(min_pos, self.Pos.y)
   129         self.Pos.y = min(min_pos, self.Pos.y)
   130         if min_pos == self.Pos.y:
   130         if min_pos == self.Pos.y:
   131             for connect in self.Connectors:
   131             for connect in self.Connectors:
   132                 connect_pos = connect.GetRelPosition()
   132                 connect_pos = connect.GetRelPosition()
   133                 connect.SetPosition(wx.Point(connect_pos.x, connect_pos.y - miny))
   133                 connect.SetPosition(wx.Point(connect_pos.x, connect_pos.y - miny))
       
   134         self.Connectors.sort(lambda x, y: x.Pos.y.__cmp__(y.Pos.y))
   134         maxy = 0
   135         maxy = 0
   135         for connect in self.Connectors:
   136         for connect in self.Connectors:
   136             connect_pos = connect.GetRelPosition()
   137             connect_pos = connect.GetRelPosition()
   137             maxy = max(maxy, connect_pos.y)
   138             maxy = max(maxy, connect_pos.y)
   138         self.Size[1] = max(maxy + self.Extensions[1], self.Size[1])
   139         self.Size[1] = max(maxy + self.Extensions[1], self.Size[1])
   281         #    self.Parent.PopupDivergenceMenu(True)
   282         #    self.Parent.PopupDivergenceMenu(True)
   282         #else:
   283         #else:
   283             # Popup the divergence menu without delete branch
   284             # Popup the divergence menu without delete branch
   284         #    self.Parent.PopupDivergenceMenu(False)
   285         #    self.Parent.PopupDivergenceMenu(False)
   285     
   286     
   286     # Refreshes the divergence state according to move defined and handle selected
   287     # Refreshes the powerrail state according to move defined and handle selected
   287     def ProcessDragging(self, movex, movey):
   288     def ProcessDragging(self, movex, movey):
   288         handle_type, handle = self.Handle
   289         handle_type, handle = self.Handle
   289         # A connector has been handled
   290         # A connector has been handled
   290         if handle_type == HANDLE_CONNECTOR:
   291         if handle_type == HANDLE_CONNECTOR:
   291             self.MoveConnector(handle, movey)
   292             self.MoveConnector(handle, movey)
   292         else:
   293             return False, True
   293             Graphic_Element.ProcessDragging(self, movex, movey)
   294         else:
       
   295             return Graphic_Element.ProcessDragging(self, movex, movey)
   294     
   296     
   295     # Refreshes the power rail model
   297     # Refreshes the power rail model
   296     def RefreshModel(self, move=True):
   298     def RefreshModel(self, move=True):
   297         self.Parent.RefreshPowerRailModel(self)
   299         self.Parent.RefreshPowerRailModel(self)
   298         # If power rail has moved and power rail is of type LEFT, refresh the model 
   300         # If power rail has moved and power rail is of type LEFT, refresh the model