def on_buttonaction_type_change(self, cb, data): if cb.get_active() == 0: data[0] = ButtonAction(data[0].button) elif cb.get_active() == 1: data[0] = PressAction(data[0].button) else: data[0] = ReleaseAction(data[0].button) self.update_action_field()
def on_buttonaction_type_change(self, cb, i, action_data): if cb.get_active() == 0: self.actions[i] = action_data._replace( action=ButtonAction(action_data.action)) elif cb.get_active() == 1: self.actions[i] = action_data._replace( action=PressAction(action_data.action)) else: self.actions[i] = action_data._replace( action=ReleaseAction(action_data.action)) self.update_action_field()
def apply_keys(self, *a): """ Common part of on_*key_grabbed """ cbToggle = self.builder.get_object("cbToggle") keys = list(sorted(self.keys, key=ButtonsComponent.modifiers_first)) action = ButtonAction(keys[0]) if len(keys) > 1: actions = [ButtonAction(k) for k in keys] action = MultiAction(*actions) if cbToggle.get_active(): action = Cycle(PressAction(action), ReleaseAction(action)) self.editor.set_action(action)