From eb9cd1e7dadd7c21a59c08660ebed6ed33ceb84a Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Sun, 13 Dec 2020 22:03:21 -0800 Subject: [PATCH] Preference setting so suppress logging the selection mode as a warning. --- src/Mod/Path/Gui/DlgSettingsPathColor.cpp | 2 + src/Mod/Path/Gui/DlgSettingsPathColor.ui | 16 +++++++ src/Mod/Path/PathScripts/PathPreferences.py | 4 ++ src/Mod/Path/PathScripts/PathSelection.py | 49 ++++++++++++++------- 4 files changed, 55 insertions(+), 16 deletions(-) diff --git a/src/Mod/Path/Gui/DlgSettingsPathColor.cpp b/src/Mod/Path/Gui/DlgSettingsPathColor.cpp index b68ed7de28..282018c81a 100644 --- a/src/Mod/Path/Gui/DlgSettingsPathColor.cpp +++ b/src/Mod/Path/Gui/DlgSettingsPathColor.cpp @@ -68,6 +68,7 @@ void DlgSettingsPathColor::saveSettings() ui->DefaultSelectionStyle->onSave(); ui->DefaultTaskPanelLayout->onSave(); ui->WarningSuppressRapidSpeeds->onSave(); + ui->WarningSuppressSelectionMode->onSave(); } void DlgSettingsPathColor::loadSettings() @@ -85,6 +86,7 @@ void DlgSettingsPathColor::loadSettings() ui->DefaultSelectionStyle->onRestore(); ui->DefaultTaskPanelLayout->onRestore(); ui->WarningSuppressRapidSpeeds->onRestore(); + ui->WarningSuppressSelectionMode->onRestore(); } /** diff --git a/src/Mod/Path/Gui/DlgSettingsPathColor.ui b/src/Mod/Path/Gui/DlgSettingsPathColor.ui index ecfbcc1882..9f0e630295 100644 --- a/src/Mod/Path/Gui/DlgSettingsPathColor.ui +++ b/src/Mod/Path/Gui/DlgSettingsPathColor.ui @@ -471,6 +471,22 @@ + + + + Suppress warning whenever a Path selection mode is activated + + + Suppress selection mode warning + + + WarningSuppressSelectionMode + + + Mod/Path + + + diff --git a/src/Mod/Path/PathScripts/PathPreferences.py b/src/Mod/Path/PathScripts/PathPreferences.py index d41326ae30..f750016372 100644 --- a/src/Mod/Path/PathScripts/PathPreferences.py +++ b/src/Mod/Path/PathScripts/PathPreferences.py @@ -58,6 +58,7 @@ GeometryTolerance = "GeometryTolerance" LibAreaCurveAccuracy = "LibAreaCurveAccuarcy" WarningSuppressRapidSpeeds = "WarningSuppressRapidSpeeds" +WarningSuppressSelectionMode = "WarningSuppressSelectionMode" EnableExperimentalFeatures = "EnableExperimentalFeatures" @@ -263,6 +264,9 @@ def experimentalFeaturesEnabled(): def suppressRapidSpeedsWarning(): return preferences().GetBool(WarningSuppressRapidSpeeds, False) +def suppressSelectionModeWarning(): + return preferences().GetBool(WarningSuppressSelectionMode, False) + def lastFileToolLibrary(): filename = preferences().GetString(LastFileToolLibrary) diff --git a/src/Mod/Path/PathScripts/PathSelection.py b/src/Mod/Path/PathScripts/PathSelection.py index 11a75b31a1..055bfb1757 100644 --- a/src/Mod/Path/PathScripts/PathSelection.py +++ b/src/Mod/Path/PathScripts/PathSelection.py @@ -25,6 +25,7 @@ import FreeCAD import FreeCADGui import PathScripts.PathLog as PathLog +import PathScripts.PathPreferences as PathPreferences import PathScripts.PathUtils as PathUtils import math @@ -286,52 +287,62 @@ class ALLGate(PathBaseGate): def contourselect(): FreeCADGui.Selection.addSelectionGate(CONTOURGate()) - FreeCAD.Console.PrintWarning("Contour Select Mode\n") + if not PathPreferences.suppressSelectionModeWarning(): + FreeCAD.Console.PrintWarning("Contour Select Mode\n") def eselect(): FreeCADGui.Selection.addSelectionGate(EGate()) - FreeCAD.Console.PrintWarning("Edge Select Mode\n") + if not PathPreferences.suppressSelectionModeWarning(): + FreeCAD.Console.PrintWarning("Edge Select Mode\n") def drillselect(): FreeCADGui.Selection.addSelectionGate(DRILLGate()) - FreeCAD.Console.PrintWarning("Drilling Select Mode\n") + if not PathPreferences.suppressSelectionModeWarning(): + FreeCAD.Console.PrintWarning("Drilling Select Mode\n") def engraveselect(): FreeCADGui.Selection.addSelectionGate(ENGRAVEGate()) - FreeCAD.Console.PrintWarning("Engraving Select Mode\n") + if not PathPreferences.suppressSelectionModeWarning(): + FreeCAD.Console.PrintWarning("Engraving Select Mode\n") def fselect(): FreeCADGui.Selection.addSelectionGate(FACEGate()) # Was PROFILEGate() - FreeCAD.Console.PrintWarning("Profiling Select Mode\n") + if not PathPreferences.suppressSelectionModeWarning(): + FreeCAD.Console.PrintWarning("Profiling Select Mode\n") def chamferselect(): FreeCADGui.Selection.addSelectionGate(CHAMFERGate()) - FreeCAD.Console.PrintWarning("Deburr Select Mode\n") + if not PathPreferences.suppressSelectionModeWarning(): + FreeCAD.Console.PrintWarning("Deburr Select Mode\n") def profileselect(): FreeCADGui.Selection.addSelectionGate(PROFILEGate()) - FreeCAD.Console.PrintWarning("Profiling Select Mode\n") + if not PathPreferences.suppressSelectionModeWarning(): + FreeCAD.Console.PrintWarning("Profiling Select Mode\n") def pocketselect(): FreeCADGui.Selection.addSelectionGate(POCKETGate()) - FreeCAD.Console.PrintWarning("Pocketing Select Mode\n") + if not PathPreferences.suppressSelectionModeWarning(): + FreeCAD.Console.PrintWarning("Pocketing Select Mode\n") def adaptiveselect(): FreeCADGui.Selection.addSelectionGate(ADAPTIVEGate()) - FreeCAD.Console.PrintWarning("Adaptive Select Mode\n") + if not PathPreferences.suppressSelectionModeWarning(): + FreeCAD.Console.PrintWarning("Adaptive Select Mode\n") def slotselect(): FreeCADGui.Selection.addSelectionGate(ALLGate()) - FreeCAD.Console.PrintWarning("Slot Cutter Select Mode\n") + if not PathPreferences.suppressSelectionModeWarning(): + FreeCAD.Console.PrintWarning("Slot Cutter Select Mode\n") def surfaceselect(): @@ -339,26 +350,31 @@ def surfaceselect(): if(MESHGate() or FACEGate()): gate = True FreeCADGui.Selection.addSelectionGate(gate) - FreeCAD.Console.PrintWarning("Surfacing Select Mode\n") + if not PathPreferences.suppressSelectionModeWarning(): + FreeCAD.Console.PrintWarning("Surfacing Select Mode\n") def vcarveselect(): FreeCADGui.Selection.addSelectionGate(VCARVEGate()) - FreeCAD.Console.PrintWarning("Vcarve Select Mode\n") + if not PathPreferences.suppressSelectionModeWarning(): + FreeCAD.Console.PrintWarning("Vcarve Select Mode\n") def probeselect(): FreeCADGui.Selection.addSelectionGate(PROBEGate()) - FreeCAD.Console.PrintWarning("Probe Select Mode\n") + if not PathPreferences.suppressSelectionModeWarning(): + FreeCAD.Console.PrintWarning("Probe Select Mode\n") def customselect(): - FreeCAD.Console.PrintWarning("Custom Select Mode\n") + if not PathPreferences.suppressSelectionModeWarning(): + FreeCAD.Console.PrintWarning("Custom Select Mode\n") def turnselect(): FreeCADGui.Selection.addSelectionGate(TURNGate()) - FreeCAD.Console.PrintWarning("Turning Select Mode\n") + if not PathPreferences.suppressSelectionModeWarning(): + FreeCAD.Console.PrintWarning("Turning Select Mode\n") def select(op): @@ -392,4 +408,5 @@ def select(op): def clear(): FreeCADGui.Selection.removeSelectionGate() - FreeCAD.Console.PrintWarning("Free Select\n") + if not PathPreferences.suppressSelectionModeWarning(): + FreeCAD.Console.PrintWarning("Free Select\n")