Skip to content

Commit

Permalink
Add toolcontroller to open operation
Browse files Browse the repository at this point in the history
  • Loading branch information
sliptonic committed Nov 16, 2020
1 parent 2da3308 commit f2eaa98
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/Mod/Path/PathScripts/PathJob.py
Expand Up @@ -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"))
Expand Down Expand Up @@ -147,6 +155,7 @@ def __init__(self, obj, models, templateFile=None):
self.tooltip = None
self.tooltipArgs = None


obj.Proxy = self

self.setFromTemplateFile(obj, templateFile)
Expand Down Expand Up @@ -261,6 +270,7 @@ def onDocumentRestored(self, obj):
self.setupBaseModel(obj)
self.fixupOperations(obj)
self.setupSetupSheet(obj)

obj.setEditorMode('Operations', 2) # hide
obj.setEditorMode('Placement', 2)

Expand Down Expand Up @@ -413,6 +423,7 @@ def addToolController(self, tc):
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 = []
Expand Down
9 changes: 9 additions & 0 deletions src/Mod/Path/PathScripts/PathOpGui.py
Expand Up @@ -25,6 +25,7 @@
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
Expand Down Expand Up @@ -211,6 +212,9 @@ def __init__(self, obj, features):
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.'''
Expand Down Expand Up @@ -361,6 +365,11 @@ def selectInComboBox(self, name, combo):
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
Expand Down
5 changes: 3 additions & 2 deletions src/Mod/Path/PathScripts/PathProfileGui.py
Expand Up @@ -38,6 +38,7 @@
FeatureSide = 0x01
FeatureProcessing = 0x02


def translate(context, text, disambig=None):
return QtCore.QCoreApplication.translate(context, text, disambig)

Expand Down Expand Up @@ -127,8 +128,8 @@ def getSignalsForUpdate(self, obj):

def updateVisibility(self):
hasFace = False
hasGeom = False
fullModel = False
# hasGeom = False
# fullModel = False
objBase = list()

if hasattr(self.obj, 'Base'):
Expand Down

0 comments on commit f2eaa98

Please sign in to comment.