Path: Allow GUI Job creation without task panel interaction

These changes allow for a Job object to be created with view provider support, but without the initial task panel interaction at creation.

This is useful for scripting and other internal Job creation tasks.
This commit is contained in:
Russell Johnson
2022-03-26 09:53:55 -05:00
parent 54ef47276f
commit b1e4864910

View File

@@ -1631,7 +1631,7 @@ class TaskPanel:
self.updateSelection()
def Create(base, template=None):
def Create(base, template=None, openTaskPanel=True):
"""Create(base, template) ... creates a job instance for the given base object
using template to configure it."""
FreeCADGui.addModule("PathScripts.PathJob")
@@ -1642,7 +1642,10 @@ def Create(base, template=None):
obj.ViewObject.addExtension("Gui::ViewProviderGroupExtensionPython")
FreeCAD.ActiveDocument.commitTransaction()
obj.Document.recompute()
obj.ViewObject.Proxy.editObject(obj.Stock)
if openTaskPanel:
obj.ViewObject.Proxy.editObject(obj.Stock)
else:
obj.ViewObject.Proxy.deleteOnReject = False
return obj
except Exception as exc:
PathLog.error(exc)