--- a/Viewer.py Fri Dec 04 15:28:08 2009 +0100
+++ b/Viewer.py Sun Dec 06 21:20:55 2009 +0100
@@ -1101,16 +1101,30 @@
# Popup menu functions
#-------------------------------------------------------------------------------
+ def GetForceVariableMenuFunction(self, iec_path):
+ iec_type = self.GetDataType(iec_path)
+ def ForceVariableFunction(event):
+ if iec_type is not None:
+ dialog = ForceVariableDialog(self.ParentWindow, iec_type)
+ if dialog.ShowModal() == wx.ID_OK:
+ self.ForceDataValue(iec_path, dialog.GetValue())
+ return ForceVariableFunction
+
+ def GetReleaseVariableMenuFunction(self, iec_path):
+ def ReleaseVariableFunction(event):
+ self.ReleaseDataValue(iec_path)
+ return ReleaseVariableFunction
+
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)
+ self.Bind(wx.EVT_MENU, self.GetForceVariableMenuFunction(iec_path.upper()), 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)
+ self.Bind(wx.EVT_MENU, self.GetReleaseVariableMenuFunction(iec_path.upper()), id=new_id)
if self.SelectedElement.IsForced():
menu.Enable(new_id, True)
else: