def onKeyPress(self, event: wx._core.PyEvent) -> None: """Performed when pressing keys. @param event: event binder object that handles keystrokes @type event: wx._core.PyEvent """ key: int = event.GetKeyCode() - ord('1') event.Skip() if key in range(min(len(services), 12)): config.conf[addonName]['active'] = key self.Close()
def onKeyPress(self, event: wx._core.PyEvent) -> None: """Performed when pressing keys. @param event: event binder object that handles keystrokes @type event: wx._core.PyEvent """ key: int = event.GetKeyCode() if event.CmdDown(): { ord('A'): self.textCtrl.SelectAll, ord('R'): self.textCtrl.Clear, ord('E'): self.clearText, ord('U'): self.updateText }.get(key, lambda: None)() event.Skip()
def onOkButton(self, event: wx._core.PyEvent) -> None: """Sending edited text to a remote service. @param event: event binder object that handles the activation of the button @type event: wx._core.PyEvent """ event.Skip() self.text = self.textCtrl.GetValue()
def onGesturesCheckbox(self, event: wx._core.PyEvent) -> None: """Enabling or disabling default keyboard shortcuts. @param event: event binder object which processes changing of the wx.Checkbox @type event: wx._core.PyEvent """ config.conf[addonName]['gestures'] = event.IsChecked() AddonsReloadDialog(self).ShowModal()
def onSelectService(self, event: wx._core.PyEvent) -> None: """Activation of the selected online service. @param event: event binder object that handles the activation of the button or ListItem element @type event: wx._core.PyEvent """ event.Skip() config.conf[addonName]['active'] = self.servicesList.GetFocusedItem() self.Close()
def onOkButton(self, event: wx._core.PyEvent) -> None: """Executed when the <OK> button in the dialog box is pressed. @param event: event that occurs when a wx.Button is pressed @type event: wx._core.PyEvent """ slot = int(self.slotChoice.GetStringSelection()) event.Skip() ChangeProfileDialog(self, slot).ShowModal() self.Destroy()
def onSwitchSynth(self, event: wx._core.PyEvent) -> None: """Executed when enable or disable the check box for switching voice synthesizers to selected languages. @param event: event binder object that specifies the check or uncheck the wx.CheckBox @type event: wx._core.PyEvent """ event.Skip() self._sizer.Show(self._blankSizer, show=not self._switchSynthChk.GetValue()) self._sizer.Show(self._synthPanel, show=self._switchSynthChk.GetValue()) self._sizer.Fit(self) self._sizer.Layout()
def onSelectService(self, event: wx._core.PyEvent) -> None: """Executed when switching between services. @param event: event binder object that specifies the selection of an item in the wx.Choice object @type event: wx._core.PyEvent """ serv = self._servChoice.GetClientData(self._servChoice.GetSelection()) self._active = serv.id event.Skip() self._panel.Destroy() self._panel = ServicePanel(self._active, parent=self._container) self._sizer.Fit(self)
def onActivateProfile(self, event: wx._core.PyEvent) -> None: """Activation of the selected voice synthesizer profile. The profile slot number is passed to the external handler. @param event: event binder object that handles the activation of the button or ListItem element @type event: wx._core.PyEvent """ event.Skip() item = int(self.synthsList.GetItem(itemIdx=self.synthsList.GetFocusedItem(), col=0).GetText()) profiles.rememberCurrent() profiles[item].set() self.EndModal(item)
def onAdvancedCheckbox(self, event: wx._core.PyEvent) -> None: """Enabling or disabling advanced add-on features. Ability to adjust volume level of all detected audio devices (experimental function). @param event: event binder object which processes changing of the wx.Checkbox @type event: wx._core.PyEvent """ config.conf[addonName]['advanced'] = event.IsChecked() devices.initialize(cfg.devices) self.hideDevices.Clear() self.devs = dict(cfg.devices) self.devs.update({devices[i].id: devices[i].name for i in range(len(devices))}) for id,name in self.devs.items(): self.hideDevices.Append(name, id) if len(self.devs)>0: self.hideDevices.SetCheckedStrings([self.devs[id] for id in cfg.devices]) self.hideDevices.SetSelection(0) self.hideDevices.Show(show=event.IsChecked()) self.sizer.Show(self.devButtons, show=event.IsChecked()) self.sizer.Fit(self) self.hideDevices.GetParent().Layout()
def onKeyPress(self, event: wx._core.PyEvent) -> None: """Performed when pressing keys. @param event: event binder object that handles keystrokes @type event: wx._core.PyEvent """ key: int = event.GetKeyCode() { wx.WXK_F2: self.saveProfiles, wx.WXK_F4: self.changeProfile, wx.WXK_F5: self.refreshProfiles, wx.WXK_F7: self.createProfile, wx.WXK_F8: self.deleteProfile, wx.WXK_DELETE: self.deleteProfile }.get(key, event.Skip)() # Activate the profile at the specified slot number key = key - ord('1') + 1 slots = [slot for slot, profile in profiles] if key in slots: item = slots.index(key) self.synthsList.Focus(item) self.onActivateProfile(event=event)