remove all corresponding SFC jumps when SFC step is removed (but only in DRIVENDRAWING_MODE)
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Tue, 20 Dec 2016 13:26:54 +0300
changeset 1608 e8efeeb718ab
parent 1607 f9c672ed8f9e
child 1609 0d961dc6f58f
remove all corresponding SFC jumps when SFC step is removed (but only in DRIVENDRAWING_MODE)
editors/Viewer.py
--- a/editors/Viewer.py	Tue Dec 20 13:26:24 2016 +0300
+++ b/editors/Viewer.py	Tue Dec 20 13:26:54 2016 +0300
@@ -3263,6 +3263,17 @@
                 if element not in elements:
                     elements.append(element)
         step.Clean()
+
+        if self.GetDrawingMode() == DRIVENDRAWING_MODE:
+            name = step.GetName().upper()
+            remove_jumps = []
+            for block in self.Blocks.itervalues():
+                if isinstance(block, SFC_Jump):
+                    if name == block.GetTarget().upper():
+                        remove_jumps.append(block)
+            for jump in remove_jumps:
+                self.DeleteJump(jump)
+
         self.RemoveBlock(step)
         self.Controler.RemoveEditedElementInstance(self.TagName, step.GetId())
         for element in elements: