Moved GetPoint dialog to replace the add+remove+edit section and leave the list of locations visible - much better user experience
This commit is contained in:
committed by
Yorik van Havre
parent
b3e834f7bf
commit
de4ffbb14d
@@ -7,87 +7,83 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>415</width>
|
||||
<height>573</height>
|
||||
<height>430</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QTableWidget" name="baseList">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>List of locations to be processed.</p></body></html></string>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>X</string>
|
||||
<widget class="QTableWidget" name="baseList">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>List of locations to be processed.</p></body></html></string>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>X</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Y</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="addRemoveEdit" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="removeLocation">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Remove selected location from the list. The operation is no longer applied to them.</p></body></html></string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Y</string>
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="editLocation">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Edit selected location.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>All locations will be processed using the same operation properties.</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::AutoText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="removeLocation">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Remove selected location from the list. The operation is no longer applied to them.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="addLocation">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Opens a newe dialog that lets you add arbitrary locations.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="editLocation">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Edit selected location.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="addLocation">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Opens a dialog to add arbitrary locations.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="3">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>All locations will be processed using the same operation properties.</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::AutoText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>baseList</tabstop>
|
||||
<tabstop>addLocation</tabstop>
|
||||
<tabstop>removeLocation</tabstop>
|
||||
<tabstop>editLocation</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
@@ -326,17 +326,12 @@ class TaskPanelBaseLocationPage(TaskPanelPage):
|
||||
def getForm(self):
|
||||
self.formLoc = FreeCADGui.PySideUic.loadUi(":/panels/PageBaseLocationEdit.ui")
|
||||
self.formPts = FreeCADGui.PySideUic.loadUi(":/panels/PointEdit.ui")
|
||||
form = QtGui.QWidget()
|
||||
self.layout = QtGui.QVBoxLayout(form)
|
||||
form.setWindowTitle(self.formLoc.windowTitle())
|
||||
form.setSizePolicy(self.formLoc.sizePolicy())
|
||||
self.formLoc.setParent(form)
|
||||
self.formPts.setParent(form)
|
||||
self.layout.addWidget(self.formLoc)
|
||||
self.layout.addWidget(self.formPts)
|
||||
self.formLoc.baseList.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stretch)
|
||||
self.formPts.setParent(self.formLoc.addRemoveEdit.parent())
|
||||
self.formLoc.addRemoveEdit.parent().layout().addWidget(self.formPts)
|
||||
self.formPts.hide()
|
||||
self.getPoint = PathGetPoint.TaskPanel(self.formLoc, self.formPts)
|
||||
return form
|
||||
self.getPoint = PathGetPoint.TaskPanel(self.formLoc.addRemoveEdit, self.formPts)
|
||||
return self.formLoc
|
||||
|
||||
def modifyStandardButtons(self, buttonBox):
|
||||
self.getPoint.buttonBox = buttonBox
|
||||
@@ -362,6 +357,7 @@ class TaskPanelBaseLocationPage(TaskPanelPage):
|
||||
self.formLoc.baseList.setItem(self.formLoc.baseList.rowCount()-1, 1, item)
|
||||
self.formLoc.baseList.resizeColumnToContents(0)
|
||||
self.formLoc.baseList.blockSignals(False)
|
||||
self.itemActivated()
|
||||
|
||||
def removeLocation(self):
|
||||
deletedRows = []
|
||||
@@ -397,7 +393,7 @@ class TaskPanelBaseLocationPage(TaskPanelPage):
|
||||
def editLocation(self):
|
||||
selected = self.formLoc.baseList.selectedItems()
|
||||
if selected:
|
||||
row = self.formLoc.baseList.row(item)
|
||||
row = self.formLoc.baseList.row(selected[0])
|
||||
self.editRow = row
|
||||
x = self.formLoc.baseList.item(row, 0).data(self.DataLocation)
|
||||
y = self.formLoc.baseList.item(row, 1).data(self.DataLocation)
|
||||
@@ -411,7 +407,16 @@ class TaskPanelBaseLocationPage(TaskPanelPage):
|
||||
self.updateLocations()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
def itemActivated(self):
|
||||
if self.formLoc.baseList.selectedItems():
|
||||
self.form.removeLocation.setEnabled(True)
|
||||
self.form.editLocation.setEnabled(True)
|
||||
else:
|
||||
self.form.removeLocation.setEnabled(False)
|
||||
self.form.editLocation.setEnabled(False)
|
||||
|
||||
def registerSignalHandlers(self, obj):
|
||||
self.form.baseList.itemSelectionChanged.connect(self.itemActivated)
|
||||
self.formLoc.addLocation.clicked.connect(self.addLocation)
|
||||
self.formLoc.removeLocation.clicked.connect(self.removeLocation)
|
||||
self.formLoc.editLocation.clicked.connect(self.editLocation)
|
||||
|
||||
Reference in New Issue
Block a user