Exemple #1
0
    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()
Exemple #2
0
    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()
Exemple #3
0
    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)