Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

draft: Add shortcuts in UI panel to show XML and blueprint (#929) #935

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/PanelUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,36 @@ export default function PanelUI({
code_view_xml.replaceText(xml);
}

const showXML = new Gio.SimpleAction({
name: "showXML",
parameter_type: null,
});
const showBluePrint = new Gio.SimpleAction({
name: "showBlueprint",
parameter_type: null,
});

showXML.connect("activate", () => {
onChangeLang(lang_xml);
dropdown_selected_signal.block();
dropdown_ui_lang.set_selected(ui_languages.indexOf(lang_xml));
dropdown_selected_signal.unblock();
});

showBluePrint.connect("activate", () => {
onChangeLang(lang_blueprint);

dropdown_selected_signal.block();
dropdown_ui_lang.set_selected(ui_languages.indexOf(lang_blueprint));
dropdown_selected_signal.unblock();
});

application.add_action(showXML);
application.add_action(showBluePrint);

application.set_accels_for_action("app.showXML", ["<Control><Shift>X"]);
application.set_accels_for_action("app.showBlueprint", ["<Control><Shift>B"]);

async function convertToBlueprint() {
term_console.clear();
settings.set_boolean("show-console", true);
Expand Down
1 change: 1 addition & 0 deletions src/about.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ ${getBlueprintVersion()}
"Bharat Tyagi https://github.com/BharatAtbrat",
"Jan Fooken https://git.janvhs.com",
"Vladimir Vaskov https://github.com/Rirusha",
"Devan P https://github.com/DevHyperCoder",
// Add yourself as
// "John Doe",
// or
Expand Down
10 changes: 10 additions & 0 deletions src/shortcutsWindow.blp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ ShortcutsWindow window {
accelerator: "<Control><Shift>Z";
title: _("Redo");
}

ShortcutsShortcut {
accelerator: "<Control><Shift>X";
title: _("Show XML in UI panel");
}

ShortcutsShortcut {
accelerator: "<Control><Shift>B";
title: _("Show blueprint in UI panel");
}
}

ShortcutsGroup {
Expand Down