1099 |
1099 |
1100 #------------------------------------------------------------------------------- |
1100 #------------------------------------------------------------------------------- |
1101 # Popup menu functions |
1101 # Popup menu functions |
1102 #------------------------------------------------------------------------------- |
1102 #------------------------------------------------------------------------------- |
1103 |
1103 |
|
1104 def GetForceVariableMenuFunction(self, iec_path): |
|
1105 iec_type = self.GetDataType(iec_path) |
|
1106 def ForceVariableFunction(event): |
|
1107 if iec_type is not None: |
|
1108 dialog = ForceVariableDialog(self.ParentWindow, iec_type) |
|
1109 if dialog.ShowModal() == wx.ID_OK: |
|
1110 self.ForceDataValue(iec_path, dialog.GetValue()) |
|
1111 return ForceVariableFunction |
|
1112 |
|
1113 def GetReleaseVariableMenuFunction(self, iec_path): |
|
1114 def ReleaseVariableFunction(event): |
|
1115 self.ReleaseDataValue(iec_path) |
|
1116 return ReleaseVariableFunction |
|
1117 |
1104 def PopupForceMenu(self): |
1118 def PopupForceMenu(self): |
1105 iec_path = self.GetElementIECPath(self.SelectedElement) |
1119 iec_path = self.GetElementIECPath(self.SelectedElement) |
1106 if iec_path is not None: |
1120 if iec_path is not None: |
1107 menu = wx.Menu(title='') |
1121 menu = wx.Menu(title='') |
1108 new_id = wx.NewId() |
1122 new_id = wx.NewId() |
1109 AppendMenu(menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text=_("Force value")) |
1123 AppendMenu(menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text=_("Force value")) |
1110 #self.Bind(wx.EVT_MENU, self.GetVariableTypeFunction(base_type), id=new_id) |
1124 self.Bind(wx.EVT_MENU, self.GetForceVariableMenuFunction(iec_path.upper()), id=new_id) |
1111 new_id = wx.NewId() |
1125 new_id = wx.NewId() |
1112 AppendMenu(menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text=_("Release value")) |
1126 AppendMenu(menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text=_("Release value")) |
1113 #self.Bind(wx.EVT_MENU, self.GetVariableTypeFunction(base_type), id=new_id) |
1127 self.Bind(wx.EVT_MENU, self.GetReleaseVariableMenuFunction(iec_path.upper()), id=new_id) |
1114 if self.SelectedElement.IsForced(): |
1128 if self.SelectedElement.IsForced(): |
1115 menu.Enable(new_id, True) |
1129 menu.Enable(new_id, True) |
1116 else: |
1130 else: |
1117 menu.Enable(new_id, False) |
1131 menu.Enable(new_id, False) |
1118 self.PopupMenu(menu) |
1132 self.PopupMenu(menu) |