--- a/PLCOpenEditor.py Tue Dec 08 16:29:16 2009 +0100
+++ b/PLCOpenEditor.py Tue Dec 08 17:10:30 2009 +0100
@@ -734,8 +734,8 @@
window = self.TabsOpened.GetPage(selected)
if not window.IsDebugging():
self.VariablePanelIndexer.ChangeVariablePanel(window.GetTagName())
- # Refresh all window elements that have changed
- self._Refresh(TITLE, TOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU)
+ # Refresh all window elements that have changed
+ wx.CallAfter(self._Refresh, TITLE, TOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU)
wx.CallAfter(self.RefreshTabCtrlEvent)
event.Skip()
@@ -907,7 +907,9 @@
window = self.TabsOpened.GetPage(new_index)
if not window.IsDebugging():
self.VariablePanelIndexer.ChangeVariablePanel(window.GetTagName())
- self._Refresh(TOOLBAR, FILEMENU, EDITMENU)
+ # Refresh all window elements that have changed
+ self._Refresh(TITLE, TOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU)
+ self.RefreshTabCtrlEvent()
def OnPageSetupMenu(self, event):
dialog = wx.PageSetupDialog(self, self.PageSetupData)
@@ -3857,6 +3859,11 @@
def GetVariable(self):
return self.Variable
+ def SetForced(self, forced):
+ if self.Forced != forced:
+ self.Forced = forced
+ self.Parent.HasNewData = True
+
def SetValue(self, value):
if self.Value != value:
self.Value = value
@@ -3972,7 +3979,7 @@
for col in range(self.GetNumberCols()):
if self.GetColLabelValue(col, False) == "Value":
if self.IsForced(row):
- grid.SetCellTextColour(row, col, wx.RED)
+ grid.SetCellTextColour(row, col, wx.BLUE)
else:
grid.SetCellTextColour(row, col, wx.BLACK)
grid.SetReadOnly(row, col, True)
--- a/graphics/GraphicCommons.py Tue Dec 08 16:29:16 2009 +0100
+++ b/graphics/GraphicCommons.py Tue Dec 08 17:10:30 2009 +0100
@@ -192,7 +192,7 @@
def Inhibit(self, inhibit):
self.Inhibited = inhibit
if not inhibit and self.LastValue is not None:
- self.Forced = self.LastForced
+ self.SetForced(self.LastForced)
self.SetValue(self.LastValue)
self.LastValue = None
@@ -201,12 +201,15 @@
self.LastValue = value
self.LastForced = forced
else:
- self.Forced = forced
+ self.SetForced(forced)
self.SetValue(value)
def SetValue(self, value):
self.Value = value
-
+
+ def SetForced(self, forced):
+ self.Forced = forced
+
def IsForced(self):
return self.Forced
@@ -1185,6 +1188,7 @@
self.OneConnected = onlyone
self.Valid = True
self.Value = None
+ self.Forced = False
self.Pen = wx.BLACK_PEN
self.Errors = {}
self.RefreshNameSize()
@@ -1270,6 +1274,11 @@
self.Name = name
self.RefreshNameSize()
+ def RefreshForced(self):
+ self.Forced = False
+ for wire, handle in self.Wires:
+ self.Forced |= wire.IsForced()
+
def RefreshValue(self):
self.Value = self.ReceivingCurrent()
@@ -1503,9 +1512,14 @@
if not self.Valid:
dc.SetPen(wx.RED_PEN)
elif isinstance(self.Value, BooleanType) and self.Value:
- dc.SetPen(wx.GREEN_PEN)
+ if self.Forced:
+ dc.SetPen(wx.CYAN_PEN)
+ else:
+ dc.SetPen(wx.GREEN_PEN)
elif self.Value == "undefined":
dc.SetPen(wx.Pen(wx.NamedColour("orange")))
+ elif self.Forced:
+ dc.SetPen(wx.Pen(wx.BLUE))
else:
dc.SetPen(self.Pen)
dc.SetBrush(wx.WHITE_BRUSH)
@@ -1758,6 +1772,16 @@
return True
return False
+ def SetForced(self, forced):
+ if self.Forced != forced:
+ self.Forced = forced
+ if self.StartConnected:
+ self.StartConnected.RefreshForced()
+ if self.EndConnected:
+ self.EndConnected.RefreshForced()
+ if self.Visible:
+ self.Parent.UpdateRefreshRect(self.GetRedrawRect())
+
def SetValue(self, value):
if self.Value != value:
self.Value = value
@@ -1812,11 +1836,11 @@
# The segment selected is the first
elif segment == 0:
if self.StartConnected:
- self.StartConnected.SetPen(wx.BLUE_PEN)
+ self.StartConnected.SetPen(wx.Pen(wx.BLUE))
if self.EndConnected:
# There is only one segment
if len(self.Segments) == 1:
- self.EndConnected.SetPen(wx.BLUE_PEN)
+ self.EndConnected.SetPen(wx.Pen(wx.BLUE))
else:
self.EndConnected.SetPen(wx.BLACK_PEN)
# The segment selected is the last
@@ -1824,7 +1848,7 @@
if self.StartConnected:
self.StartConnected.SetPen(wx.BLACK_PEN)
if self.EndConnected:
- self.EndConnected.SetPen(wx.BLUE_PEN)
+ self.EndConnected.SetPen(wx.Pen(wx.BLUE))
self.SelectedSegment = segment
self.Refresh()
@@ -2630,11 +2654,18 @@
dc.SetPen(wx.RED_PEN)
dc.SetBrush(wx.RED_BRUSH)
elif isinstance(self.Value, BooleanType) and self.Value:
- dc.SetPen(wx.GREEN_PEN)
- dc.SetBrush(wx.GREEN_BRUSH)
+ if self.Forced:
+ dc.SetPen(wx.CYAN_PEN)
+ dc.SetBrush(wx.CYAN_BRUSH)
+ else:
+ dc.SetPen(wx.GREEN_PEN)
+ dc.SetBrush(wx.GREEN_BRUSH)
elif self.Value == "undefined":
dc.SetPen(wx.Pen(wx.NamedColour("orange")))
dc.SetBrush(wx.Brush(wx.NamedColour("orange")))
+ elif self.Forced:
+ dc.SetPen(wx.Pen(wx.BLUE))
+ dc.SetBrush(wx.BLUE_BRUSH)
else:
dc.SetPen(wx.BLACK_PEN)
dc.SetBrush(wx.BLACK_BRUSH)
--- a/graphics/LD_Objects.py Tue Dec 08 16:29:16 2009 +0100
+++ b/graphics/LD_Objects.py Tue Dec 08 17:10:30 2009 +0100
@@ -410,6 +410,12 @@
self.Output.Flush()
self.Output = None
+ def SetForced(self, forced):
+ if self.Forced != forced:
+ self.Forced = forced
+ if self.Visible:
+ self.Parent.UpdateRefreshRect(self.GetRedrawRect())
+
def SetValue(self, value):
self.PreviousValue = self.Value
self.Value = value
@@ -626,14 +632,16 @@
def Draw(self, dc):
Graphic_Element.Draw(self, dc)
if self.Value is not None:
- if self.Type == CONTACT_NORMAL and self.Value:
- dc.SetPen(wx.GREEN_PEN)
- elif self.Type == CONTACT_REVERSE and not self.Value:
- dc.SetPen(wx.GREEN_PEN)
- elif self.Type == CONTACT_RISING and self.Value and not self.PreviousValue:
- dc.SetPen(wx.GREEN_PEN)
- elif self.Type == CONTACT_FALLING and self.Value and not self.PreviousValue:
- dc.SetPen(wx.GREEN_PEN)
+ if self.Type == CONTACT_NORMAL and self.Value or \
+ self.Type == CONTACT_REVERSE and not self.Value or \
+ self.Type == CONTACT_RISING and self.Value and not self.PreviousValue or \
+ self.Type == CONTACT_RISING and self.Value and not self.PreviousValue:
+ if self.Forced:
+ dc.SetPen(wx.CYAN_PEN)
+ else:
+ dc.SetPen(wx.GREEN_PEN)
+ elif self.Forced:
+ dc.SetPen(wx.Pen(wx.BLUE))
else:
dc.SetPen(wx.BLACK_PEN)
else:
@@ -915,7 +923,12 @@
def Draw(self, dc):
Graphic_Element.Draw(self, dc)
if self.Value is not None and self.Value:
- dc.SetPen(wx.Pen(wx.GREEN, 2, wx.SOLID))
+ if self.Forced:
+ dc.SetPen(wx.Pen(wx.CYAN, 2, wx.SOLID))
+ else:
+ dc.SetPen(wx.Pen(wx.GREEN, 2, wx.SOLID))
+ elif self.Forced:
+ dc.SetPen(wx.Pen(wx.BLUE, 2, wx.SOLID))
else:
dc.SetPen(wx.Pen(wx.BLACK, 2, wx.SOLID))
dc.SetBrush(wx.TRANSPARENT_BRUSH)
--- a/graphics/SFC_Objects.py Tue Dec 08 16:29:16 2009 +0100
+++ b/graphics/SFC_Objects.py Tue Dec 08 17:10:30 2009 +0100
@@ -73,6 +73,12 @@
self.Action.Flush()
self.Action = None
+ def SetForced(self, forced):
+ if self.Forced != forced:
+ self.Forced = forced
+ if self.Visible:
+ self.Parent.UpdateRefreshRect(self.GetRedrawRect())
+
def SetValue(self, value):
self.PreviousValue = self.Value
self.Value = value
@@ -520,7 +526,12 @@
def Draw(self, dc):
Graphic_Element.Draw(self, dc)
if self.Value:
- dc.SetPen(wx.GREEN_PEN)
+ if self.Forced:
+ dc.SetPen(wx.CYAN_PEN)
+ else:
+ dc.SetPen(wx.GREEN_PEN)
+ elif self.Forced:
+ dc.SetPen(wx.Pen(wx.BLUE))
else:
dc.SetPen(wx.BLACK_PEN)
dc.SetBrush(wx.WHITE_BRUSH)
@@ -587,6 +598,12 @@
self.Condition.Flush()
self.Condition = None
+ def SetForced(self, forced):
+ if self.Forced != forced:
+ self.Forced = forced
+ if self.Visible:
+ self.Parent.UpdateRefreshRect(self.GetRedrawRect())
+
def SetValue(self, value):
self.PreviousValue = self.Value
self.Value = value
@@ -935,8 +952,15 @@
def Draw(self, dc):
Graphic_Element.Draw(self, dc)
if self.Value:
- dc.SetPen(wx.GREEN_PEN)
- dc.SetBrush(wx.GREEN_BRUSH)
+ if self.Forced:
+ dc.SetPen(wx.CYAN_PEN)
+ dc.SetBrush(wx.CYAN_BRUSH)
+ else:
+ dc.SetPen(wx.GREEN_PEN)
+ dc.SetBrush(wx.GREEN_BRUSH)
+ elif self.Forced:
+ dc.SetPen(wx.Pen(wx.BLUE))
+ dc.SetBrush(wx.BLUE_BRUSH)
else:
dc.SetPen(wx.BLACK_PEN)
dc.SetBrush(wx.BLACK_BRUSH)