graphics/FBD_Objects.py
changeset 379 e4c26ee9c998
parent 289 151e73a02caf
child 383 25ffba02b6a8
--- a/graphics/FBD_Objects.py	Fri Jul 10 11:41:07 2009 +0200
+++ b/graphics/FBD_Objects.py	Thu Jul 23 17:50:26 2009 +0200
@@ -240,14 +240,8 @@
                         inputs.append(("IN%d"%start, inputs[-1][1], inputs[-1][2]))
             else:
                 self.Colour = wx.RED
-                if "inputs" in connectors:
-                    inputs = connectors["inputs"]
-                else:
-                    inputs = []
-                if "outputs" in connectors:
-                    outputs = connectors["outputs"]
-                else:
-                    outputs = []
+                inputs = connectors.get("inputs", [])
+                outputs = connectors.get("outputs", [])
             if self.ExecutionControl:
                 inputs.insert(0, ("EN","BOOL","none"))
                 outputs.insert(0, ("ENO","BOOL","none"))
@@ -421,9 +415,9 @@
             # Draw block execution order
             dc.DrawText(str(self.ExecutionOrder), self.Pos.x + self.Size[0] - executionorder_size[0],
                     self.Pos.y + self.Size[1] + 2)
-        if "name" in self.Errors:
+        if self.Errors.has_key("name"):
             HighlightErrorZone(dc, name_pos[0], name_pos[1], name_size[0], name_size[1])
-        if "type" in self.Errors:
+        if self.Errors.has_key("type"):
             HighlightErrorZone(dc, type_pos[0], type_pos[1], type_size[0], type_size[1])    
         dc.SetTextForeground(wx.BLACK)
         
@@ -856,7 +850,7 @@
         else:
             name_size = self.NameSize
         
-        # Draw a rectangle with the connection size with arrows in 
+        # Draw a rectangle with the connection size with arrows inside
         dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
         arrowsize = min(self.Size[1] / 2, (self.Size[0] - name_size[0] - 10) / 2)
         dc.DrawLine(self.Pos.x, self.Pos.y, self.Pos.x + arrowsize,