292 |
292 |
293 def GetIconName(self): |
293 def GetIconName(self): |
294 return "Ethercat" |
294 return "Ethercat" |
295 |
295 |
296 def GetContextualMenuItems(self): |
296 def GetContextualMenuItems(self): |
297 return [("Add Ethercat Slave", "Add Ethercat Slave to Master", self.OnAddEthercatSlave)] |
297 return [(_("Add Ethercat Slave"), _("Add Ethercat Slave to Master"), self.OnAddEthercatSlave)] |
298 |
298 |
299 def OnAddEthercatSlave(self, event): |
299 def OnAddEthercatSlave(self, event): |
300 app_frame = self.GetCTRoot().AppFrame |
300 app_frame = self.GetCTRoot().AppFrame |
301 dialog = BrowseValuesLibraryDialog(app_frame, |
301 dialog = BrowseValuesLibraryDialog(app_frame, |
302 "Ethercat Slave Type", |
302 _("Ethercat Slave Type"), |
303 self.GetSlaveTypesLibrary()) |
303 self.GetSlaveTypesLibrary()) |
304 if dialog.ShowModal() == wx.ID_OK: |
304 if dialog.ShowModal() == wx.ID_OK: |
305 type_infos = dialog.GetValueInfos() |
305 type_infos = dialog.GetValueInfos() |
306 device, _module_extra_params = self.GetModuleInfos(type_infos) |
306 device, _module_extra_params = self.GetModuleInfos(type_infos) |
307 if device is not None: |
307 if device is not None: |
458 dialog.Destroy() |
458 dialog.Destroy() |
459 |
459 |
460 if execute: |
460 if execute: |
461 error, returnVal = self.RemoteExec(SCAN_COMMAND, returnVal=None) |
461 error, returnVal = self.RemoteExec(SCAN_COMMAND, returnVal=None) |
462 if error != 0: |
462 if error != 0: |
463 dialog = wx.MessageDialog(app_frame, returnVal, "Error", wx.OK | wx.ICON_ERROR) |
463 dialog = wx.MessageDialog(app_frame, returnVal, _("Error"), wx.OK | wx.ICON_ERROR) |
464 dialog.ShowModal() |
464 dialog.ShowModal() |
465 dialog.Destroy() |
465 dialog.Destroy() |
466 elif returnVal is not None: |
466 elif returnVal is not None: |
467 for child in self.IECSortedChildren(): |
467 for child in self.IECSortedChildren(): |
468 self._doRemoveChild(child) |
468 self._doRemoveChild(child) |