Add toolcontroller to open operation
This commit is contained in:
@@ -94,8 +94,16 @@ def createModelResourceClone(obj, orig):
|
||||
return createResourceClone(obj, orig, 'Model', 'BaseGeometry')
|
||||
|
||||
|
||||
class NotificationClass(QtCore.QObject):
|
||||
updateTC = QtCore.Signal(object, object)
|
||||
|
||||
|
||||
Notification = NotificationClass()
|
||||
|
||||
|
||||
class ObjectJob:
|
||||
|
||||
|
||||
def __init__(self, obj, models, templateFile=None):
|
||||
self.obj = obj
|
||||
obj.addProperty("App::PropertyFile", "PostProcessorOutputFile", "Output", QtCore.QT_TRANSLATE_NOOP("PathJob", "The NC output file for this project"))
|
||||
@@ -147,6 +155,7 @@ class ObjectJob:
|
||||
self.tooltip = None
|
||||
self.tooltipArgs = None
|
||||
|
||||
|
||||
obj.Proxy = self
|
||||
|
||||
self.setFromTemplateFile(obj, templateFile)
|
||||
@@ -261,6 +270,7 @@ class ObjectJob:
|
||||
self.setupBaseModel(obj)
|
||||
self.fixupOperations(obj)
|
||||
self.setupSetupSheet(obj)
|
||||
|
||||
obj.setEditorMode('Operations', 2) # hide
|
||||
obj.setEditorMode('Placement', 2)
|
||||
|
||||
@@ -413,6 +423,7 @@ class ObjectJob:
|
||||
tc.setExpression('HorizRapid', "%s.%s" % (self.setupSheet.expressionReference(), PathSetupSheet.Template.HorizRapid))
|
||||
group.append(tc)
|
||||
self.obj.ToolController = group
|
||||
Notification.updateTC.emit(self.obj, tc)
|
||||
|
||||
def allOperations(self):
|
||||
ops = []
|
||||
|
||||
@@ -25,6 +25,7 @@ import FreeCADGui
|
||||
import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathGetPoint as PathGetPoint
|
||||
import PathScripts.PathGui as PathGui
|
||||
import PathScripts.PathJob as PathJob
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOp as PathOp
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
@@ -211,6 +212,9 @@ class TaskPanelPage(object):
|
||||
self.parent = None
|
||||
self.panelTitle = 'Operation'
|
||||
|
||||
if hasattr(self.form, 'toolController'):
|
||||
PathJob.Notification.updateTC.connect(self.resetToolController)
|
||||
|
||||
def setParent(self, parent):
|
||||
'''setParent() ... used to transfer parent object link to child class.
|
||||
Do not overwrite.'''
|
||||
@@ -361,6 +365,11 @@ class TaskPanelPage(object):
|
||||
combo.setCurrentIndex(index)
|
||||
combo.blockSignals(False)
|
||||
|
||||
def resetToolController(self, job, tc):
|
||||
self.obj.ToolController = tc
|
||||
combo = self.form.toolController
|
||||
self.setupToolController(self.obj, combo)
|
||||
|
||||
def setupToolController(self, obj, combo):
|
||||
'''setupToolController(obj, combo) ...
|
||||
helper function to setup obj's ToolController
|
||||
|
||||
@@ -38,6 +38,7 @@ __doc__ = "Profile operation page controller and command implementation."
|
||||
FeatureSide = 0x01
|
||||
FeatureProcessing = 0x02
|
||||
|
||||
|
||||
def translate(context, text, disambig=None):
|
||||
return QtCore.QCoreApplication.translate(context, text, disambig)
|
||||
|
||||
@@ -127,8 +128,8 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
|
||||
|
||||
def updateVisibility(self):
|
||||
hasFace = False
|
||||
hasGeom = False
|
||||
fullModel = False
|
||||
# hasGeom = False
|
||||
# fullModel = False
|
||||
objBase = list()
|
||||
|
||||
if hasattr(self.obj, 'Base'):
|
||||
|
||||
Reference in New Issue
Block a user