ShortCuts

Need help, or want to share a macro? Post here!
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: ShortCuts

Postby triplus » Tue Sep 20, 2016 9:36 pm

First release of ShortCuts

Icons:
  • Support for creating workbench icons (including XPM)
  • SVG icons (none, FreeCAD icon from theme, preferences)
  • SVG icons for indicating if local, global or local/global shortcut is set
Style:
  • Style ShortCuts line edit and Preferences button
Database:
  • Store command and shortcut information in the index group
  • Add, remove and optimize index groups in the database
  • Limit the number of groups to 999 for each workbench
Dictionary:
  • Dictionary of unique actions
  • Dictionary of available local shortcuts
  • Dictionary of available global shortcuts
ShortCuts:
  • Show inside MDI area (at top left corner)
  • Hide on ESC key
  • Hide on lost focus
  • Clear text or hide ShortCuts on return key
  • Show currently available shortcuts on down key
  • Completer (case insensitive 16 commands)
  • Model data for completer
  • Resize ShortCuts on completion selection
  • Restore default size on completion
  • Preferences button
Preferences:
  • Workbench selector combo box
  • Activate workbench on selection
  • Statistical information (current number of shortcuts)
  • Table containing an alphabetically sorted list of commands and editable shortcuts
  • Tooltip information (global and local shortcuts)
  • Small adjustments focused on improving interaction
Invoke key:
  • Default invoke key W
  • Additional configurable invoke key
  • Support for CTRL, ALT, SHIFT and META modifier key
  • Detect and unset duplicate actions using key W as shortcut
Other:
  • Run as single instance
  • Use QMenu container on macOS to show ShortCuts above 3D View
  • ...
ShortCuts.png
ShortCuts.png (3.45 KiB) Viewed 1147 times
Preferences.png
Preferences.png (55.16 KiB) Viewed 1147 times
InvokeKey.png
InvokeKey.png (27.35 KiB) Viewed 1147 times
Code repository:

https://github.com/triplus/ShortCuts
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: ShortCuts

Postby triplus » Tue Sep 20, 2016 10:01 pm

Use Case

Setting and using local/global shortcut.
SketcherLine.png
SketcherLine.png (61.88 KiB) Viewed 1144 times
Creating local shortcut for Sketcher Line command.
Global Draft Clone.png
Global Draft Clone.png (53.5 KiB) Viewed 1144 times
Creating global shortcut for Draft Clone command.
DownKey.png
DownKey.png (10.75 KiB) Viewed 1144 times
Pressing invoke key W and after Down Key will produce a list of all currently available shortcuts.
CreateLine.png
CreateLine.png (8.19 KiB) Viewed 1144 times
When in Sketcher edit mode pressing on Invoke Key W and after L key offers Sketcher Line command.
Select.png
Select.png (9.12 KiB) Viewed 1144 times
Selecting Sketcher Line command and waiting for confirmation (Enter).
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: ShortCuts

Postby triplus » Tue Sep 20, 2016 10:14 pm

Use Case

Conflict resolution.
GlobalCylinder.png
GlobalCylinder.png (53.9 KiB) Viewed 1143 times
Crating global shortcut for Part Cylinder command.
PartCylinder.png
PartCylinder.png (52.8 KiB) Viewed 1143 times
Creating local (Part workbench) shortcut for Part Cylinder command. Icon changes to indicate both global and local shortcuts are set for the command.
PartWB.png
PartWB.png (9.5 KiB) Viewed 1143 times
Part workbench: Both shortcuts are provided for Part Cylinder command.
OtherWB.png
OtherWB.png (8.24 KiB) Viewed 1143 times
Other workbenches: Only global shortcut is provided for Part Cylinder command.
User avatar
pablogil
Posts: 845
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: ShortCuts

Postby pablogil » Wed Sep 21, 2016 6:54 am

Hi @triplus,

I have just tested it in macOS and it works perfectly, I can't find any glitch or bug :)
The Preferences panel is so clean and easy to use. I definitely like the statistics at the top right corner.

Anyway, I'm unsure if I'm using it properly because I don't find it comfortable to use as this first release is. I mean, I find tedious running any command using Shortcuts:
1. press invoke button
2. press the keyboard shortcut you have set
3. you see a list of commands, then you press the down arrow in the keyboard in order to select from the list
4. accept pressing Enter

I think it's quicker to just press the command on the toolbar... Of course with Shortcuts I'm able to reach any command from any workbench but, still, I don't see how it can improve my workflow as, for example, Piemenu does, which is a really fast way of running commands.

Am I using it incorrectly? if not, please excuse me, and show me how to correctly use it. Thanks


But if I´m right about the actual behavior, I would like to suggest you some modifications in order to make it really fast of using (invoking and running the command). So, I suggest the following behavior:
1. pressing a modifier key (or combination of modifier keys) invokes Shortcuts (for instance SHIFT+CTRL)
2. without releasing the modifier key(s), press your assigned command key (for instance, C for creating a new cube) and it runs the command

I have seen you allow to set a combination of keys (for instance, NC for creating a new cube), that's super cool, but with the behavior I'm suggesting it won't work, so, I would suggest adding a Preferences customizable parameter to set a "waiting time" since the first key is pressed in order to listen for key combinations (it might be set to something less than a second in order to make the process quick, so, for instance that parameter could be set to 500 miliseconds. Then, the behavior would be:
1. pressing a modifier key (or combination of modifier keys) invokes Shortcuts
2. without releasing the modifier key(s), press your assigned command keys (for instance, N and C for creating a new cube) having in mind you should press the second key, "C", in less than 500ms after you pressed "N" because then, Shortcuts will stop listening and will run the command

With this behavior, you could have and command with "C" key and other with "C" plus anything else. Shortcuts will decide which one to use depending on the "waiting time" parameter.

EDIT: still playing with it... some suggestions for next releases:
  • add a "search" field to make it easy to find a command
  • "clear" button for reseting just a workbench (or global)
  • "clear all" button for reseting everything
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: ShortCuts

Postby triplus » Wed Sep 21, 2016 6:36 pm

pablogil wrote:I have just tested it in macOS and it works perfectly, I can't find any glitch or bug :)
The Preferences panel is so clean and easy to use. I definitely like the statistics at the top right corner.
Good to hear that. As for your observations. A lot of them make sense and i was thinking about them in one way or another. I won't comment on all off them ATM but will focus on what i feel is a priority.
I think it's quicker to just press the command on the toolbar... Of course with Shortcuts I'm able to reach any command from any workbench but, still, I don't see how it can improve my workflow as, for example, Piemenu does, which is a really fast way of running commands.
Comparing PieMenu and ShortCuts does make sense up to a point. I feel that comparing ShortCuts to current shortcut system is better suited. To improve it where it doesn’t work optimal and complement it in other areas. And to provide some additional possibilities currently not available or possible.
Anyway, I'm unsure if I'm using it properly because I don't find it comfortable to use as this first release is. I mean, I find tedious running any command using Shortcuts:
1. press invoke button
2. press the keyboard shortcut you have set
3. you see a list of commands, then you press the down arrow in the keyboard in order to select from the list
4. accept pressing Enter
Yes this is the current behaviour and it will likely stay default behaviour. As the rationale behind this is if you expose new users to ShortCuts and individual workbenches do provide preset shortcuts by default. Users first need to get to know the key combination before they can start using them more efficiently. Said that once the learning phase is over for sure default behaviour can get in the way.
But if I´m right about the actual behavior, I would like to suggest you some modifications in order to make it really fast of using (invoking and running the command). So, I suggest the following behavior:
1. pressing a modifier key (or combination of modifier keys) invokes Shortcuts (for instance SHIFT+CTRL)
2. without releasing the modifier key(s), press your assigned command key (for instance, C for creating a new cube) and it runs the command
There will be an option (or more of them) in the preferences in the future. Current plan is to have an option and once enabled if for example W + L key combination will produce single command in completer it will be triggered automatically. This should bring ShortCuts interaction to the current shortcut system performance level.
I have seen you allow to set a combination of keys (for instance, NC for creating a new cube), that's super cool, but with the behavior I'm suggesting it won't work, so, I would suggest adding a Preferences customizable parameter to set a "waiting time" since the first key is pressed in order to listen for key combinations (it might be set to something less than a second in order to make the process quick, so, for instance that parameter could be set to 500 miliseconds. Then, the behavior would be:
1. pressing a modifier key (or combination of modifier keys) invokes Shortcuts
2. without releasing the modifier key(s), press your assigned command keys (for instance, N and C for creating a new cube) having in mind you should press the second key, "C", in less than 500ms after you pressed "N" because then, Shortcuts will stop listening and will run the command

With this behavior, you could have and command with "C" key and other with "C" plus anything else. Shortcuts will decide which one to use depending on the "waiting time" parameter.
Yes you see that is why user feedback is important. As thinking about possibilities and before actually implementing something there needs to be some use case behind it and it needs to make sense.

Therefore lets say C and CL key are used for commands. Mentioned future planed option above would therefore if enabled automatically trigger CL key combination. But If only C key would be provided current conflict resolution mechanism will provide both options. Doing it like that substantially reduces complexity involved around setting and using shortcuts. Anyway having a way to trigger C command automatically in set time interval could make sense. This for example is a nice use case and currently it is not possible to do this with default shortcut system. Or better just using C and CL shortcut for two commands is AFAIK currently not possible.

P.S. I am not sure yet if it will be implemented as i will need to do some prototypes first.
User avatar
pablogil
Posts: 845
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: ShortCuts

Postby pablogil » Wed Sep 21, 2016 7:11 pm

triplus wrote:Therefore lets say C and CL key are used for commands. Mentioned future planed option above would therefore if enabled automatically trigger CL key combination. But If only C key would be provided current conflict resolution mechanism will provide both options. Doing it like that substantially reduces complexity involved around setting and using shortcuts. Anyway having a way to trigger C command automatically in set time interval could make sense. This for example is a nice use case and currently it is not possible to do this with default shortcut system. Or better just using C and CL shortcut for two commands is AFAIK currently not possible.
As you said, it's nice to have some use cases, so, following the C and CL shortcuts for different commands:
I think smart modules as Shortcuts may have to go a step forward the user, I mean, if the user presses C and after a rational amount of time doesn't press L, it's clear he want to run the standalone C command, so that Shortcuts should act as intended and run it.
I like the idea of listing commands and making the user get used to commands but with time he will get confident and would like to invoke commands quicker, and there is where an "auto" mode would have more sense.

May be adding this "auto" mode is easy to implement just above your actual code, because it would be just a "delay and run command", am I right?
Anyway, as always, think about it, I really think both behaviors could live together and fit different kind of users.

Thanks
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: ShortCuts

Postby triplus » Wed Sep 21, 2016 7:34 pm

Running command automatically once unique completion is available. That likely should be possible as i think i already made working prototype in the past.

As for comparing current key(s) with all available completions after some time interval. And after if only one match is found to run the command automatically. I don't have a working prototype for this ATM but thinking about it likely this should be possible.

P.S. This two interaction behaviours if implemented will be provided as additional options in the Preferences. Likely disabled by default.
User avatar
pablogil
Posts: 845
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: ShortCuts

Postby pablogil » Thu Sep 22, 2016 10:59 am

triplus wrote:Running command automatically once unique completion is available. That likely should be possible as i think i already made working prototype in the past.

As for comparing current key(s) with all available completions after some time interval. And after if only one match is found to run the command automatically. I don't have a working prototype for this ATM but thinking about it likely this should be possible.

P.S. This two interaction behaviours if implemented will be provided as additional options in the Preferences. Likely disabled by default.
Yes, I agree both interaction behavior could be provided as non default but you will find power users will surely take advantage of them. :)
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: ShortCuts

Postby triplus » Thu Sep 22, 2016 12:33 pm

I did some tests yesterday and it will take some time to get desired behaviour polished and implemented but likely i will go for single option. To reduce potential confusion.

User will therefore have to take care of delay (or use default value). Delay after last key was pressed and the rest should just work. In theory this option could be enabled by default as i was thinking pressing on down key shows all available commands. Therefore user can always have quick access to that. But haven't made any final decisions about it yet.
User avatar
pablogil
Posts: 845
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: ShortCuts

Postby pablogil » Thu Sep 22, 2016 1:56 pm

triplus wrote:I did some tests yesterday and it will take some time to get desired behaviour polished and implemented but likely i will go for single option. To reduce potential confusion.

User will therefore have to take care of delay (or use default value). Delay after last key was pressed and the rest should just work. In theory this option could be enabled by default as i was thinking pressing on down key shows all available commands. Therefore user can always have quick access to that. But haven't made any final decisions about it yet.
It seems nice, test it and follow the best approach. I like the delay option with a default time but with the option to tweak it, of course.
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here