Split OCL and experimental features to allow enabling independently.

This commit is contained in:
Markus Lampert
2021-02-13 16:02:39 -08:00
parent 6d3ff49aba
commit 6af42fa158
4 changed files with 20 additions and 15 deletions

View File

@@ -89,7 +89,7 @@
</sizepolicy>
</property>
<property name="title">
<string>Experimental Features</string>
<string>Open CAMlib</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
@@ -117,26 +117,25 @@
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:16pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;This will enable some operations and commands which are not fully tested or are otherwise not deemed to be ready for prime time.&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Some of these features require additional libraries to be installed in order to function correctly:&lt;br /&gt; * opencamlib&lt;br /&gt; * asciidoctor&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;If openCAMlib is installed with its python interface it can be used by some additional 3d operations.&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Changing this value requires a restart of FreeCAD to take effect.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="EnableExperimentalFeatures">
<widget class="Gui::PrefCheckBox" name="EnableAdvancedOCLFeatures">
<property name="text">
<string>Enable Experimental Features</string>
<string>Enable OCL dependent features</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>EnableExperimentalFeatures</cstring>
<cstring>EnableAdvancedOCLFeatures</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Path</cstring>
</property>
</widget>
</item>
<item>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="WarningSuppressOpenCamLib">
<property name="toolTip">
<string>Suppress warning if openCAMlib cannot be found</string>

View File

@@ -121,6 +121,7 @@ class PathWorkbench (Workbench):
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

View File

@@ -62,6 +62,7 @@ WarningSuppressAllSpeeds = "WarningSuppressAllSpeeds"
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)

View File

@@ -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 @@ class AdvancedPreferencesPage:
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)