Fix bug when loading FBD schema with a loop in block connections
authorlaurent
Thu, 13 Sep 2012 02:15:29 +0200
changeset 832 b2609a8e4cb6
parent 831 dec885ba1f2b
child 833 3f997fb22928
Fix bug when loading FBD schema with a loop in block connections
editors/Viewer.py
--- a/editors/Viewer.py	Thu Sep 13 02:13:40 2012 +0200
+++ b/editors/Viewer.py	Thu Sep 13 02:15:29 2012 +0200
@@ -1236,9 +1236,17 @@
         else:
             self.AddBlock(element)
             connectors = element.GetConnectors()
+        element.SetPosition(instance["x"], instance["y"])
         if isinstance(element, SFC_Divergence):
-            element.SetPosition(instance["x"], instance["y"])
             element.SetSize(instance["width"], instance["height"])
+        for i, output_connector in enumerate(instance["outputs"]):
+            if i < len(connectors["outputs"]):
+                connector = connectors["outputs"][i]
+                if output_connector.get("negated", False):
+                    connector.SetNegated(True)
+                if output_connector.get("edge", "none") != "none":
+                    connector.SetEdge(output_connector["edge"])
+                connector.SetPosition(wx.Point(*output_connector["position"]))
         for i, input_connector in enumerate(instance["inputs"]):
             if i < len(connectors["inputs"]):
                 connector = connectors["inputs"][i]
@@ -1248,16 +1256,7 @@
                 if input_connector.get("edge", "none") != "none":
                     connector.SetEdge(input_connector["edge"])
                 self.CreateWires(connector, instance["id"], input_connector["links"], ids, selection)
-        for i, output_connector in enumerate(instance["outputs"]):
-            if i < len(connectors["outputs"]):
-                connector = connectors["outputs"][i]
-                if output_connector.get("negated", False):
-                    connector.SetNegated(True)
-                if output_connector.get("edge", "none") != "none":
-                    connector.SetEdge(output_connector["edge"])
-                connector.SetPosition(wx.Point(*output_connector["position"]))
         if not isinstance(element, SFC_Divergence):
-            element.SetPosition(instance["x"], instance["y"])
             element.SetSize(instance["width"], instance["height"])
         if selection is not None and selection[0].get(instance["id"], False):
             self.SelectInGroup(element)