def OnConfigButton(self, evt): """Handle when the configuration button is hit.""" if self._module is not None: cfg_obj = self._module.GetConfigObject() event = ed_event.NotificationEvent(ed_event.edEVT_NOTIFY, ed_glob.ID_PREF, cfg_obj) wx.PostEvent(self.GetParent(), event)
def OnCheck(self, evt): """Notify container of changes to state of plugin""" enabled = self._enabled.GetValue() self._config.Enable(enabled) pname = self._title.GetLabel() event = ed_event.NotificationEvent(ed_event.edEVT_NOTIFY, self.GetId(), (pname, enabled), self) wx.PostEvent(self.GetParent(), event)
def OnCheckItem(self, index, flag): """Sends a custom notification event to the lists parent so that it can handle the check event if it needs to. @postcondition: checkbox is checked/unchecked and parent is notified """ evt = ed_event.NotificationEvent(ed_event.edEVT_NOTIFY, index, flag, self) wx.PostEvent(self.GetParent(), evt) listmix.CheckListCtrlMixin.OnCheckItem(self, index, flag)
def __PostEvent(self): """Post notification of selection to parent @postcondition: selected string is posted to parent """ val = self._list.GetStringSelection() evt = ed_event.NotificationEvent(ed_event.edEVT_NOTIFY, self.GetId(), val, self._list) wx.PostEvent(self.GetParent(), evt) self.ActivateParent()
def run(self): """Run the update check job""" service = UpdateService() result = service.GetCurrentVersionStr() if result.replace('.', '').isdigit(): isupdate = CalcVersionValue(result) > CalcVersionValue(ed_glob.VERSION) else: isupdate = False evt = ed_event.NotificationEvent(ed_event.edEVT_NOTIFY, self.id, (isupdate, result)) wx.PostEvent(self.parent, evt)
def OnUninstallButton(self, evt): """Uninstall the plugin""" msg = _("Are you sure you want to uninstall %s?\nThis cannot be undone.") result = wx.MessageBox(msg % self.GetPluginName(), _("Uninstall Plugin"), wx.OK|wx.CANCEL|wx.ICON_WARNING) if result == wx.OK: self.Enable(False) self._desc.SetLabel(_("This plugin will be uninstalled on next program launch.")) self._enabled.SetValue(False) pname = self._title.GetLabel() event = ed_event.NotificationEvent(ed_event.edEVT_NOTIFY, self.GetId(), (pname, False), self) wx.PostEvent(self.GetParent(), event) plist = Profile_Get('UNINSTALL_PLUGINS', default=list()) plist.append(self.GetInstallPath()) Profile_Set('UNINSTALL_PLUGINS', plist) else: return