diff --git a/src/Mod/Path/CMakeLists.txt b/src/Mod/Path/CMakeLists.txt index 1e1c4e305c..e3b763ff8b 100644 --- a/src/Mod/Path/CMakeLists.txt +++ b/src/Mod/Path/CMakeLists.txt @@ -84,6 +84,7 @@ SET(PathScripts_SRCS PathScripts/PathPost.py PathScripts/PathPostProcessor.py PathScripts/PathPreferences.py + PathScripts/PathPreferencesAdvanced.py PathScripts/PathPreferencesPathDressup.py PathScripts/PathPreferencesPathJob.py PathScripts/PathProbe.py diff --git a/src/Mod/Path/Gui/DlgSettingsPathColor.cpp b/src/Mod/Path/Gui/DlgSettingsPathColor.cpp index ed1e365af5..d2db05acb2 100644 --- a/src/Mod/Path/Gui/DlgSettingsPathColor.cpp +++ b/src/Mod/Path/Gui/DlgSettingsPathColor.cpp @@ -67,9 +67,6 @@ void DlgSettingsPathColor::saveSettings() ui->DefaultBBoxNormalColor->onSave(); ui->DefaultSelectionStyle->onSave(); ui->DefaultTaskPanelLayout->onSave(); - ui->WarningSuppressAllSpeeds->onSave(); - ui->WarningSuppressRapidSpeeds->onSave(); - ui->WarningSuppressSelectionMode->onSave(); } void DlgSettingsPathColor::loadSettings() @@ -86,9 +83,6 @@ void DlgSettingsPathColor::loadSettings() ui->DefaultBBoxNormalColor->onRestore(); ui->DefaultSelectionStyle->onRestore(); ui->DefaultTaskPanelLayout->onRestore(); - ui->WarningSuppressAllSpeeds->onRestore(); - ui->WarningSuppressRapidSpeeds->onRestore(); - ui->WarningSuppressSelectionMode->onRestore(); } /** diff --git a/src/Mod/Path/Gui/DlgSettingsPathColor.ui b/src/Mod/Path/Gui/DlgSettingsPathColor.ui index f3d7e8aa1f..8ade3a7cb3 100644 --- a/src/Mod/Path/Gui/DlgSettingsPathColor.ui +++ b/src/Mod/Path/Gui/DlgSettingsPathColor.ui @@ -7,7 +7,7 @@ 0 0 512 - 691 + 573 @@ -436,7 +436,7 @@ - + Qt::Vertical @@ -449,72 +449,6 @@ - - - - Warnings - - - - - - Suppress all warnings about setting speed rates for accurate cycle time calculation - - - Suppress all missing speeds warning - - - true - - - WarningSuppressAllSpeeds - - - Mod/Path - - - - - - - Suppress warning about setting the rapid speed rates for accurate cycle time calculation. Ignored if all speed warnings are already suppressed. - - - Suppress missing rapid speeds warning - - - true - - - WarningSuppressRapidSpeeds - - - Mod/Path - - - - - - - Suppress warning whenever a Path selection mode is activated - - - Suppress selection mode warning - - - true - - - WarningSuppressSelectionMode - - - Mod/Path - - - - - - @@ -538,11 +472,6 @@ QComboBox
Gui/PrefWidgets.h
- - Gui::PrefCheckBox - QCheckBox -
Gui/PrefWidgets.h
-
DefaultNormalPathColor diff --git a/src/Mod/Path/Gui/Resources/Path.qrc b/src/Mod/Path/Gui/Resources/Path.qrc index 832f74f868..309906a1b1 100644 --- a/src/Mod/Path/Gui/Resources/Path.qrc +++ b/src/Mod/Path/Gui/Resources/Path.qrc @@ -132,6 +132,7 @@ panels/ToolLibraryEditor.ui panels/TaskPathSimulator.ui panels/ZCorrectEdit.ui + preferences/Advanced.ui preferences/PathDressupHoldingTags.ui preferences/PathJob.ui translations/Path_af.qm diff --git a/src/Mod/Path/Gui/Resources/preferences/Advanced.ui b/src/Mod/Path/Gui/Resources/preferences/Advanced.ui new file mode 100644 index 0000000000..cadeb072ce --- /dev/null +++ b/src/Mod/Path/Gui/Resources/preferences/Advanced.ui @@ -0,0 +1,185 @@ + + + PathGui::DlgSettingsPathColor + + + + 0 + 0 + 512 + 691 + + + + Advanced + + + + + + Warnings + + + + + + Suppress all warnings about setting speed rates for accurate cycle time calculation + + + Suppress all missing speeds warning + + + true + + + WarningSuppressAllSpeeds + + + Mod/Path + + + + + + + Suppress warning about setting the rapid speed rates for accurate cycle time calculation. Ignored if all speed warnings are already suppressed. + + + Suppress missing rapid speeds warning + + + true + + + WarningSuppressRapidSpeeds + + + Mod/Path + + + + + + + Suppress warning whenever a Path selection mode is activated + + + Suppress selection mode warning + + + true + + + WarningSuppressSelectionMode + + + Mod/Path + + + + + + + + + + + 0 + 0 + + + + Experimental Features + + + + + + + 0 + 0 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QAbstractScrollArea::AdjustToContents + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<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> + + + + + + + Enable Experimental Features + + + EnableExperimentalFeatures + + + Mod/Path + + + + + + + Suppress warning if openCAMlib cannot be found + + + Suppress openCAMlib warning + + + true + + + WarningSuppressOpenCamLib + + + Mod/Path + + + + + + + + + + Qt::Vertical + + + + 20 + 217 + + + + + + + + + Gui::PrefCheckBox + QCheckBox +
Gui/PrefWidgets.h
+
+
+ + +
diff --git a/src/Mod/Path/InitGui.py b/src/Mod/Path/InitGui.py index 20e35d8590..97402ea074 100644 --- a/src/Mod/Path/InitGui.py +++ b/src/Mod/Path/InitGui.py @@ -164,6 +164,9 @@ class PathWorkbench (Workbench): if curveAccuracy: Path.Area.setDefaultParams(Accuracy=curveAccuracy) + # keep this one the last entry in the preferences + import PathScripts.PathPreferencesAdvanced as PathPreferencesAdvanced + FreeCADGui.addPreferencePage(PathPreferencesAdvanced.AdvancedPreferencesPage, "Path") Log('Loading Path workbench... done\n') def GetClassName(self): diff --git a/src/Mod/Path/PathScripts/PathPreferences.py b/src/Mod/Path/PathScripts/PathPreferences.py index a1c1e58fc5..cb67d0d7a8 100644 --- a/src/Mod/Path/PathScripts/PathPreferences.py +++ b/src/Mod/Path/PathScripts/PathPreferences.py @@ -251,8 +251,8 @@ def suppressAllSpeedsWarning(): return preferences().GetBool(WarningSuppressAllSpeeds, True) -def suppressRapidSpeedsWarning(): - return suppressAllSpeedsWarning() or preferences().GetBool(WarningSuppressRapidSpeeds, True) +def suppressRapidSpeedsWarning(user=True): + return (user and suppressAllSpeedsWarning()) or preferences().GetBool(WarningSuppressRapidSpeeds, True) def suppressSelectionModeWarning(): @@ -262,6 +262,12 @@ def suppressSelectionModeWarning(): def suppressOpenCamLibWarning(): return preferences().GetBool(WarningSuppressOpenCamLib, True) +def setPreferencesAdvanced(experimental, warnSpeeds, warnRapids, warnModes, warnOCL): + preferences().SetBool(EnableExperimentalFeatures, experimental) + preferences().SetBool(WarningSuppressAllSpeeds, warnSpeeds) + preferences().SetBool(WarningSuppressRapidSpeeds, warnRapids) + preferences().SetBool(WarningSuppressSelectionMode, warnModes) + preferences().SetBool(WarningSuppressOpenCamLib, warnOCL) def lastFileToolLibrary(): filename = preferences().GetString(LastFileToolLibrary) diff --git a/src/Mod/Path/PathScripts/PathPreferencesAdvanced.py b/src/Mod/Path/PathScripts/PathPreferencesAdvanced.py new file mode 100644 index 0000000000..49679aa1bd --- /dev/null +++ b/src/Mod/Path/PathScripts/PathPreferencesAdvanced.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +# *************************************************************************** +# * Copyright (c) 2021 sliptonic * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * This program is distributed in the hope that it will be useful, * +# * but WITHOUT ANY WARRANTY; without even the implied warranty of * +# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +# * GNU Library General Public License for more details. * +# * * +# * You should have received a copy of the GNU Library General Public * +# * License along with this program; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# *************************************************************************** + +import FreeCADGui +import PathScripts.PathPreferences as PathPreferences +import PySide + +# Qt translation handling +def translate(context, text, disambig=None): + return PySide.QtCore.QCoreApplication.translate(context, text, disambig) + +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) + + def saveSettings(self): + PathPreferences.setPreferencesAdvanced( + self.form.EnableExperimentalFeatures.isChecked(), + self.form.WarningSuppressAllSpeeds.isChecked(), + self.form.WarningSuppressRapidSpeeds.isChecked(), + self.form.WarningSuppressSelectionMode.isChecked(), + self.form.WarningSuppressOpenCamLib.isChecked()) + + 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.WarningSuppressOpenCamLib.setChecked(PathPreferences.suppressOpenCamLibWarning()) + self.updateSelection() + + def updateSelection(self, state=None): + self.form.WarningSuppressOpenCamLib.setEnabled(self.form.EnableExperimentalFeatures.isChecked()) + if self.form.WarningSuppressAllSpeeds.isChecked(): + self.form.WarningSuppressRapidSpeeds.setChecked(True) + self.form.WarningSuppressRapidSpeeds.setEnabled(False) + else: + self.form.WarningSuppressRapidSpeeds.setEnabled(True) +