graphics/FBD_Objects.py
changeset 625 b7062a7018ec
parent 566 6014ef82a98a
child 633 3536f4469cde
--- a/graphics/FBD_Objects.py	Thu Jan 12 17:04:22 2012 +0100
+++ b/graphics/FBD_Objects.py	Tue Jan 17 16:44:00 2012 +0100
@@ -41,6 +41,7 @@
     def __init__(self, parent, type, name, id = None, extension = 0, inputs = None, connectors = {}, executionControl = False, executionOrder = 0):
         Graphic_Element.__init__(self, parent)
         self.Type = None
+        self.Description = None
         self.Extension = None
         self.ExecutionControl = False
         self.Id = id
@@ -233,10 +234,13 @@
                     for i in xrange(self.Extension - len(blocktype["inputs"])):
                         start += 1
                         inputs.append(("IN%d"%start, inputs[-1][1], inputs[-1][2]))
+                comment = blocktype["comment"]
+                self.Description = _(comment) + blocktype.get("usage", "")
             else:
                 self.Colour = wx.RED
                 inputs = connectors.get("inputs", [])
                 outputs = connectors.get("outputs", [])
+                self.Description = None
             if self.ExecutionControl:
                 inputs.insert(0, ("EN","BOOL","none"))
                 outputs.insert(0, ("ENO","BOOL","none"))
@@ -368,6 +372,9 @@
             for output in self.Outputs:
                 output.RefreshWires()
     
+    def GetToolTipValue(self):
+        return self.Description
+    
     # Adds an highlight to the block
     def AddHighlight(self, infos, start, end ,highlight_type):
         if infos[0] in ["type", "name"] and start[0] == 0 and end[0] == 0: