Skip to content

Commit

Permalink
feat(xod-client, xod-client-browser, xod-client-electron): add hotkey…
Browse files Browse the repository at this point in the history
…s for upload popup and change one for the debugger pane
  • Loading branch information
brusherru committed Nov 23, 2020
1 parent eb76c7f commit c208cec
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/xod-client-browser/src/containers/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ class App extends client.App {
{
[client.COMMAND.NEW_PROJECT]: this.onCreateProject,
[client.COMMAND.ADD_PATCH]: this.props.actions.createPatch,
[client.COMMAND.TOGGLE_DEBUGGER]: e => {
e.preventDefault();
this.props.actions.toggleDebugger();
},
},
this.defaultHotkeyHandlers
);
Expand Down
8 changes: 7 additions & 1 deletion packages/xod-client-electron/src/view/containers/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,13 @@ class App extends client.App {
this.showError(error);
});

this.hotkeyHandlers = this.defaultHotkeyHandlers;
this.hotkeyHandlers = R.merge(
{
[client.COMMAND.UPLOAD_WITH_DEBUG]: this
.onUploadToArduinoAndDebugClicked,
},
this.defaultHotkeyHandlers
);

this.urlActions = {
// actionPathName: params => this.props.actions.someAction(params.foo, params.bar),
Expand Down
12 changes: 10 additions & 2 deletions packages/xod-client/src/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export const COMMAND = {
MAKE_TERMINAL: 'makeTerminal',
MAKE_CONSTANT: 'makeConstant',
MAKE_INTERACTIVE: 'makeInteractive',

UPLOAD: 'upload',
UPLOAD_WITH_DEBUG: 'uploadWithDebug',
};

export const HOTKEY = {
Expand All @@ -58,7 +61,7 @@ export const HOTKEY = {

[COMMAND.HIDE_HELPBOX]: 'escape',
[COMMAND.TOGGLE_HELP]: ['h'],
[COMMAND.TOGGLE_DEBUGGER]: ['ctrl+shift+u'],
[COMMAND.TOGGLE_DEBUGGER]: 'CmdOrCtrl+d',
[COMMAND.INSERT_NODE]: ['i'],

[COMMAND.MAKE_BUS]: ['b'],
Expand All @@ -68,6 +71,8 @@ export const HOTKEY = {

[COMMAND.PAN_TO_ORIGIN]: ['home'],
[COMMAND.PAN_TO_CENTER]: 'CmdOrCtrl+home',

[COMMAND.UPLOAD_WITH_DEBUG]: 'CmdOrCtrl+shift+u',
};

export const ELECTRON_ACCELERATOR = {
Expand All @@ -92,10 +97,13 @@ export const ELECTRON_ACCELERATOR = {
[COMMAND.SAVE_COPY_AS]: 'CmdOrCtrl+Shift+Alt+S',

[COMMAND.HIDE_HELPBOX]: 'Escape',
[COMMAND.TOGGLE_DEBUGGER]: 'CmdOrCtrl+Shift+U',
[COMMAND.TOGGLE_DEBUGGER]: 'CmdOrCtrl+D',

[COMMAND.PAN_TO_ORIGIN]: 'Home',
[COMMAND.PAN_TO_CENTER]: 'CmdOrCtrl+Home',

[COMMAND.UPLOAD]: 'CmdOrCtrl+u',
[COMMAND.UPLOAD_WITH_DEBUG]: 'CmdOrCtrl+shift+u',
};

export const KEYCODE = {
Expand Down
1 change: 1 addition & 0 deletions packages/xod-client/src/utils/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ const rawItems = {
},
uploadToArduino: {
label: 'Upload to Arduino...',
command: COMMAND.UPLOAD,
},
connectSerial: {
label: 'Connect Serial...',
Expand Down

0 comments on commit c208cec

Please sign in to comment.