def __init__(self, app, editor): AEComponent.__init__(self, app, editor) MenuActionCofC.__init__(self) BindingEditor.__init__(self, app) self._recursing = False self._userdata_load_started = False self.actions = [ NoAction() ] * 8
def set_action(self, mode, action): if self.handles(mode, action): cb = self.builder.get_object("cbActionType") if isinstance(action, TurnOffAction): self.set_cb(cb, "turnoff") elif isinstance(action, ShellCommandAction): self.set_cb(cb, "shell") enCommand = self.builder.get_object("enCommand") enCommand.set_text(action.command.encode("utf-8")) elif isinstance(action, ResetGyroAction): self.set_cb(cb, "resetgyro") elif isinstance(action, ChangeProfileAction): self._current_profile = action.profile self.set_cb(cb, "profile") elif MenuActionCofC.handles(self, None, action): self.set_cb(cb, "menu") self.load_menu_data(action) elif isinstance(action, KeyboardAction): self.set_cb(cb, "keyboard") elif isinstance(action, OSDAction): self.set_cb(cb, "osd") enOSDText = self.builder.get_object("enOSDText") enOSDText.set_text(action.text) else: self.set_cb(cb, "none")
def handles(self, mode, action): if MenuActionCofC.handles(self, mode, action): return True if isinstance(action, OSDAction) and action.action is None: return True return isinstance(action, (NoAction, TurnOffAction, ShellCommandAction, ChangeProfileAction, KeyboardAction, ResetGyroAction))
def handles(self, mode, action): if MenuActionCofC.handles(self, mode, action): return True if isinstance(action, OSDAction) and action.action is None: return True return isinstance(action, (NoAction, TurnOffAction, ShellCommandAction, ChangeProfileAction, KeyboardAction))
def set_action(self, mode, action): if self.handles(mode, action): cb = self.builder.get_object("cbActionType") if isinstance(action, TurnOffAction): self.set_cb(cb, "turnoff") elif isinstance(action, ShellCommandAction): self.set_cb(cb, "shell") enCommand = self.builder.get_object("enCommand") enCommand.set_text(action.command.encode("utf-8")) elif isinstance(action, ResetGyroAction): self.set_cb(cb, "resetgyro") elif isinstance(action, ChangeProfileAction): self._current_profile = action.profile self.set_cb(cb, "profile") elif MenuActionCofC.handles(self, None, action): self.set_cb(cb, "menu") self.load_menu_data(action) elif isinstance(action, KeyboardAction): self.set_cb(cb, "keyboard") elif isinstance(action, OSDAction): self.set_cb(cb, "osd") sclOSDTimeout = self.builder.get_object("sclOSDTimeout") enOSDText = self.builder.get_object("enOSDText") cbOSDSize = self.builder.get_object("cbOSDSize") self._recursing = True sclOSDTimeout.set_value(action.timeout or 60.1) enOSDText.set_text(action.text) self.set_cb(cbOSDSize, action.size) self._recursing = False elif isinstance(action, ClearOSDAction): self.set_cb(cb, "clearosd") else: self.set_cb(cb, "none")
def set_action(self, mode, action): cbm = self.builder.get_object("cbMenuType") cb = self.builder.get_object("cbActionType") if isinstance(action, DPadAction): self.set_cb(cbm, "menu", 1) if isinstance(action, DPad8Action): self.set_cb(cb, "dpad8", 1) else: self.set_cb(cb, "dpad", 1) self.update_button_desc(action) elif MenuActionCofC.handles(self, None, action): self.set_cb(cb, "menu", 1) self.load_menu_data(action) self.on_cbActionType_changed()
def set_action(self, mode, action): cbm = self.builder.get_object("cbMenuType") cb = self.builder.get_object("cbActionType") scl = self.builder.get_object("sclDiagonalRange") if isinstance(action, DPadAction): self.set_cb(cbm, "menu", 1) scl.set_value(action.diagonal_rage) if isinstance(action, DPad8Action): self.set_cb(cb, "dpad8", 1) else: self.set_cb(cb, "dpad", 1) self.update_button_desc(action) elif MenuActionCofC.handles(self, None, action): self.set_cb(cb, "menu", 1) self.load_menu_data(action) self.on_cbActionType_changed()
def __init__(self, app, editor): AEComponent.__init__(self, app, editor) MenuActionCofC.__init__(self) self._userdata_load_started = False self._recursing = False
def handles(self, mode, action): if MenuActionCofC.handles(self, mode, action): return True return isinstance(action, DPadAction) # DPad8Action is derived from DPadAction