triplus / ShortCuts

Shortcuts overlay for FreeCAD
10 stars 4 forks source link

Broken (but with easy workaround) on the realthunder link branch #8

Open VorpalBlade opened 4 years ago

VorpalBlade commented 4 years ago

I have been experimenting with the link/topological naming branch of freecad (https://github.com/realthunder/FreeCAD_assembly3) and found that the ShortCuts mod did not work. On startup I got the following error:

Traceback (most recent call last):
  File "/home/user/.FreeCAD/Mod/ShortCuts/ShortCuts_Gui.py", line 500, in onPreStart
    onStart()
  File "/home/user/.FreeCAD/Mod/ShortCuts/ShortCuts_Gui.py", line 492, in onStart
    onWorkbench()
  File "/home/user/.FreeCAD/Mod/ShortCuts/ShortCuts_Gui.py", line 189, in onWorkbench
    workbench = Gui.activeWorkbench().__class__.__name__
AssertionError: No active workbench

The Accessories menu then never showed up.

While I do not know the cause of this (might be an issue in the branch of FreeCAD I'm using), it was easy to workaround this by the following modification:

def onWorkbench():
    """Update shortcuts on workbench activated."""
    try:
        workbench = Gui.activeWorkbench().__class__.__name__
        update(workbench)
    except AssertionError as e:
        print("Ignoring: %s" % e)

With this change, the rest of ShortCuts seems to work perfectly fine, though a deeper investigation into this issue is probably warranted.

FreeCAD version info:

OS: Ubuntu 18.04.5 LTS (X-Cinnamon/cinnamon)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 2020.11.12.22739 +2746 (Git) AppImage
Build type: Release
Branch: LinkStage3
Hash: b8e17ac7497f70d39e551bccc66e4c37f855fd32
Python version: 3.8.6
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United Kingdom (en_GB)
luzpaz commented 3 years ago

@triplus ping
Any chance you'd be able to fix this? If not, we'll probably fork the repo and point the Addon Manager to the fork (until you decide to come back to FreeCAD development, i hope :crossed_fingers:) is that OK with you?