fix issue that in Debug mode LD instance doesn't show correctly its state after
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Wed, 14 Dec 2016 12:44:30 +0300
changeset 1605 0b6b60241230
parent 1604 7f98c091be56
child 1606 99a02c6161b6
fix issue that in Debug mode LD instance doesn't show correctly its state after
continuation of FBD_Connector.

Previously state signals doesn't propogate through FBD_Connector.
editors/Viewer.py
graphics/FBD_Objects.py
--- a/editors/Viewer.py	Wed Dec 14 12:36:04 2016 +0300
+++ b/editors/Viewer.py	Wed Dec 14 12:44:30 2016 +0300
@@ -887,6 +887,15 @@
             comments.sort(lambda x, y: cmp(x.GetId(), y.GetId()))
         return blocks + wires + comments
 
+    def GetContinuationByName(self, name):
+        blocks = []
+        for block in self.Blocks.itervalues():
+            if isinstance(block, FBD_Connector) and\
+               block.GetType() == CONTINUATION and\
+               block.GetName() == name:
+                blocks.append(block)
+        return blocks
+    
     def GetConnectorByName(self, name):
         for block in self.Blocks.itervalues():
             if isinstance(block, FBD_Connector) and\
--- a/graphics/FBD_Objects.py	Wed Dec 14 12:36:04 2016 +0300
+++ b/graphics/FBD_Objects.py	Wed Dec 14 12:44:30 2016 +0300
@@ -902,7 +902,15 @@
         else:
             connectors["outputs"].append(self.Connector)
         return connectors
-    
+
+    def SpreadCurrent(self):
+        if self.Type == CONNECTOR:
+            continuations = self.Parent.GetContinuationByName(self.Name)
+            if continuations is not None:
+                value = self.Connector.ReceivingCurrent()
+                for cont in continuations:
+                    cont.Connector.SpreadCurrent(value)
+
     # Changes the variable type
     def SetType(self, type):
         if type != self.Type: