solved - find all currently assigned shortcuts?

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
bambuko
Veteran
Posts: 2169
Joined: Thu Oct 24, 2019 12:53 pm
Location: UK, England, North Devon

solved - find all currently assigned shortcuts?

Post by bambuko »

as per title - is it possible?
where can I find it?

please

Code: Select all

OS: elementary OS 6.1 Jalnir (Pantheon/pantheon)
Word size of FreeCAD: 64-bit
Version: 0.20.26720 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 7bca26e)
Hash: 7bca26e7c14d4d43374ff7e0c8582735b249cbfd
Python version: 3.9.9
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.3
Locale: English/United Kingdom (en_GB)
Last edited by bambuko on Sat Jan 29, 2022 11:02 am, edited 1 time in total.
I am using Link branch and Assembly3
you can also download ... and try it here
excellent Assembly3 tutorials here
drmacro
Veteran
Posts: 8872
Joined: Sun Mar 02, 2014 4:35 pm

Re: find all currently assigned shortcuts?

Post by drmacro »

In Customize Keyboard, if you select a category then enter the the desired key/s it will tell you if it is assigned in that category.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
bambuko
Veteran
Posts: 2169
Joined: Thu Oct 24, 2019 12:53 pm
Location: UK, England, North Devon

Re: find all currently assigned shortcuts?

Post by bambuko »

Thank you,
I know of this one, but that is not what I am searching for ;)

is it possible to find all currently assigned shortcuts? (and not by typing all the letters of alphabet and their combinations to see if they are used)

I know FreeCAD is not Alexa :lol: but is it possible to get this information?

later edit:
https://forum.freecadweb.org/viewtopic.php?t=23692
I am using Link branch and Assembly3
you can also download ... and try it here
excellent Assembly3 tutorials here
drmacro
Veteran
Posts: 8872
Joined: Sun Mar 02, 2014 4:35 pm

Re: find all currently assigned shortcuts?

Post by drmacro »

This was last updated in Nov 2021...

https://wiki.freecadweb.org/Sandbox:Keyboard_Shortcuts
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
bambuko
Veteran
Posts: 2169
Joined: Thu Oct 24, 2019 12:53 pm
Location: UK, England, North Devon

Re: find all currently assigned shortcuts?

Post by bambuko »

Thank you,
must admit didn't think of wiki :oops:

