Added 'Advanced' preferences page, moved warning suppression there and experimental feature support.

This commit is contained in:
Markus Lampert
2021-02-06 18:48:24 -08:00
parent 815333c68e
commit 6d3ff49aba
8 changed files with 260 additions and 81 deletions

View File

@@ -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

View File

@@ -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();
}
/**

View File

@@ -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>

View File

@@ -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>

View File

@@ -0,0 +1,185 @@
<?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>Experimental Features</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>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&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>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="EnableExperimentalFeatures">
<property name="text">
<string>Enable Experimental Features</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>EnableExperimentalFeatures</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>

View File

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

View File

@@ -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)

View 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.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)