--- a/Viewer.py Fri Dec 04 15:22:57 2009 +0100
+++ b/Viewer.py Fri Dec 04 15:25:36 2009 +0100
@@ -1101,6 +1101,22 @@
# Popup menu functions
#-------------------------------------------------------------------------------
+ def PopupForceMenu(self):
+ iec_path = self.GetElementIECPath(self.SelectedElement)
+ if iec_path is not None:
+ menu = wx.Menu(title='')
+ new_id = wx.NewId()
+ AppendMenu(menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text=_("Force value"))
+ #self.Bind(wx.EVT_MENU, self.GetVariableTypeFunction(base_type), id=new_id)
+ new_id = wx.NewId()
+ AppendMenu(menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text=_("Release value"))
+ #self.Bind(wx.EVT_MENU, self.GetVariableTypeFunction(base_type), id=new_id)
+ if self.SelectedElement.IsForced():
+ menu.Enable(new_id, True)
+ else:
+ menu.Enable(new_id, False)
+ self.PopupMenu(menu)
+
def PopupBlockMenu(self, connector = None):
if connector is not None and connector.IsCompatible("BOOL"):
type = self.Controler.GetEditedElementType(self.TagName, self.Debug)
--- a/graphics/GraphicCommons.py Fri Dec 04 15:22:57 2009 +0100
+++ b/graphics/GraphicCommons.py Fri Dec 04 15:25:36 2009 +0100
@@ -185,22 +185,30 @@
def __init__(self):
self.LastValue = None
self.Value = None
+ self.LastForced = False
+ self.Forced = False
self.Inhibited = False
def Inhibit(self, inhibit):
self.Inhibited = inhibit
if not inhibit and self.LastValue is not None:
+ self.Forced = self.LastForced
self.SetValue(self.LastValue)
self.LastValue = None
- def NewValue(self, tick, value):
+ def NewValue(self, tick, value, forced=False):
if self.Inhibited:
self.LastValue = value
+ self.LastForced = forced
else:
+ self.Forced = forced
self.SetValue(value)
def SetValue(self, value):
self.Value = value
+
+ def IsForced(self):
+ return self.Forced
#-------------------------------------------------------------------------------
# Debug Viewer Class
@@ -665,6 +673,8 @@
wx.CallAfter(self.Parent.SetCurrentCursor, 0)
self.SetSelected(True)
self.oldPos = None
+ if self.Parent.Debug:
+ self.Parent.PopupForceMenu()
# Method called when a LeftDClick event have been generated
def OnLeftDClick(self, event, dc, scaling):