but... since things are rather fluid (constantly changing) I was hoping there was a way of querying FreeCAD as to what is the current state of shortcuts.
Sounds like the answer is no :(
I am using Link branch and Assembly3
you can also download ... and try it here
excellent Assembly3 tutorials here
drmacro
Veteran
Posts: 8872
Joined: Sun Mar 02, 2014 4:35 pm

Re: find all currently assigned shortcuts?

Post by drmacro »

bambuko wrote: Fri Jan 28, 2022 1:48 pm Thank you,
must admit didn't think of wiki :oops:

but... since things are rather fluid (constantly changing) I was hoping there was a way of querying FreeCAD as to what is the current state of shortcuts.
Sounds like the answer is no :(
I don't know of a built in command.

Maybe a Python script could do it for a given instance/install of FreeCAD... :roll:
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: find all currently assigned shortcuts?

Post by openBrain »

bambuko wrote: Fri Jan 28, 2022 1:48 pm Thank you,
must admit didn't think of wiki :oops:

but... since things are rather fluid (constantly changing) I was hoping there was a way of querying FreeCAD as to what is the current state of shortcuts.
Sounds like the answer is no :(

Code: Select all

from PySide import QtGui
[act.shortcut().toString() for act in Gui.getMainWindow().findChildren(QtGui.QAction) if not act.shortcut().isEmpty()]
[act.key().toString() for act in Gui.getMainWindow().findChildren(QtGui.QShortcut) if not act.key().isEmpty()]
It will list only loaded commands, so if you want "everything", you have to load all workbenches first.
You can do it with :

Code: Select all

for wb in Gui.listWorkbenches():
	Gui.activateWorkbench(wb)
User avatar
bambuko
Veteran
Posts: 2169
Joined: Thu Oct 24, 2019 12:53 pm
Location: UK, England, North Devon

Re: find all currently assigned shortcuts?

Post by bambuko »

openBrain wrote: Fri Jan 28, 2022 2:55 pm ...

Code: Select all

['Alt+F4', 'W, 1', 'W, 2', 'W, 3', 'W, 4', 'W, 5', 'W, 6', 'W, 7', 'W, 8', 'W, 9', 'F1', 'Ctrl+N', 'Ctrl+O', 'Ctrl+S', 'Ctrl+P', 'Ctrl+X', 'Ctrl+C', 'Ctrl+V', 'Ctrl+Z', 'Ctrl+Shift+Z', 'F5', 'Shift+F1', 'Ctrl+F6', 'V, F', 'V, S', 'V, 1', 'V, 2', 'V, 3', 'V, 4', 'V, 5', 'V, 6', 'V, 7', 'S, B', 'S, F', 'S, G', 'S, D', 'T, 1', 'T, 2', 'T, 3', 'T, 4', 'T, 5', 'T, D', 'T, G', '0', '1', '2', '3', '4', '5', '6', 'F2', 'Ctrl+C', 'Ctrl+V', 'Ctrl+A', 'Ctrl+W', 'Ctrl+I', 'Ctrl+E', 'Shift+B', 'Shift+E', 'Del', 'Ctrl+Shift+P', 'V, O', 'V, P', 'Alt+F11', 'Home', 'Shift+Left', 'Shift+Right', 'Shift+F', 'Ctrl++', 'Ctrl+-', 'Ctrl+B', 'V, D', 'V, U', 'F11', 'A, C', 'Space', 'Esc', 'Ctrl+D', '1', 'F6', 'Shift+F6', 'F10', 'F11', 'F9', 'Q, P', 'Ctrl+Tab', 'Ctrl+Shift+Backtab', 'W, A', 'R, B', 'C, W', 'B, P', 'P, O', 'S, I', 'B, U', 'L, V', 'E, X', 'W, N', 'R, F', 'S, E', 'S, P', 'S, R', 'E, Q', 'F, R', 'T, U', 'P, F', 'L, I', 'P, L', 'F, I', 'C, I', 'E, L', 'R, E', 'P, G', 'B, S', 'F, F', 'H, A', 'T, E', 'D, I', 'D, L', 'M, V', 'R, O', 'S, C', 'M, I', 'O, S', 'T, R', 'S, H', 'C, L', 'D, E', 'H, S', 'J, O', 'S, P', 'U, P', 'D, N', 'C, M', 'C, C', 'I, P', 'Ctrl+Space', 'S, T', 'A, X', 'X, S', 'A, X', 'P, A', 'P, C', 'P, S', 'N, E', 'M, T', 'M, T', 'P, I', 'P, C', 'A, R', 'A, T', 'B, Z', 'S, S', 'C, M', 'Shift+Space', 'G, R', 'W, P', 'S, A', 'M, S', 'S, X', 'S, C', 'S, E', 'S, T', 'S, R', 'R, P', 'R, S', 'S, M', 'S, Z', 'P, J', 'P, P', 'P, I', 'P, M', 'P, L', 'P, X', 'P, T', 'A', 'W', 'Q, S', 'G, Y', 'G, L', 'G, M', 'G, S', 'G, T', 'G, Q', 'G, Z', 'G, X', 'G, W', 'G, N', 'C', 'O', 'V', 'H', 'P', 'N', 'T', 'E', 'S', 'K, B', 'K, L', 'L', 'I', 'K, D', 'R', 'K, A', 'K, W', 'K, X', 'K, Z', 'Z, F', 'Z, W', 'Z, J', 'Z, K', 'Z, E', 'Z, P, R', 'Z, P, C', 'Z, I', 'Z, S', 'Z, A', 'Z, R', 'Z, Z', 'G, A', 'G, 3, A', 'G, C', 'G, 3, C', 'G, E, E', 'G, 3, E', 'G, E, A', 'G, H', 'G, J', 'G, B, B', 'G, B, P', 'G, R', 'G, V', 'G, O', 'G, P, 3', 'G, P, 4', 'G, P, 5', 'G, P, 6', 'G, P, 7', 'G, P, 8', 'G, P, R', 'G, F, F', 'G, F, P', 'K, R', 'K, O', 'K, S', 'Z, O', 'Z, V', 'Z, H', 'Z, L', 'Z, C', 'Z, M', 'Ctrl+Shift+A', 'Shift+H', 'Shift+V', 'Ctrl+M', 'Ctrl+L', 'Ctrl+Shift+D, C', 'Ctrl+Shift+D, A', 'Ctrl+Shift+D, R', 'Ctrl+Shift+D, S', 'C, B', 'W', 'E', 'C, F', 'U', 'C, R', 'S, R', 'S, J', 'S, B', 'M, S', 'M, F', 'A, N', 'A, Z', 'A, E', 'A, S', 'A, F', 'A, M', 'A, A', 'A, Q', 'A, Space', 'A, R', 'A, G', 'A, F']
:mrgreen:
just out of curiosity (and for my education, please) what is the difference between (for example) 'Z and Z' ???
I am using Link branch and Assembly3
you can also download ... and try it here
excellent Assembly3 tutorials here
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: find all currently assigned shortcuts?

Post by TheMarkster »

After loading all the workbenches, as openBrain showed how to do, enter this in the python console:

Code: Select all

commands = Gui.listCommands()
shortcuts = [f"{c} -> {Gui.Command.get(c).getShortcut()}" for c in commands if Gui.Command.get(c).getShortcut()]
shortcuts
Note also, you can assign a shortcut from the console, for example:

Code: Select all

Gui.Command.get("Std_AxisCross").setShortcut("A,E") #instead of A,C
and to reset back to the default

Code: Select all

Gui.Command.get("Std_AxisCross").resetShortcut() 
User avatar
bambuko
Veteran
Posts: 2169
Joined: Thu Oct 24, 2019 12:53 pm
Location: UK, England, North Devon

Re: find all currently assigned shortcuts?

Post by bambuko »

TheMarkster wrote: Fri Jan 28, 2022 5:38 pm

Code: Select all

commands = Gui.listCommands()
shortcuts = [f"{c} -> {Gui.Command.get(c).getShortcut()}" for c in commands if Gui.Command.get(c).getShortcut()]
shortcuts
can you elaborate, please
what is this supposed to do?
(sorry, I know I am being slow :oops: )



TheMarkster wrote: Fri Jan 28, 2022 5:38 pm ...Note also, you can assign a shortcut from the console, for example:
and to reset back to the default...
I am not much of a console kid :mrgreen: unless there is no other way (and then I need hand holding as well ;) )
I am using Link branch and Assembly3
you can also download ... and try it here
excellent Assembly3 tutorials here
Post Reply