def on_btMacro_clicked(self, *a): """ Convert current action into macro and send it to MacroEditor """ e = MacroEditor(self.app, self.ac_callback) action = Macro(self.generate_modifiers(self._action, self._selected_component.NAME=="custom")) e.set_input(self.id, action, mode=self._mode) self.close() e.show(self.get_transient_for())
def _choose_editor(self, action, cb): from scc.gui.ring_editor import RingEditor # Cannot be imported @ top if isinstance(action, Macro): from scc.gui.macro_editor import MacroEditor # Cannot be imported @ top e = MacroEditor(self.app, cb) e.set_title(_("Edit Macro")) elif RingEditor.is_ring_action(action): e = RingEditor(self.app, cb) else: from scc.gui.action_editor import ActionEditor # Cannot be imported @ top e = ActionEditor(self.app, cb) e.set_title(_("Edit Action")) e.hide_modeshift() 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): 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, cb): if isinstance(action, Macro): from scc.gui.macro_editor import MacroEditor # Cannot be imported @ top e = MacroEditor(self.app, cb) e.set_title(_("Edit Macro")) else: from scc.gui.action_editor import ActionEditor # Cannot be imported @ top e = ActionEditor(self.app, cb) e.set_title(_("Edit Action")) e.hide_modeshift() return e
def on_btMacro_clicked(self, *a): """ Convert current action into macro and send it to MacroEditor """ e = MacroEditor(self.app, self.ac_callback) action = Macro(self.generate_modifiers(self._action, self._selected_component.NAME=="custom")) e.set_input(self.id, action, mode=self._mode) self.close() e.show(self.get_transient_for())