From cd1a4e8b4cf41982cb8870df568e39a0008ed29f Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Mon, 27 Nov 2017 18:53:18 -0800 Subject: [PATCH] Hiding some advanced, not ready for prime time features unless EnableExperimentalFeatures is set and true in the preferences. --- src/Mod/Path/Init.py | 5 ----- src/Mod/Path/InitGui.py | 23 ++++++++++++++++----- src/Mod/Path/PathScripts/PathPreferences.py | 8 +++++++ 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/Mod/Path/Init.py b/src/Mod/Path/Init.py index 3fa8e508b8..25be32004e 100644 --- a/src/Mod/Path/Init.py +++ b/src/Mod/Path/Init.py @@ -28,8 +28,3 @@ ParGrp = App.ParamGet("System parameter:Modules").GetGroup("Path") ParGrp.SetString("HelpIndex", "Path/Help/index.html") ParGrp.SetString("WorkBenchName", "Path") ParGrp.SetString("WorkBenchModule", "PathWorkbench.py") - -# Setup global default values -import Path -from PathScripts.PathPreferences import PathPreferences -Path.Area.setDefaultParams(Accuracy = PathPreferences.defaultLibAreaCurveAccuracy()) diff --git a/src/Mod/Path/InitGui.py b/src/Mod/Path/InitGui.py index 6f09f8b60d..7452d2386e 100644 --- a/src/Mod/Path/InitGui.py +++ b/src/Mod/Path/InitGui.py @@ -35,6 +35,9 @@ class PathWorkbench (Workbench): FreeCADGui.addPreferencePage(PathPreferencesPathJob.JobPreferencesPage, "Path") FreeCADGui.addPreferencePage(PathPreferencesPathDressup.DressupPreferencesPage, "Path") + # Check enablement of experimental features + from PathScripts.PathPreferences import PathPreferences + # load the builtin modules import Path import PathScripts @@ -77,14 +80,14 @@ class PathWorkbench (Workbench): import PathCommands # build commands list - projcmdlist = ["Path_Job", "Path_Post", "Path_Inspect", "Path_Sanity", "Path_Simulator"] + projcmdlist = ["Path_Job", "Path_Post", "Path_Inspect", "Path_Simulator"] toolcmdlist = ["Path_ToolLibraryEdit"] prepcmdlist = ["Path_Plane", "Path_Fixture", "Path_ToolLenOffset", "Path_Comment", "Path_Stop", "Path_Custom", "Path_Shape"] twodopcmdlist = ["Path_Contour", "Path_Profile_Faces", "Path_Profile_Edges", "Path_Pocket_Shape", "Path_Drilling", "Path_Engrave", "Path_MillFace", "Path_Helix"] - threedopcmdlist = ["Path_Pocket_3D", "Path_Surface"] + threedopcmdlist = ["Path_Pocket_3D"] modcmdlist = ["Path_OperationCopy", "Path_Array", "Path_SimpleCopy" ] dressupcmdlist = ["PathDressup_Dogbone", "PathDressup_DragKnife", "PathDressup_Tag", "PathDressup_RampEntry"] - extracmdlist = ["Path_SelectLoop", "Path_Shape", "Path_Area", "Path_Area_Workplane"] + extracmdlist = ["Path_SelectLoop"] #modcmdmore = ["Path_Hop",] #remotecmdlist = ["Path_Remote"] @@ -107,12 +110,19 @@ class PathWorkbench (Workbench): return True return False - FreeCADGui.addCommand('Path_3dTools', ThreeDCommandGroup()) + if PathPreferences.experimentalFeaturesEnabled(): + projcmdlist.append("Path_Sanity") + threedopcmdlist.append("Path_Surface") + extracmdlist.extend(["Path_Shape", "Path_Area", "Path_Area_Workplane"]) + FreeCADGui.addCommand('Path_3dTools', ThreeDCommandGroup()) + threedcmdgroup = ['Path_3dTools'] + else: + threedcmdgroup = threedopcmdlist self.appendToolbar(QT_TRANSLATE_NOOP("Path", "Project Setup"), projcmdlist) self.appendToolbar(QT_TRANSLATE_NOOP("Path", "Tool Commands"), toolcmdlist) #self.appendToolbar(QT_TRANSLATE_NOOP("Path", "Partial Commands"), prepcmdlist) - self.appendToolbar(QT_TRANSLATE_NOOP("Path", "New Operations"), twodopcmdlist+['Path_3dTools']) + self.appendToolbar(QT_TRANSLATE_NOOP("Path", "New Operations"), twodopcmdlist+threedcmdgroup) self.appendToolbar(QT_TRANSLATE_NOOP("Path", "Path Modification"), modcmdlist) self.appendToolbar(QT_TRANSLATE_NOOP("Path", "Helpful Tools"), extracmdlist) @@ -135,6 +145,8 @@ class PathWorkbench (Workbench): self.dressupcmds = dressupcmdlist + Path.Area.setDefaultParams(Accuracy = PathPreferences.defaultLibAreaCurveAccuracy()) + Log('Loading Path workbench... done\n') def GetClassName(self): @@ -176,3 +188,4 @@ FreeCAD.addImportType( "GCode (*.nc *.gc *.ncc *.ngc *.cnc *.tap *.gcode)", "PathGui") FreeCAD.addExportType( "GCode (*.nc *.gc *.ncc *.ngc *.cnc *.tap *.gcode)", "PathGui") + diff --git a/src/Mod/Path/PathScripts/PathPreferences.py b/src/Mod/Path/PathScripts/PathPreferences.py index 1609b377c0..43248ea7ce 100644 --- a/src/Mod/Path/PathScripts/PathPreferences.py +++ b/src/Mod/Path/PathScripts/PathPreferences.py @@ -45,6 +45,9 @@ class PathPreferences: GeometryTolerance = "GeometryTolerance" LibAreaCurveAccuracy = "LibAreaCurveAccuarcy" + EnableExperimentalFeatures = "EnableExperimentalFeatures" + + @classmethod def preferences(cls): return FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Path") @@ -177,3 +180,8 @@ class PathPreferences: def setDefaultStockTemplate(cls, template): cls.preferences().SetString(cls.DefaultStockTemplate, template) + + @classmethod + def experimentalFeaturesEnabled(cls): + return cls.preferences().GetBool(cls.EnableExperimentalFeatures, False) +