ShortCuts

Need help, or want to share a macro? Post here!
User avatar
zbigg
Posts: 136
Joined: Tue Dec 19, 2017 1:11 pm

Re: ShortCuts

Postby zbigg » Tue Apr 17, 2018 9:51 pm

triplus wrote:
Tue Apr 17, 2018 9:36 pm
Hi @zbigg.

Although we discussed this things in the past already. And you likely know your question isn't directly related to ShortCuts module for FreeCAD. Seeing an eager users interested in this area. Hard to argue with that.

P.S. As for ShortCuts module for FreeCAD. I guess with a bit of patience we will get there.
...and thats OK. As far as I can get a clear message: working or NOT YET.
cheers,
User avatar
sgrogan
Posts: 5453
Joined: Wed Oct 22, 2014 5:02 pm

Re: ShortCuts

Postby sgrogan » Tue Apr 17, 2018 9:58 pm

zbigg wrote:
Tue Apr 17, 2018 4:24 pm
SHortcut implementation drives me nuts.
Try to assign the keys: ASSIGN greyed out, inactive.
Try to clear the keys: CLEAR does not work

Whats going on?!
OK, I think I get the confusion.
Capture.PNG
Capture.PNG (44.4 KiB) Viewed 758 times
Assign and Clear refer to the "Press new shortcut:" field. Maybe clear should be greyed out if the field is empty.

Also FreeCAD uses "lazy loading" so if you have not loaded, Arch or Draft their shortcuts have not been initialized.
Cycle through the workbench selector for the workbenches that you use frequently, then try to customize. A re-start is required for the changes to take effect , at least for python wb's like arch and draft.

Also many of the "good" shortcuts may already be taken.
triplus
Posts: 8786
Joined: Mon Dec 12, 2011 4:45 pm

Re: ShortCuts

Postby triplus » Tue Apr 17, 2018 11:21 pm

zbigg wrote:
Tue Apr 17, 2018 9:51 pm
...and thats OK. As far as I can get a clear message: working or NOT YET.
To the best of my knowledge ShortCuts module for FreeCAD is working as advertised.
triplus
Posts: 8786
Joined: Mon Dec 12, 2011 4:45 pm

Re: ShortCuts

Postby triplus » Mon Apr 30, 2018 5:37 pm

I am experiencing some Qt5/PySide2 related issues on my side. When trying to implement a feature. To see if this is a general issue or just some older Qt5/PySide2 related issue. Could any user using Qt5 build copy paste the code snippet in FreeCAD Python console and provide feedback of the Qt5 version used and if the code snippet returns key sequence or results in AttributeError:

Code: Select all

from PySide import QtGui
e = QtGui.QShortcutEvent(QtGui.QKeySequence(""), 0, False)
e.key()
Thanks.
User avatar
easyw-fc
Posts: 2689
Joined: Thu Jul 09, 2015 9:34 am

Re: ShortCuts

Postby easyw-fc » Mon Apr 30, 2018 5:54 pm

triplus wrote:
Mon Apr 30, 2018 5:37 pm
I am experiencing some Qt5/PySide2 related issues on my side. When trying to implement a feature. To see if this is a general issue or just some older Qt5/PySide2 related issue. Could any user using Qt5 build copy paste the code snippet in FreeCAD Python console and provide feedback of the Qt5 version used and if the code snippet returns key sequence or results in AttributeError:

Code: Select all

from PySide import QtGui
e = QtGui.QShortcutEvent(QtGui.QKeySequence(""), 0, False)
e.key()
Thanks.
FreeCAD-0.18.13641-dev_PY3_QT5-x64-Update.7z
from PySide import QtGui
e = QtGui.QShortcutEvent(QtGui.QKeySequence(""), 0, False)
e.key()
Traceback (most recent call last):
File "<input>", line 1, in <module>
AttributeError: 'PySide2.QtGui.QShortcutEvent' object has no attribute 'key'
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.13641 (Git)
Build type: Release
Branch: master
Hash: c9f6855fc446e4b30bab63f109f0e23bdc54769f
Python version: 3.6.4
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: English/UnitedStates (en_US)
triplus
Posts: 8786
Joined: Mon Dec 12, 2011 4:45 pm

Re: ShortCuts

Postby triplus » Tue May 01, 2018 9:23 am

Thanks @easyw-fc for confirming. Today i tested with latest PySide2/Qt5 development releases and the issue is still there. Likely support in this area is not implemented for PySide2/Qt5 just yet.
triplus
Posts: 8786
Joined: Mon Dec 12, 2011 4:45 pm

Re: ShortCuts

Postby triplus » Tue May 01, 2018 12:09 pm

A report was made here:

https://bugreports.qt.io/browse/PYSIDE-655

Hopefully PySide 2 will gain support for mentioned functions in the future. For now i decided i won't include the feature using this functions (PySide/Qt4). As for the rest. There should now be a basic possibility to set keyboard shortcuts directly (without using the invoke key approach). Expect code release soon. After things can be tested and feedback can be provided. On things like what makes the most sense from the finalizing ShortCuts module point of view.
triplus
Posts: 8786
Joined: Mon Dec 12, 2011 4:45 pm

Re: ShortCuts

Postby triplus » Fri May 04, 2018 11:54 am

Reported PySide QShortcutEvent related issue was promptly resolved. Missing functions will be made available again in PySide for Qt 5.9 and up. I will reintroduce the feature in ShortCuts using this functionality in the future.

Shortcuts manager:
  • Overlay: Removed additional invoke key setting
  • Overlay: Removed invoke key shortcut uniqueness enforcement
  • Manager: Set global or per workbench keyboard shortcut for commands
  • Manager: Reset, create and apply shortcut scheme on workbench activated
  • Manager: Workbench combo box
  • Manager: Search line for commands
  • Manager: Table of commands and editable shortcuts
  • Manager: Verify shortcuts on entering
  • Manager: Shortcut type icon indicator (global, local and override)
  • Manager: Index based database
  • Manager: Accessories menu
  • Misc: Artwork
  • Misc: Other minor tweaks
  • Misc: Updated instructions
Shortcuts manager.png
Shortcuts manager.png (54.11 KiB) Viewed 641 times
P.S. Database location and structure will change in the future (resetting the custom set shortcuts to defaults).
User avatar
zbigg
Posts: 136
Joined: Tue Dec 19, 2017 1:11 pm

Re: ShortCuts

Postby zbigg » Sun May 06, 2018 12:02 pm

Sounds great, what does it mean to an user?

New .17 build shall be issued, incl. QT5?
OR
should wait for v.18 ?
cheers,
triplus
Posts: 8786
Joined: Mon Dec 12, 2011 4:45 pm

Re: ShortCuts

Postby triplus » Sun May 06, 2018 12:19 pm

You can install and start testing and using the ShortCuts module for FreeCAD manually (by following the instructions):

https://github.com/triplus/ShortCuts

Starting with FreeCAD 0.17 you can install or update ShortCuts module by using:

Tools -> Addon manager -> ShortCuts -> Install -> FreeCAD restart

P.S. Latest release was tested on FreeCAD 0.15+ (Py2/Py3/Qt4/Qt5). One feature i will introduce in the future. That feature will only be available when using FreeCAD Qt4 builds or FreeCAD Qt5 builds starting with Qt 5.9 and above.