diff --git a/src/Mod/Path/PathScripts/PathPreferences.py b/src/Mod/Path/PathScripts/PathPreferences.py index 096c6ef349..6fe58570ef 100644 --- a/src/Mod/Path/PathScripts/PathPreferences.py +++ b/src/Mod/Path/PathScripts/PathPreferences.py @@ -27,8 +27,8 @@ import glob import os import PathScripts.PathLog as PathLog -PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) -#PathLog.trackModule() +# PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +# PathLog.trackModule() DefaultFilePath = "DefaultFilePath" DefaultJobTemplate = "DefaultJobTemplate" @@ -152,7 +152,9 @@ def searchPathsTool(sub='Bit'): paths = [] if 'Bit' == sub: + paths.append("{}/Bit".format(os.path.dirname(lastPathToolLibrary()))) paths.append(lastPathToolBit()) + if 'Library' == sub: paths.append(lastPathToolLibrary()) if 'Shape' == sub: diff --git a/src/Mod/Path/PathScripts/PathToolBit.py b/src/Mod/Path/PathScripts/PathToolBit.py index 9c76b141f6..f468eacb0e 100644 --- a/src/Mod/Path/PathScripts/PathToolBit.py +++ b/src/Mod/Path/PathScripts/PathToolBit.py @@ -59,16 +59,19 @@ ParameterTypeConstraint = { def _findTool(path, typ, dbg=False): - if os.path.exists(path): + # PathLog.track("Path: {} typ: {}".format(path, typ)) + if os.path.exists(path): # absolute reference if dbg: PathLog.debug("Found {} at {}".format(typ, path)) return path def searchFor(pname, fname): + # PathLog.debug("pname: {} fname: {}".format(pname, fname)) if dbg: PathLog.debug("Looking for {}".format(pname)) if fname: for p in PathPreferences.searchPathsTool(typ): + PathLog.track(p) f = os.path.join(p, fname) if dbg: PathLog.debug(" Checking {}".format(f)) @@ -77,6 +80,7 @@ def _findTool(path, typ, dbg=False): PathLog.debug(" Found {} at {}".format(typ, f)) return f if pname and os.path.sep != pname: + PathLog.track(pname) ppname, pfname = os.path.split(pname) ffname = os.path.join(pfname, fname) if fname else pfname return searchFor(ppname, ffname) @@ -94,6 +98,7 @@ def findShape(path): def findBit(path): + PathLog.track(path) if path.endswith('.fctb'): return _findTool(path, 'Bit') return _findTool("{}.fctb".format(path), 'Bit') diff --git a/src/Mod/Path/PathScripts/PathToolBitLibraryGui.py b/src/Mod/Path/PathScripts/PathToolBitLibraryGui.py index 3f527e298b..c0b4375c1d 100644 --- a/src/Mod/Path/PathScripts/PathToolBitLibraryGui.py +++ b/src/Mod/Path/PathScripts/PathToolBitLibraryGui.py @@ -229,6 +229,9 @@ class ModelFactory(object): if lib == "": lib = PathPreferences.lastFileToolLibrary() + if lib == "" or lib is None: + return model + if os.path.isfile(lib): # An individual library is wanted self.__libraryLoad(lib, model) @@ -250,9 +253,13 @@ class ToolBitSelector(object): return ['#', 'Tool'] def curLib(self): - libfile = os.path.split(PathPreferences.lastFileToolLibrary())[1] - libName = os.path.splitext(libfile)[0] - return libName + libfile = PathPreferences.lastFileToolLibrary() + if libfile is None or libfile == "": + return "" + else: + libfile = os.path.split(PathPreferences.lastFileToolLibrary())[1] + libfile = os.path.splitext(libfile)[0] + return libfile def loadData(self): PathLog.track()