Added job export dialog to Job Editor.
This commit is contained in:
@@ -135,7 +135,20 @@ class DlgJobTemplateExport:
|
||||
def __init__(self, job, parent=None):
|
||||
self.job = job
|
||||
self.dialog = FreeCADGui.PySideUic.loadUi(":/panels/DlgJobTemplateExport.ui")
|
||||
if parent:
|
||||
self.dialog.setParent(parent)
|
||||
parent.layout().addWidget(self.dialog)
|
||||
self.dialog.dialogButtonBox.hide()
|
||||
else:
|
||||
self.dialog.exportButtonBox.hide()
|
||||
self.updateUI()
|
||||
self.dialog.toolsGroup.clicked.connect(self.checkUncheckTools)
|
||||
|
||||
def exportButton(self):
|
||||
return self.dialog.exportButton
|
||||
|
||||
def updateUI(self):
|
||||
job = self.job
|
||||
if job.PostProcessor:
|
||||
ppHint = "%s %s %s" % (job.PostProcessor, job.PostProcessorArgs, job.PostProcessorOutputFile)
|
||||
self.dialog.postProcessingHint.setText(ppHint)
|
||||
@@ -168,19 +181,20 @@ class DlgJobTemplateExport:
|
||||
self.dialog.settingToolRapid.setChecked(rapidChanged)
|
||||
self.dialog.settingOperationDepths.setChecked(depthsChanged)
|
||||
self.dialog.settingOperationHeights.setChecked(heightsChanged)
|
||||
|
||||
self.dialog.settingsOpsList.clear()
|
||||
for op in opsWithSettings:
|
||||
item = QtGui.QListWidgetItem(op)
|
||||
item.setCheckState(QtCore.Qt.CheckState.Checked)
|
||||
self.dialog.settingsOpsList.addItem(item)
|
||||
|
||||
self.dialog.toolsList.clear()
|
||||
for tc in sorted(job.ToolController, key=lambda o: o.Label):
|
||||
item = QtGui.QListWidgetItem(tc.Label)
|
||||
item.setData(self.DataObject, tc)
|
||||
item.setCheckState(QtCore.Qt.CheckState.Checked)
|
||||
self.dialog.toolsList.addItem(item)
|
||||
|
||||
self.dialog.toolsGroup.clicked.connect(self.checkUncheckTools)
|
||||
|
||||
def checkUncheckTools(self):
|
||||
state = QtCore.Qt.CheckState.Checked if self.dialog.toolsGroup.isChecked() else QtCore.Qt.CheckState.Unchecked
|
||||
for i in range(self.dialog.toolsList.count()):
|
||||
@@ -260,12 +274,16 @@ class CommandJobTemplateExport:
|
||||
job = self.GetJob()
|
||||
dialog = DlgJobTemplateExport(job)
|
||||
if dialog.exec_() == 1:
|
||||
foo = QtGui.QFileDialog.getSaveFileName(QtGui.QApplication.activeWindow(),
|
||||
"Path - Job Template",
|
||||
PathPreferences.filePath(),
|
||||
"job_*.json")[0]
|
||||
if foo:
|
||||
self.Execute(job, foo, dialog)
|
||||
self.SaveDialog(job, dialog)
|
||||
|
||||
@classmethod
|
||||
def SaveDialog(cls, job, dialog):
|
||||
foo = QtGui.QFileDialog.getSaveFileName(QtGui.QApplication.activeWindow(),
|
||||
"Path - Job Template",
|
||||
PathPreferences.filePath(),
|
||||
"job_*.json")[0]
|
||||
if foo:
|
||||
cls.Execute(job, foo, dialog)
|
||||
|
||||
@classmethod
|
||||
def Execute(cls, job, path, dialog=None):
|
||||
|
||||
Reference in New Issue
Block a user