From 63095755917ba199a4ace3dd19e77d8c48a8200e Mon Sep 17 00:00:00 2001 From: sliptonic Date: Tue, 15 Mar 2022 10:58:11 -0500 Subject: [PATCH] [Path] Warn user if enabling legacy tools Warn user if opening job that contains legacy tools --- src/Mod/Path/PathScripts/PathJob.py | 13 +++++++++++-- src/Mod/Path/PathScripts/PathPreferences.py | 13 +++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathJob.py b/src/Mod/Path/PathScripts/PathJob.py index 77bdfa3e22..df171a3a5e 100644 --- a/src/Mod/Path/PathScripts/PathJob.py +++ b/src/Mod/Path/PathScripts/PathJob.py @@ -32,6 +32,7 @@ import PathScripts.PathToolController as PathToolController import PathScripts.PathUtil as PathUtil import json import time +import Path # lazily loaded modules @@ -284,7 +285,7 @@ class ObjectJob: # ops = FreeCAD.ActiveDocument.addObject( # "Path::FeatureCompoundPython", "Operations" # ) - ops = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroup","Operations") + ops = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroup", "Operations") if ops.ViewObject: # ops.ViewObject.Proxy = 0 ops.ViewObject.Visibility = True @@ -544,6 +545,14 @@ class ObjectJob: for n in self.propertyEnumerations(): setattr(obj, n[0], n[1]) + if True in [isinstance(t.Tool, Path.Tool) for t in obj.Tools.Group]: + FreeCAD.Console.PrintWarning( + translate( + "Path", + "This job contains Legacy tools. Legacy tools are deprecated. They will be removed after version 0.20", + ) + ) + def onChanged(self, obj, prop): if prop == "PostProcessor" and obj.PostProcessor: processor = PostProcessor.load(obj.PostProcessor) @@ -659,7 +668,7 @@ class ObjectJob: def execute(self, obj): if getattr(obj, "Operations", None): - #obj.Path = obj.Operations.Path + # obj.Path = obj.Operations.Path self.getCycleTime() def getCycleTime(self): diff --git a/src/Mod/Path/PathScripts/PathPreferences.py b/src/Mod/Path/PathScripts/PathPreferences.py index ac846c7629..5148b7cbbd 100644 --- a/src/Mod/Path/PathScripts/PathPreferences.py +++ b/src/Mod/Path/PathScripts/PathPreferences.py @@ -24,6 +24,7 @@ import FreeCAD import glob import os import PathScripts.PathLog as PathLog +from PySide.QtGui import QMessageBox if False: PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) @@ -31,6 +32,8 @@ if False: else: PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +translate = FreeCAD.Qt.translate + DefaultFilePath = "DefaultFilePath" DefaultJobTemplate = "DefaultJobTemplate" DefaultStockTemplate = "DefaultStockTemplate" @@ -182,6 +185,16 @@ def toolsStoreAbsolutePaths(): def setToolsSettings(legacy, relative): pref = preferences() + if legacy: + msgBox = QMessageBox() + msgBox.setIcon(QMessageBox.Warning) + msgBox.setText( + translate( + "Path", + "Legacy tools are deprecated. They will be removed after version 0.20", + ) + ) + msgBox.exec_() pref.SetBool(UseLegacyTools, legacy) pref.SetBool(UseAbsoluteToolPaths, relative) # pref.SetBool(OpenLastLibrary, lastlibrary)