assembly: disable auto solve when workbench is not active

This commit is contained in:
Zheng, Lei 2019-01-03 11:01:58 +08:00
parent b1ff90e093
commit 4feccb6fab
3 changed files with 5 additions and 1 deletions

View File

@ -2788,7 +2788,8 @@ class Assembly(AsmGroup):
@classmethod
def canAutoSolve(cls):
from . import solver
return gui.AsmCmdManager.AutoRecompute and \
return gui.AsmCmdManager.WorkbenchActivated and \
gui.AsmCmdManager.AutoRecompute and \
FreeCADGui.ActiveDocument and \
not FreeCADGui.ActiveDocument.Transacting and \
not FreeCAD.isRestoring() and \

1
gui.py
View File

@ -138,6 +138,7 @@ class AsmCmdManager(ProxyType):
Toolbars = OrderedDict()
Menus = OrderedDict()
_defaultMenuGroupName = '&Assembly3'
WorkbenchActivated = False
@staticmethod
def getToolbarParams():

View File

@ -29,11 +29,13 @@ class Assembly3Workbench(FreeCADGui.Workbench):
def Activated(self):
from .gui import AsmCmdManager
AsmCmdManager.WorkbenchActivated = True
for cmd in AsmCmdManager.getInfo().Types:
cmd.workbenchActivated()
def Deactivated(self):
from .gui import AsmCmdManager
AsmCmdManager.WorkbenchActivated = False
for cmd in AsmCmdManager.getInfo().Types:
cmd.workbenchDeactivated()