--- a/editors/Viewer.py Wed Nov 20 09:38:13 2013 +0100
+++ b/editors/Viewer.py Thu Nov 21 00:33:02 2013 +0100
@@ -897,7 +897,23 @@
next_steps = self.GetNextSteps(connectors["outputs"])
iec_path = "%s.%s->%s"%(instance_path, ",".join(previous_steps), ",".join(next_steps))
+ def GetWireModifier(self, wire): + connector = wire.EndConnected + block = connector.GetParentBlock() + if isinstance(block, FBD_Connector): + connection = self.GetConnectorByName(block.GetName()) + if connection is not None: + connector = connection.GetConnector() + if len(connector.Wires) == 1: + return self.GetWireModifier(connector.Wires[0][0]) + if connector.IsNegated(): + return connector.GetEdge() #-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
@@ -1114,6 +1130,8 @@
elif self.AddDataConsumer(iec_path.upper(), wire) is None:
wire.SetValue("undefined")
+ wire.SetModifier(self.GetWireModifier(wire)) for block in self.Blocks.itervalues():
--- a/graphics/GraphicCommons.py Wed Nov 20 09:38:13 2013 +0100
+++ b/graphics/GraphicCommons.py Thu Nov 21 00:33:02 2013 +0100
@@ -1045,14 +1045,21 @@
parent_pos = self.ParentBlock.GetPosition()
x = min(parent_pos[0] + self.Pos.x, parent_pos[0] + self.Pos.x + self.Direction[0] * CONNECTOR_SIZE)
y = min(parent_pos[1] + self.Pos.y, parent_pos[1] + self.Pos.y + self.Direction[1] * CONNECTOR_SIZE)
+ has_modifier = self.Negated or self.Edge != "none" if self.Direction[0] == 0:
+ width = 10 if has_modifier else 5 + if self.Edge == "rising" and self.Direction[0] == 1: if self.Direction[1] == 0:
+ height = 10 if has_modifier else 5 + if self.Edge == "rising" and self.Direction[1] == 1: rect = wx.Rect(x - abs(movex), y - abs(movey), width + 2 * abs(movex), height + 2 * abs(movey))
if self.ValueSize is None and isinstance(self.ComputedValue, (StringType, UnicodeType)):
self.ValueSize = self.ParentBlock.Parent.GetMiniTextExtent(self.ComputedValue)
@@ -1536,6 +1543,8 @@
self.SelectedSegment = None
+ self.PreviousValue = None self.ComputedValue = None
@@ -1719,7 +1728,16 @@
def GetToolTipValue(self):
return self.GetComputedValue()
+ def SetModifier(self, modifier): + self.Modifier = modifier def SetValue(self, value):
+ if self.Modifier == "rising": + value, self.PreviousValue = value and not self.PreviousValue, value + elif self.Modifier == "falling": + value, self.PreviousValue = not value and self.PreviousValue, value + elif self.Modifier == "negated": computed_value = self.GetComputedValue()