def on_link(self, link): parser = GuiActionParser() if link.startswith("quick://"): action = parser.restart(link[8:]).parse() self.reset_active_component() self.set_action(action, from_custom=True) elif link == "grab://trigger_button": def cb(action): action = TriggerAction(254, 255, action) self.set_action(action, from_custom=True) self.force_page("trigger") b = SimpleChooser(self.app, "buttons", cb) b.set_title(_("Select Button")) b.hide_axes() b.show(self.window) elif link.startswith("page://"): def cb(): self.force_page(link[7:]) GLib.timeout_add(0.1, cb) elif link.startswith("advanced://"): exMore = self.builder.get_object("exMore") rvMore = self.builder.get_object("rvMore") ntbMore = self.builder.get_object("ntbMore") assert exMore.get_visible() exMore.set_expanded(True) rvMore.set_reveal_child(True) if "#" in link: link, name = link.split("#") self.blink_widget(name) ntbMore.set_current_page(int(link.split("/")[-1])) else: log.warning("Activated unknown link: %s", link)
def on_btAnalog_clicked(self, *a): """ 'Analog Output' handler """ b = SimpleChooser( self.app, "axis", lambda action: self.on_action_chosen("analog", action)) b.set_title(_("Select Analog Axis")) b.display_action(Action.AC_STICK, AxisAction(self.analog)) b.show(self.editor.window)
def on_btCircularAxis_clicked(self, *a): def cb(action): self.circular = action btCircularAxis = self.builder.get_object("btCircularAxis") btCircularAxis.set_label(action.describe(Action.AC_PAD)) self.editor.set_action(self.make_circular_action()) b = SimpleChooser(self.app, "axis", cb) b.set_title(_("Select Axis")) b.display_action(Action.AC_STICK, self.circular) b.show(self.editor.window)
def on_select_axis(self, source, *a): i = self.buttons.index(source) def cb(action): self.axes[i] = action.parameters[0] self.update() self.send() b = SimpleChooser(self.app, "axis", cb) b.set_title(_("Select Axis")) b.hide_mouse() b.display_action(Action.AC_STICK, AxisAction(self.axes[i])) b.show(self.editor.window)
def on_btSingleButton_clicked(self, *a): def cb(action): self.button = action btSingleButton = self.builder.get_object("btSingleButton") btSingleButton.set_label(self.button.describe(Action.AC_PAD)) self.editor.set_action(self.button) b = SimpleChooser(self.app, "buttons", cb) b.set_title(_("Select Button")) b.display_action(Action.AC_STICK, self.circular_axis) b.show(self.editor.window)
def on_btCircularAxis_clicked(self, *a): def cb(action): self.circular_axis = action btCircularAxis = self.builder.get_object("btCircularAxis") btCircularAxis.set_label(action.describe(Action.AC_PAD)) self.editor.set_action(self.make_circular_action()) b = SimpleChooser(self.app, "axis", cb) b.set_title(_("Select Axis")) b.display_action(Action.AC_STICK, self.circular_axis) b.show(self.editor.window)
def on_btCircularButton_clicked(self, button, *a): index = 0 if button == self.builder.get_object("btCircularButton0") else 1 def cb(action): self.circular_buttons[index] = action.button btCircularButton = self.builder.get_object("btCircularButton%s" % (index, )) btCircularButton.set_label(action.describe(Action.AC_PAD)) self.editor.set_action(self.make_circular_action()) b = SimpleChooser(self.app, "buttons", cb) b.set_title(_("Select Button")) b.display_action(Action.AC_STICK, self.circular_axis) b.show(self.editor.window)
def on_btCircularButton_clicked(self, button, *a): index = 0 if button == self.builder.get_object( "btCircularButton0") else 1 def cb(action): self.circular_buttons[index] = action.button btCircularButton = self.builder.get_object("btCircularButton%s" % (index, )) btCircularButton.set_label(action.describe(Action.AC_PAD)) self.editor.set_action(self.make_circular_action()) b = SimpleChooser(self.app, "buttons", cb) b.set_title(_("Select Button")) b.display_action(Action.AC_STICK, self.circular_axis) b.show(self.editor.window)
def on_lblMarkup_activate_link(self, trash, link): if link.startswith("quick://"): action = self.parser.restart(link[8:]).parse() self.editor.reset_active_component() self.editor.set_action(action, from_custom=True) elif link == "grab://trigger_button": def cb(action): action = TriggerAction(254, 255, action) self.editor.set_action(action, from_custom=True) self.editor.force_page("trigger") b = SimpleChooser(self.app, "buttons", cb) b.set_title(_("Select Button")) b.hide_axes() b.show(self.editor.window) elif link.startswith("page://"): def cb(): self.editor.force_page(link[7:]) GLib.timeout_add(0.1, cb)
def grab_action(self, button, cb): b = SimpleChooser(self.app, "buttons", cb) b.set_title(_("Select Button")) b.hide_axes() b.display_action(Action.AC_BUTTON, ButtonAction(button)) b.show(self.editor.window)
def grab_action(self, action, cb): b = SimpleChooser(self.app, "axis", cb) b.set_title(_("Select Axis")) area = action_to_area(action) b.display_action(Action.AC_STICK, area) b.show(self.editor.window)
def on_btAnalog_clicked(self, *a): """ 'Analog Output' handler """ b = SimpleChooser(self.app, "axis", lambda action: self.on_action_chosen("analog", action) ) b.set_title(_("Select Analog Axis")) b.display_action(Action.AC_STICK, AxisAction(self.analog)) b.show(self.editor.window)