Added template selection and preference integration to job creation dialog.

This commit is contained in:
Markus Lampert
2017-06-09 18:49:04 -07:00
parent 53bb8be7fd
commit c121c6c0f7
3 changed files with 56 additions and 22 deletions

View File

@@ -23,9 +23,8 @@
# ***************************************************************************
import FreeCAD
import os
import glob
import os
import PathScripts.PathLog as PathLog
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
@@ -48,15 +47,16 @@ class PathPreferences:
def preferences(cls):
return FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Path")
@classmethod
def pathScriptsSourcePath(cls):
return FreeCAD.getHomePath() + ("Mod/Path/PathScripts/")
@classmethod
def allAvailablePostProcessors(cls):
path = FreeCAD.getHomePath() + ("Mod/Path/PathScripts/")
posts = glob.glob(path + '/*_post.py')
posts = glob.glob(cls.pathScriptsSourcePath() + '/*_post.py')
allposts = [ str(os.path.split(os.path.splitext(p)[0])[1][:-5]) for p in posts]
grp = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macro")
path = grp.GetString("MacroPath", FreeCAD.getUserAppDataDir())
posts = glob.glob(path + '/*_post.py')
posts = glob.glob(cls.macroFilePath() + '/*_post.py')
allposts.extend([ str(os.path.split(os.path.splitext(p)[0])[1][:-5]) for p in posts])
allposts.sort()
@@ -95,10 +95,24 @@ class PathPreferences:
def filePath(cls):
path = cls.defaultFilePath()
if not path:
grp = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macro")
path = grp.GetString("MacroPath", FreeCAD.getUserAppDataDir())
path = cls.macroFilePath()
return path
@classmethod
def macroFilePath(cls):
grp = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macro")
return grp.GetString("MacroPath", FreeCAD.getUserAppDataDir())
@classmethod
def searchPaths(cls):
paths = []
p = cls.defaultFilePath()
if p:
paths.append(p)
paths.append(cls.macroFilePath())
paths.append(cls.pathScriptsSourcePath())
return paths
@classmethod
def defaultJobTemplate(cls):
return cls.preferences().GetString(cls.DefaultJobTemplate)