Fixed bug when loading graphic pou connection between blocks and no points for drawing wire are defined
authorLaurent Bessard
Sun, 29 Sep 2013 20:39:32 +0200
changeset 1335 1b9610fc1e6b
parent 1334 b0c2c4e1c1f1
child 1336 1054cb01b523
Fixed bug when loading graphic pou connection between blocks and no points for drawing wire are defined
editors/Viewer.py
--- a/editors/Viewer.py	Sun Sep 29 20:17:05 2013 +0200
+++ b/editors/Viewer.py	Sun Sep 29 20:39:32 2013 +0200
@@ -1330,10 +1330,20 @@
                 continue
             
             points = link["points"]
-            end_connector = connected.GetConnector(wx.Point(points[-1][0], points[-1][1]), link["formalParameter"])
+            end_connector = connected.GetConnector(
+                wx.Point(points[-1][0], points[-1][1])
+                if len(points) > 0 else wx.Point(0, 0), 
+                link["formalParameter"])
             if end_connector is not None:
-                wire = Wire(self)
-                wire.SetPoints(points)
+                if len(points) > 0:
+                    wire = Wire(self)
+                    wire.SetPoints(points)
+                else:
+                    wire = Wire(self,
+                        [wx.Point(*start_connector.GetPosition()), 
+                         start_connector.GetDirection()],
+                        [wx.Point(*end_connector.GetPosition()),
+                         end_connector.GetDirection()])
                 start_connector.Connect((wire, 0), False)
                 end_connector.Connect((wire, -1), False)
                 wire.ConnectStartPoint(None, start_connector)