Merge pull request #4387 from mlampert/feature/add-experimental-features-to-preferences
[Path]: Expose experimental feature flag in preferences - with warning.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>512</width>
|
||||
<height>691</height>
|
||||
<height>573</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -436,7 +436,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<item row="2" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -449,72 +449,6 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Warnings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="WarningSuppressAllSpeeds">
|
||||
<property name="toolTip">
|
||||
<string>Suppress all warnings about setting speed rates for accurate cycle time calculation</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Suppress all missing speeds warning</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>WarningSuppressAllSpeeds</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Path</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="WarningSuppressRapidSpeeds">
|
||||
<property name="toolTip">
|
||||
<string>Suppress warning about setting the rapid speed rates for accurate cycle time calculation. Ignored if all speed warnings are already suppressed.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Suppress missing rapid speeds warning</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>WarningSuppressRapidSpeeds</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Path</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="WarningSuppressSelectionMode">
|
||||
<property name="toolTip">
|
||||
<string>Suppress warning whenever a Path selection mode is activated</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Suppress selection mode warning</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>WarningSuppressSelectionMode</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Path</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
@@ -538,11 +472,6 @@
|
||||
<extends>QComboBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::PrefCheckBox</class>
|
||||
<extends>QCheckBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>DefaultNormalPathColor</tabstop>
|
||||
|
||||
@@ -132,6 +132,7 @@
|
||||
<file>panels/ToolLibraryEditor.ui</file>
|
||||
<file>panels/TaskPathSimulator.ui</file>
|
||||
<file>panels/ZCorrectEdit.ui</file>
|
||||
<file>preferences/Advanced.ui</file>
|
||||
<file>preferences/PathDressupHoldingTags.ui</file>
|
||||
<file>preferences/PathJob.ui</file>
|
||||
<file>translations/Path_af.qm</file>
|
||||
|
||||
184
src/Mod/Path/Gui/Resources/preferences/Advanced.ui
Normal file
184
src/Mod/Path/Gui/Resources/preferences/Advanced.ui
Normal file
@@ -0,0 +1,184 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PathGui::DlgSettingsPathColor</class>
|
||||
<widget class="QWidget" name="PathGui::DlgSettingsPathColor">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>512</width>
|
||||
<height>691</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Advanced</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Warnings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="WarningSuppressAllSpeeds">
|
||||
<property name="toolTip">
|
||||
<string>Suppress all warnings about setting speed rates for accurate cycle time calculation</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Suppress all missing speeds warning</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>WarningSuppressAllSpeeds</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Path</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="WarningSuppressRapidSpeeds">
|
||||
<property name="toolTip">
|
||||
<string>Suppress warning about setting the rapid speed rates for accurate cycle time calculation. Ignored if all speed warnings are already suppressed.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Suppress missing rapid speeds warning</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>WarningSuppressRapidSpeeds</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Path</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="WarningSuppressSelectionMode">
|
||||
<property name="toolTip">
|
||||
<string>Suppress warning whenever a Path selection mode is activated</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Suppress selection mode warning</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>WarningSuppressSelectionMode</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Path</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Open CAMlib</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!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;">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></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="EnableAdvancedOCLFeatures">
|
||||
<property name="text">
|
||||
<string>Enable OCL dependent features</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>EnableAdvancedOCLFeatures</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Path</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="WarningSuppressOpenCamLib">
|
||||
<property name="toolTip">
|
||||
<string>Suppress warning if openCAMlib cannot be found</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Suppress openCAMlib warning</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>WarningSuppressOpenCamLib</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Path</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>217</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Gui::PrefCheckBox</class>
|
||||
<extends>QCheckBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -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
|
||||
@@ -164,6 +165,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):
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -251,8 +256,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 +267,12 @@ def suppressSelectionModeWarning():
|
||||
def suppressOpenCamLibWarning():
|
||||
return preferences().GetBool(WarningSuppressOpenCamLib, True)
|
||||
|
||||
def setPreferencesAdvanced(ocl, warnSpeeds, warnRapids, warnModes, warnOCL):
|
||||
preferences().SetBool(EnableAdvancedOCLFeatures, ocl)
|
||||
preferences().SetBool(WarningSuppressAllSpeeds, warnSpeeds)
|
||||
preferences().SetBool(WarningSuppressRapidSpeeds, warnRapids)
|
||||
preferences().SetBool(WarningSuppressSelectionMode, warnModes)
|
||||
preferences().SetBool(WarningSuppressOpenCamLib, warnOCL)
|
||||
|
||||
def lastFileToolLibrary():
|
||||
filename = preferences().GetString(LastFileToolLibrary)
|
||||
|
||||
60
src/Mod/Path/PathScripts/PathPreferencesAdvanced.py
Normal file
60
src/Mod/Path/PathScripts/PathPreferencesAdvanced.py
Normal file
@@ -0,0 +1,60 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# ***************************************************************************
|
||||
# * Copyright (c) 2021 sliptonic <shopinthewoods@gmail.com> *
|
||||
# * *
|
||||
# * 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.EnableAdvancedOCLFeatures.stateChanged.connect(self.updateSelection)
|
||||
|
||||
def saveSettings(self):
|
||||
PathPreferences.setPreferencesAdvanced(
|
||||
self.form.EnableAdvancedOCLFeatures.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.EnableAdvancedOCLFeatures.setChecked(PathPreferences.advancedOCLFeaturesEnabled())
|
||||
self.form.WarningSuppressOpenCamLib.setChecked(PathPreferences.suppressOpenCamLibWarning())
|
||||
self.updateSelection()
|
||||
|
||||
def updateSelection(self, state=None):
|
||||
self.form.WarningSuppressOpenCamLib.setEnabled(self.form.EnableAdvancedOCLFeatures.isChecked())
|
||||
if self.form.WarningSuppressAllSpeeds.isChecked():
|
||||
self.form.WarningSuppressRapidSpeeds.setChecked(True)
|
||||
self.form.WarningSuppressRapidSpeeds.setEnabled(False)
|
||||
else:
|
||||
self.form.WarningSuppressRapidSpeeds.setEnabled(True)
|
||||
|
||||
Reference in New Issue
Block a user