Added delete operation functionality;
fixed adding to job for dressups.
This commit is contained in:
@@ -642,10 +642,13 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_5" native="true">
|
||||
<widget class="QWidget" name="operationModify" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="operationEdit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
|
||||
@@ -996,7 +996,7 @@ def Create(base, name = 'DogboneDressup'):
|
||||
obj = FreeCAD.ActiveDocument.addObject('Path::FeaturePython', 'DogboneDressup')
|
||||
dbo = ObjectDressup(obj, base)
|
||||
job = PathUtils.findParentJob(base)
|
||||
job.addOperation(obj)
|
||||
job.Proxy.addOperation(obj)
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
ViewProviderDressup(obj.ViewObject)
|
||||
@@ -1004,7 +1004,6 @@ def Create(base, name = 'DogboneDressup'):
|
||||
|
||||
obj.ToolController = base.ToolController
|
||||
dbo.setup(obj, True)
|
||||
|
||||
return obj
|
||||
|
||||
class CommandDressupDogbone:
|
||||
|
||||
@@ -968,7 +968,7 @@ def Create(baseObject, name = 'DressupTag'):
|
||||
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", "TagDressup")
|
||||
dbo = ObjectTagDressup(obj, baseObject)
|
||||
job = PathUtils.findParentJob(baseObject)
|
||||
job.addOperation(obj)
|
||||
job.Proxy.addOperation(obj)
|
||||
dbo.setup(obj, True)
|
||||
return obj
|
||||
|
||||
|
||||
@@ -563,7 +563,7 @@ class ViewProviderDressup:
|
||||
'''this makes sure that the base operation is added back to the project and visible'''
|
||||
FreeCADGui.ActiveDocument.getObject(arg1.Object.Base.Name).Visibility = True
|
||||
job = PathUtils.findParentJob(self.obj)
|
||||
job.addOperation(arg1.Object.Base)
|
||||
job.Proxy.addOperation(arg1.Object.Base)
|
||||
arg1.Object.Base = None
|
||||
return True
|
||||
|
||||
|
||||
@@ -522,7 +522,7 @@ class PathDressupTagViewProvider:
|
||||
if self.obj.Base.ViewObject:
|
||||
self.obj.Base.ViewObject.Visibility = True
|
||||
job = PathUtils.findParentJob(self.obj)
|
||||
job.addOperation(arg1.Object.Base)
|
||||
job.Proxy.addOperation(arg1.Object.Base)
|
||||
arg1.Object.Base = None
|
||||
#if self.debugDisplay():
|
||||
# self.vobj.Debug.removeObjectsFromDocument()
|
||||
|
||||
@@ -152,6 +152,10 @@ class ObjectJob:
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
for obj in FreeCAD.ActiveDocument.Objects:
|
||||
if hasattr(obj, 'Proxy') and obj.Proxy == self:
|
||||
self.obj = obj
|
||||
break
|
||||
return None
|
||||
|
||||
def execute(self, obj):
|
||||
|
||||
@@ -195,16 +195,29 @@ class TaskPanel:
|
||||
self.form.infoModel.setCurrentIndex(baseindex)
|
||||
|
||||
|
||||
def open(self):
|
||||
pass
|
||||
|
||||
def setPostProcessorOutputFile(self):
|
||||
filename = QtGui.QFileDialog.getSaveFileName(self.form, translate("Path_Job", "Select Output File"), None, translate("Path_Job", "All Files (*.*)"))
|
||||
if filename and filename[0]:
|
||||
self.obj.PostProcessorOutputFile = str(filename[0])
|
||||
self.setFields()
|
||||
|
||||
def operationSelect(self):
|
||||
if self.form.operationsList.selectedItems():
|
||||
self.form.operationModify.setEnabled(True)
|
||||
else:
|
||||
self.form.operationModify.setEnabled(False)
|
||||
|
||||
def operationDelete(self):
|
||||
for item in self.form.operationsList.selectedItems():
|
||||
obj = item.data(self.DataObject)
|
||||
if obj.ViewObject and hasattr(obj.ViewObject, 'Proxy') and hasattr(obj.ViewObject.Proxy, 'onDelete'):
|
||||
obj.ViewObject.Proxy.onDelete(obj.ViewObject, None)
|
||||
FreeCAD.ActiveDocument.removeObject(obj.Name)
|
||||
self.setFields()
|
||||
|
||||
def setupUi(self):
|
||||
self.setFields()
|
||||
|
||||
# Info
|
||||
self.form.infoLabel.editingFinished.connect(self.getFields)
|
||||
self.form.infoModel.currentIndexChanged.connect(self.getFields)
|
||||
@@ -215,9 +228,11 @@ class TaskPanel:
|
||||
self.form.postProcessorOutputFile.editingFinished.connect(self.getFields)
|
||||
self.form.postProcessorSetOutputFile.clicked.connect(self.setPostProcessorOutputFile)
|
||||
|
||||
self.form.operationsList.itemSelectionChanged.connect(self.operationSelect)
|
||||
self.form.operationsList.indexesMoved.connect(self.getFields)
|
||||
self.form.operationDelete.clicked.connect(self.operationDelete)
|
||||
|
||||
self.setFields()
|
||||
self.operationSelect()
|
||||
|
||||
def Create(base, template=None):
|
||||
'''Create(base, template) ... creates a job instance for the given base object
|
||||
|
||||
Reference in New Issue
Block a user