Viewer.py
changeset 388 7ea1f5094df3
parent 384 ed27a676d5c9
child 391 07447ee3538e
--- a/Viewer.py	Fri Jul 24 11:45:41 2009 +0200
+++ b/Viewer.py	Fri Jul 24 11:55:46 2009 +0200
@@ -640,6 +640,14 @@
             comments.sort(lambda x, y: cmp(x.GetId(), y.GetId()))
         return blocks + wires + comments
 
+    def GetConnectorByName(self, name):
+        for block in self.Blocks.itervalues():
+            if isinstance(block, FBD_Connector) and\
+               block.GetType() == CONNECTOR and\
+               block.GetName() == name:
+                return block
+        return None
+    
     def RefreshVisibleElements(self, xp = None, yp = None):
         x, y = self.CalcUnscrolledPosition(0, 0)
         if xp is not None:
@@ -672,6 +680,12 @@
                         iec_path = "%s.%s%d_%s"%(self.InstancePath, block.GetType(), block.GetId(), connectorname)
             elif isinstance(block, FBD_Variable):
                 iec_path = "%s.%s"%(self.InstancePath, block.GetName())
+            elif isinstance(block, FBD_Connector):
+                connection = self.GetConnectorByName(block.GetName())
+                if connection is not None:
+                    connector = connection.GetConnector()
+                    if len(connector.Wires) == 1:
+                        iec_path = self.GetElementIECPath(connector.Wires[0][0])
         elif isinstance(element, LD_Contact):
             iec_path = "%s.%s"%(self.InstancePath, element.GetName())
         elif isinstance(element, SFC_Step):