Added full unit test to make sure tool chain works correctly.

This commit is contained in:
Markus Lampert
2017-08-22 11:12:02 -07:00
parent fbc8db743f
commit 504e4b7109
5 changed files with 100 additions and 26 deletions

View File

@@ -37,7 +37,9 @@ from PySide import QtCore, QtGui
"""Dogbone Dressup object and FreeCAD command"""
LOG_MODULE = PathLog.thisModule()
PathLog.setLevel(PathLog.Level.DEBUG, LOG_MODULE)
if False:
PathLog.setLevel(PathLog.Level.DEBUG, LOG_MODULE)
# Qt tanslation handling
def translate(context, text, disambig=None):
@@ -1000,8 +1002,9 @@ def Create(base, name = 'DogboneDressup'):
ViewProviderDressup(obj.ViewObject)
obj.Base.ViewObject.Visibility = False
dbo.setup(obj, True)
obj.ToolController = base.ToolController
dbo.setup(obj, True)
return obj
class CommandDressupDogbone:

View File

@@ -236,7 +236,7 @@ class CommandPathToolController:
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", "Default Tool")
PathScripts.PathToolController.ToolController(obj)
if assignViewProvider:
if FreeCAD.GuiUp and assignViewProvider:
PathScripts.PathToolController._ViewProviderToolController(obj.ViewObject)
if tool is None:

View File

@@ -376,13 +376,14 @@ def findToolController(obj, name=None):
PathLog.track('name: {}'.format(name))
c = None
# First check if a user has selected a tool controller in the tree. Return the first one and remove all from selection
for sel in FreeCADGui.Selection.getSelectionEx():
if hasattr(sel.Object, 'Proxy'):
if isinstance(sel.Object.Proxy, PathScripts.PathToolController.ToolController):
if c is None:
c = sel.Object
FreeCADGui.Selection.removeSelection(sel.Object)
if FreeCAD.GuiUp:
# First check if a user has selected a tool controller in the tree. Return the first one and remove all from selection
for sel in FreeCADGui.Selection.getSelectionEx():
if hasattr(sel.Object, 'Proxy'):
if isinstance(sel.Object.Proxy, PathScripts.PathToolController.ToolController):
if c is None:
c = sel.Object
FreeCADGui.Selection.removeSelection(sel.Object)
if c is not None:
return c