def choose_editor(self, action, title, id=None): """ Chooses apropripate Editor instance for edited action """ if isinstance(action, SensitivityModifier): action = action.action if isinstance(action, FeedbackModifier): action = action.action if id in GYROS: e = ActionEditor(self.app, self.on_action_chosen) e.set_title(title) elif isinstance(action, (ModeModifier, DoubleclickModifier, HoldModifier)) and not is_gyro_enable(action): e = ModeshiftEditor(self.app, self.on_action_chosen) e.set_title(_("Mode Shift for %s") % (title,)) elif RingEditor.is_ring_action(action): e = RingEditor(self.app, self.on_action_chosen) e.set_title(title) elif isinstance(action, Type): # Type is subclass of Macro e = ActionEditor(self.app, self.on_action_chosen) e.set_title(title) elif isinstance(action, Macro) and not is_button_togle(action): e = MacroEditor(self.app, self.on_action_chosen) e.set_title(_("Macro for %s") % (title,)) else: e = ActionEditor(self.app, self.on_action_chosen) e.set_title(title) return e
def choose_editor(self, action, title, id=None): """ Chooses apropripate Editor instance for edited action """ if isinstance(action, SensitivityModifier): action = action.action if isinstance(action, FeedbackModifier): action = action.action if id in GYROS: e = ActionEditor(self.app, self.on_action_chosen) e.set_title(title) elif isinstance(action, (ModeModifier, DoubleclickModifier, HoldModifier)) and not is_gyro_enable(action): e = ModeshiftEditor(self.app, self.on_action_chosen) e.set_title(_("Mode Shift for %s") % (title,)) elif RingEditor.is_ring_action(action): e = RingEditor(self.app, self.on_action_chosen) e.set_title(title) elif isinstance(action, Type): # Type is subclass of Macro e = ActionEditor(self.app, self.on_action_chosen) e.set_title(title) elif isinstance(action, Macro) and not (is_button_togle(action) or is_button_repeat(action)): e = MacroEditor(self.app, self.on_action_chosen) e.set_title(_("Macro for %s") % (title,)) else: e = ActionEditor(self.app, self.on_action_chosen) e.set_title(title) return e
def handles(self, mode, action): if is_gyro_enable(action): action = action.mods[action.order[0]] if isinstance(action, GyroAction): # Takes GyroAbsAction as well return True if isinstance(action, MultiAction): for a in action.actions: if not isinstance(a, GyroAction): return False return True return False
def handles(self, mode, action): if is_gyro_enable(action): action = action.mods[action.order[0]] if isinstance(action, GyroAction): # Takes GyroAbsAction as well return True if isinstance(action, MultiAction): for a in action.actions: if not isinstance(a, GyroAction): return False return True return False
def _set_label(self, action): if is_gyro_enable(action): action = action.mods[action.order[0]] or action.default if isinstance(action, MultiAction): rv = [] for a in action.actions: d = a.describe(self.ACTION_CONTEXT) if not d in rv : rv.append(d) self.label.set_label("\n".join(rv)) return self.label.set_label(action.describe(self.ACTION_CONTEXT))
def _set_label(self, action): if is_gyro_enable(action): action = action.mods[action.order[0]] if isinstance(action, MultiAction): rv = [] for a in action.actions: d = a.describe(self.ACTION_CONTEXT) if not d in rv : rv.append(d) self.label.set_label("\n".join(rv)) return self.label.set_label(action.describe(self.ACTION_CONTEXT))
def _choose_editor(self, action, title): if isinstance(action, SensitivityModifier): action = action.action if isinstance(action, ModeModifier) and not is_gyro_enable(action): e = ModeshiftEditor(self, self.on_action_chosen) e.set_title(_("Mode Shift for %s") % (title,)) elif isinstance(action, Macro): e = MacroEditor(self, self.on_action_chosen) e.set_title(_("Macro for %s") % (title,)) else: e = ActionEditor(self, self.on_action_chosen) e.set_title(title) return e
def choose_editor(self, action, title): """ Chooses apropripate Editor instance for edited action """ if isinstance(action, SensitivityModifier): action = action.action if isinstance(action, (ModeModifier, DoubleclickModifier, HoldModifier)) and not is_gyro_enable(action): e = ModeshiftEditor(self.app, self.on_action_chosen) e.set_title(_("Mode Shift for %s") % (title,)) elif isinstance(action, Type): # Type is subclass of Macro e = ActionEditor(self.app, self.on_action_chosen) e.set_title(title) elif isinstance(action, Macro): e = MacroEditor(self.app, self.on_action_chosen) e.set_title(_("Macro for %s") % (title,)) else: e = ActionEditor(self.app, self.on_action_chosen) e.set_title(title) return e