From 8f8cbea71955f848b776d257b19009c136cf603b Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Fri, 10 Nov 2017 03:56:20 +0800 Subject: [PATCH] Fix context menu --- InitGui.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/InitGui.py b/InitGui.py index d4e5aa7..5ee0450 100644 --- a/InitGui.py +++ b/InitGui.py @@ -1,5 +1,4 @@ import FreeCAD, FreeCADGui -from collections import OrderedDict class Assembly3Workbench(FreeCADGui.Workbench): import asm3 @@ -34,8 +33,9 @@ class Assembly3Workbench(FreeCADGui.Workbench): # FreeCADGui.addPreferencePage( # ':/assembly3/ui/assembly3_prefs.ui','Assembly3') - def ContextMenu(self, _recipient): + def _contextMenu(self): from asm3.gui import AsmCmdManager + from collections import OrderedDict menus = OrderedDict() for cmd in AsmCmdManager.getInfo().Types: name = cmd.getContextMenuName() @@ -44,4 +44,8 @@ class Assembly3Workbench(FreeCADGui.Workbench): for name,cmds in menus.items(): self.appendContextMenu(name,cmds) + def ContextMenu(self, _recipient): + from asm3.utils import logger + logger.catch('',self._contextMenu) + FreeCADGui.addWorkbench(Assembly3Workbench)