Added moving an operation up/down the list buttons.

This commit is contained in:
Markus Lampert
2017-09-08 12:25:58 +02:00
committed by wmayer
parent 8f77c7575f
commit af4bac8abf
2 changed files with 161 additions and 263 deletions
+135 -263
View File
@@ -14,7 +14,7 @@
<string>Job Edit</string>
</property>
<property name="currentIndex">
<number>1</number>
<number>2</number>
</property>
<widget class="QWidget" name="tabGeneral">
<attribute name="title">
@@ -24,15 +24,15 @@
<item>
<widget class="QToolBox" name="tbGeneral">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="page">
<widget class="QWidget" name="pageInfo">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>242</width>
<height>129</height>
<width>378</width>
<height>793</height>
</rect>
</property>
<attribute name="label">
@@ -81,122 +81,65 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>294</width>
<height>309</height>
</rect>
</property>
<widget class="QWidget" name="pagePostProcessor">
<attribute name="label">
<string>Template</string>
<string>Post Processing</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="templateGeneral">
<property name="title">
<string>General</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="1">
<widget class="QCheckBox" name="templateMaterial">
<property name="text">
<string>Material</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="templateSetup">
<property name="title">
<string>Setup</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QCheckBox" name="templateStock">
<property name="text">
<string>Stock</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="templatePostProcessor">
<property name="text">
<string>Post Processor</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="templateTools">
<property name="title">
<string>Tools</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3"/>
</widget>
</item>
<item>
<widget class="QGroupBox" name="templateOperations">
<property name="title">
<string>Operations</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QCheckBox" name="templateDefaultValues">
<property name="text">
<string>Default Values</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Save</set>
<layout class="QGridLayout" name="gridLayout_16">
<item row="0" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Output File</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<item row="0" column="1">
<widget class="QLineEdit" name="postProcessorOutputFile">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter a path and optionally file name (see below) to be used as the default for the post processor export.&lt;/p&gt;&lt;p&gt;The following substitutions are performed before the name is resolved at the time of the post processing:&lt;/p&gt;&lt;p&gt;%D ... directory of the active document&lt;br/&gt;%d ... name of the active document (with extension)&lt;br/&gt;%M ... user macro directory&lt;br/&gt;%j ... name of the active Job object&lt;/p&gt;&lt;p&gt;The following example store all files with the same name as the document the directory /home/freecad (please remove quotes):&lt;/p&gt;&lt;p&gt;&amp;quot;/home/cnc/%d.g-code&amp;quot;&lt;/p&gt;&lt;p&gt;See the file save policy below on how to deal with name conflicts.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="postProcessorSetOutputFile">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Processor</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="postProcessor"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Arguments</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="postProcessorArguments">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Optional arguments passed to the Post Processor. The arguments are specific for each Post Processor, please see it's documentation for details.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
<height>655</height>
</size>
</property>
</spacer>
@@ -220,13 +163,13 @@
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page_3">
<widget class="QWidget" name="pageLayout">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>378</width>
<height>719</height>
<height>830</height>
</rect>
</property>
<attribute name="label">
@@ -490,150 +433,27 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="page_6">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>233</width>
<height>135</height>
</rect>
</property>
<attribute name="label">
<string>Post Processor</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="postProcessor"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Processor</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Output File</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="postProcessorOutputFile">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter a path and optionally file name (see below) to be used as the default for the post processor export.&lt;/p&gt;&lt;p&gt;The following substitutions are performed before the name is resolved at the time of the post processing:&lt;/p&gt;&lt;p&gt;%D ... directory of the active document&lt;br/&gt;%d ... name of the active document (with extension)&lt;br/&gt;%M ... user macro directory&lt;br/&gt;%j ... name of the active Job object&lt;/p&gt;&lt;p&gt;The following example store all files with the same name as the document the directory /home/freecad (please remove quotes):&lt;/p&gt;&lt;p&gt;&amp;quot;/home/cnc/%d.g-code&amp;quot;&lt;/p&gt;&lt;p&gt;See the file save policy below on how to deal with name conflicts.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="postProcessorArguments">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Optional arguments passed to the Post Processor. The arguments are specific for each Post Processor, please see it's documentation for details.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Arguments</string>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="postProcessorSetOutputFile">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_4">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>142</width>
<height>41</height>
</rect>
</property>
<attribute name="label">
<string>Fixtures</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_12">
<item alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="QLabel" name="label_12">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Coming Soon</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_5">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>142</width>
<height>41</height>
</rect>
</property>
<attribute name="label">
<string>Vise</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_13">
<item alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="QLabel" name="label_13">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Coming Soon</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab">
<widget class="QWidget" name="tabTools">
<attribute name="title">
<string>Tools</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QToolBox" name="toolBox">
<widget class="QToolBox" name="tbTools">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page_7">
<widget class="QWidget" name="pageToolController">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>312</width>
<height>159</height>
<width>378</width>
<height>830</height>
</rect>
</property>
<attribute name="label">
@@ -721,23 +541,23 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<widget class="QWidget" name="tabWorkplan">
<attribute name="title">
<string>Workplan</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
<widget class="QToolBox" name="toolBox_2">
<widget class="QToolBox" name="tbWorkplan">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page_9">
<widget class="QWidget" name="pageOperations">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>255</width>
<height>234</height>
<width>378</width>
<height>793</height>
</rect>
</property>
<attribute name="label">
@@ -773,6 +593,61 @@
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="operationMove" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="margin">
<number>0</number>
</property>
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="operationUp">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="go-up"/>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="operationDown">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="go-down"/>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_7">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
@@ -781,14 +656,24 @@
<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>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="operationDelete">
<property name="text">
@@ -801,13 +686,13 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="page_10">
<widget class="QWidget" name="pageDefaultValues">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>395</width>
<height>430</height>
<height>778</height>
</rect>
</property>
<attribute name="label">
@@ -1003,19 +888,6 @@
<tabstop>moveToOrigin</tabstop>
<tabstop>centerInStock</tabstop>
<tabstop>centerInStockXY</tabstop>
<tabstop>postProcessorOutputFile</tabstop>
<tabstop>postProcessorSetOutputFile</tabstop>
<tabstop>postProcessor</tabstop>
<tabstop>postProcessorArguments</tabstop>
<tabstop>templateDefaultValues</tabstop>
<tabstop>templatePostProcessor</tabstop>
<tabstop>buttonBox</tabstop>
<tabstop>templateGeneral</tabstop>
<tabstop>templateMaterial</tabstop>
<tabstop>templateSetup</tabstop>
<tabstop>templateStock</tabstop>
<tabstop>templateOperations</tabstop>
<tabstop>templateTools</tabstop>
<tabstop>toolControllerList</tabstop>
<tabstop>toolControllerEdit</tabstop>
<tabstop>toolControllerAdd</tabstop>
+26
View File
@@ -565,8 +565,13 @@ class TaskPanel:
def operationSelect(self):
if self.form.operationsList.selectedItems():
self.form.operationModify.setEnabled(True)
self.form.operationMove.setEnabled(True)
row = self.form.operationsList.currentRow()
self.form.operationUp.setEnabled(row > 0)
self.form.operationDown.setEnabled(row < self.form.operationsList.count() - 1)
else:
self.form.operationModify.setEnabled(False)
self.form.operationMove.setEnabled(False)
def objectDelete(self, widget):
for item in widget.selectedItems():
@@ -579,6 +584,22 @@ class TaskPanel:
def operationDelete(self):
self.objectDelete(self.form.operationsList)
def operationMoveUp(self):
row = self.form.operationsList.currentRow()
if row > 0:
item = self.form.operationsList.takeItem(row)
self.form.operationsList.insertItem(row-1, item)
self.form.operationsList.setCurrentRow(row-1)
self.getFields()
def operationMoveDown(self):
row = self.form.operationsList.currentRow()
if row < self.form.operationsList.count() - 1:
item = self.form.operationsList.takeItem(row)
self.form.operationsList.insertItem(row+1, item)
self.form.operationsList.setCurrentRow(row+1)
self.getFields()
def toolControllerSelect(self):
def canDeleteTC(tc):
# if the TC is referenced anywhere but the job we don't want to delete it
@@ -828,10 +849,15 @@ class TaskPanel:
self.form.postProcessorOutputFile.editingFinished.connect(self.getFields)
self.form.postProcessorSetOutputFile.clicked.connect(self.setPostProcessorOutputFile)
# Workplan
self.form.operationsList.itemSelectionChanged.connect(self.operationSelect)
self.form.operationsList.indexesMoved.connect(self.getFields)
self.form.operationDelete.clicked.connect(self.operationDelete)
self.form.operationUp.clicked.connect(self.operationMoveUp)
self.form.operationDown.clicked.connect(self.operationMoveDown)
self.form.operationEdit.hide() # not supported yet
# Tool controller
self.form.toolControllerList.itemSelectionChanged.connect(self.toolControllerSelect)
self.form.toolControllerList.itemChanged.connect(self.toolControllerChanged)
self.form.toolControllerEdit.clicked.connect(self.toolControllerEdit)