From da85fde4097fbdeeed8daf70e4affdeceea6e850 Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Sat, 13 Feb 2021 16:02:39 -0800 Subject: [PATCH] Split OCL and experimental features to allow enabling independently. --- .../Path/Gui/Resources/preferences/Advanced.ui | 17 ++++++++--------- src/Mod/Path/InitGui.py | 1 + src/Mod/Path/PathScripts/PathPreferences.py | 9 +++++++-- .../Path/PathScripts/PathPreferencesAdvanced.py | 8 ++++---- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/Mod/Path/Gui/Resources/preferences/Advanced.ui b/src/Mod/Path/Gui/Resources/preferences/Advanced.ui index cadeb072cee6..c26cc9f0ae81 100644 --- a/src/Mod/Path/Gui/Resources/preferences/Advanced.ui +++ b/src/Mod/Path/Gui/Resources/preferences/Advanced.ui @@ -89,7 +89,7 @@ - Experimental Features + Open CAMlib @@ -117,26 +117,25 @@ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans'; font-size:16pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This will enable some operations and commands which are not fully tested or are otherwise not deemed to be ready for prime time.</p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Some of these features require additional libraries to be installed in order to function correctly:<br /> * opencamlib<br /> * asciidoctor</p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">While enabling these features has no impact on the functionality of other features and operations but might have an impact on the stability of FreeCAD itself.</p></body></html> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If openCAMlib is installed with its python interface it can be used by some additional 3d operations.</p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Changing this value requires a restart of FreeCAD to take effect.</p></body></html> - + - Enable Experimental Features + Enable OCL dependent features - EnableExperimentalFeatures + EnableAdvancedOCLFeatures Mod/Path - - + + Suppress warning if openCAMlib cannot be found diff --git a/src/Mod/Path/InitGui.py b/src/Mod/Path/InitGui.py index 97402ea0740f..9fa7ce6e61e0 100644 --- a/src/Mod/Path/InitGui.py +++ b/src/Mod/Path/InitGui.py @@ -121,6 +121,7 @@ def Initialize(self): extracmdlist.extend(["Path_Area", "Path_Area_Workplane"]) specialcmdlist.append('Path_Thread_Milling') + if PathPreferences.advancedOCLFeaturesEnabled(): try: import ocl # pylint: disable=unused-variable from PathScripts import PathSurfaceGui diff --git a/src/Mod/Path/PathScripts/PathPreferences.py b/src/Mod/Path/PathScripts/PathPreferences.py index cb67d0d7a86c..a88021964148 100644 --- a/src/Mod/Path/PathScripts/PathPreferences.py +++ b/src/Mod/Path/PathScripts/PathPreferences.py @@ -62,6 +62,7 @@ WarningSuppressSelectionMode = "WarningSuppressSelectionMode" WarningSuppressOpenCamLib = "WarningSuppressOpenCamLib" EnableExperimentalFeatures = "EnableExperimentalFeatures" +EnableAdvancedOCLFeatures = "EnableAdvancedOCLFeatures" def preferences(): @@ -243,6 +244,10 @@ def setDefaultTaskPanelLayout(style): preferences().SetInt(DefaultTaskPanelLayout, style) +def advancedOCLFeaturesEnabled(): + return preferences().GetBool(EnableAdvancedOCLFeatures, False) + + def experimentalFeaturesEnabled(): return preferences().GetBool(EnableExperimentalFeatures, False) @@ -262,8 +267,8 @@ def suppressSelectionModeWarning(): def suppressOpenCamLibWarning(): return preferences().GetBool(WarningSuppressOpenCamLib, True) -def setPreferencesAdvanced(experimental, warnSpeeds, warnRapids, warnModes, warnOCL): - preferences().SetBool(EnableExperimentalFeatures, experimental) +def setPreferencesAdvanced(ocl, warnSpeeds, warnRapids, warnModes, warnOCL): + preferences().SetBool(EnableAdvancedOCLFeatures, ocl) preferences().SetBool(WarningSuppressAllSpeeds, warnSpeeds) preferences().SetBool(WarningSuppressRapidSpeeds, warnRapids) preferences().SetBool(WarningSuppressSelectionMode, warnModes) diff --git a/src/Mod/Path/PathScripts/PathPreferencesAdvanced.py b/src/Mod/Path/PathScripts/PathPreferencesAdvanced.py index 49679aa1bd62..5b9151587beb 100644 --- a/src/Mod/Path/PathScripts/PathPreferencesAdvanced.py +++ b/src/Mod/Path/PathScripts/PathPreferencesAdvanced.py @@ -32,11 +32,11 @@ class AdvancedPreferencesPage: def __init__(self, parent=None): self.form = FreeCADGui.PySideUic.loadUi(':preferences/Advanced.ui') self.form.WarningSuppressAllSpeeds.stateChanged.connect(self.updateSelection) - self.form.EnableExperimentalFeatures.stateChanged.connect(self.updateSelection) + self.form.EnableAdvancedOCLFeatures.stateChanged.connect(self.updateSelection) def saveSettings(self): PathPreferences.setPreferencesAdvanced( - self.form.EnableExperimentalFeatures.isChecked(), + self.form.EnableAdvancedOCLFeatures.isChecked(), self.form.WarningSuppressAllSpeeds.isChecked(), self.form.WarningSuppressRapidSpeeds.isChecked(), self.form.WarningSuppressSelectionMode.isChecked(), @@ -46,12 +46,12 @@ def loadSettings(self): self.form.WarningSuppressAllSpeeds.setChecked(PathPreferences.suppressAllSpeedsWarning()) self.form.WarningSuppressRapidSpeeds.setChecked(PathPreferences.suppressRapidSpeedsWarning(False)) self.form.WarningSuppressSelectionMode.setChecked(PathPreferences.suppressSelectionModeWarning()) - self.form.EnableExperimentalFeatures.setChecked(PathPreferences.experimentalFeaturesEnabled()) + self.form.EnableAdvancedOCLFeatures.setChecked(PathPreferences.advancedOCLFeaturesEnabled()) self.form.WarningSuppressOpenCamLib.setChecked(PathPreferences.suppressOpenCamLibWarning()) self.updateSelection() def updateSelection(self, state=None): - self.form.WarningSuppressOpenCamLib.setEnabled(self.form.EnableExperimentalFeatures.isChecked()) + self.form.WarningSuppressOpenCamLib.setEnabled(self.form.EnableAdvancedOCLFeatures.isChecked()) if self.form.WarningSuppressAllSpeeds.isChecked(): self.form.WarningSuppressRapidSpeeds.setChecked(True) self.form.WarningSuppressRapidSpeeds.setEnabled(False)