# HG changeset patch # User laurent # Date 1315581575 -7200 # Node ID 08c26c62f5a7ee1591e44c3889fb90675ecc9047 # Parent 1e1b632c7a410e454feb9d912537890768d1012c Fix some bugs in driven drawing for LD viewer diff -r 1e1b632c7a41 -r 08c26c62f5a7 LDViewer.py --- a/LDViewer.py Fri Sep 09 11:58:53 2011 +0200 +++ b/LDViewer.py Fri Sep 09 17:19:35 2011 +0200 @@ -184,6 +184,7 @@ def RefreshView(self, selection=None): Viewer.RefreshView(self, selection) + wx.CallAfter(self.Refresh) for i, rung in enumerate(self.Rungs): bbox = rung.GetBoundingBox() if i < len(self.RungComments): @@ -1151,11 +1152,9 @@ else: if startpoint.y + offset != endpoint.y: if isinstance(element, LD_PowerRail): - element.MoveConnector(i, startpoint.y - endpoint.y) + element.MoveConnector(connector, startpoint.y - endpoint.y) elif isinstance(block, LD_PowerRail): - index = block.GetConnectorIndex(wire.EndConnected) - if index: - block.MoveConnector(index, startpoint.y - endpoint.y) + block.MoveConnector(wire.EndConnected, startpoint.y - endpoint.y) else: block.Move(0, startpoint.y + offset - endpoint.y) self.RefreshPosition(block, False) diff -r 1e1b632c7a41 -r 08c26c62f5a7 graphics/GraphicCommons.py --- a/graphics/GraphicCommons.py Fri Sep 09 11:58:53 2011 +0200 +++ b/graphics/GraphicCommons.py Fri Sep 09 17:19:35 2011 +0200 @@ -2883,6 +2883,12 @@ # Popup the default menu self.Parent.PopupDefaultMenu() + # Refreshes the wire state according to move defined and handle selected + def ProcessDragging(self, movex, movey, event, scaling): + if self.Parent.GetDrawingMode() != FREEDRAWING_MODE and self.Parent.CurrentLanguage == "LD": + movex = movey = 0 + return Graphic_Element.ProcessDragging(self, movex, movey, event, scaling) + # Refreshes the comment model def RefreshModel(self, move=True): self.Parent.RefreshCommentModel(self) diff -r 1e1b632c7a41 -r 08c26c62f5a7 graphics/LD_Objects.py --- a/graphics/LD_Objects.py Fri Sep 09 11:58:53 2011 +0200 +++ b/graphics/LD_Objects.py Fri Sep 09 17:19:35 2011 +0200 @@ -308,8 +308,9 @@ movey = round(float(self.Pos.y + position.y + movey) / float(scaling[1])) * scaling[1] - self.Pos.y - position.y self.MoveConnector(handle, movey) return 0, movey - else: + elif self.Parent.GetDrawingMode() == FREEDRAWING_MODE: return Graphic_Element.ProcessDragging(self, movex, movey, event, scaling) + return 0, 0 # Refreshes the power rail model def RefreshModel(self, move=True): @@ -439,6 +440,8 @@ return rect def ProcessDragging(self, movex, movey, event, scaling): + if self.Parent.GetDrawingMode() != FREEDRAWING_MODE: + movex = movey = 0 return Graphic_Element.ProcessDragging(self, movex, movey, event, scaling, height_fac = 2) # Forbids to change the contact size @@ -718,6 +721,8 @@ return rect def ProcessDragging(self, movex, movey, event, scaling): + if self.Parent.GetDrawingMode() != FREEDRAWING_MODE: + movex = movey = 0 return Graphic_Element.ProcessDragging(self, movex, movey, event, scaling, height_fac = 2) # Forbids to change the Coil size