def trigger_command(self, key, key_type): ''' A key has been pressed. Check if it is mapped to a command, and send the command activation event if so. ''' command = State.commands().get_action(key, key_type) if command is not None: self.dispatch_event('activate_command', command)
def on_click(self, model, button, modifiers): action = State.commands().get(CommandBar.ACTIONS[self.selection_x]).action if action is not None: action(model)