# HG changeset patch
# User Andrey Skvortsov <andrej.skvortzov@gmail.com>
# Date 1481708670 -10800
# Node ID 0b6b6024123064196e5496c6f647e21151074307
# Parent  7f98c091be56b6987ac6ee02b8b0ab87802dbff8
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.

diff -r 7f98c091be56 -r 0b6b60241230 editors/Viewer.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\
diff -r 7f98c091be56 -r 0b6b60241230 graphics/FBD_Objects.py
--- 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: