diff --git a/src/Mod/Path/Gui/Resources/panels/PageBaseLocationEdit.ui b/src/Mod/Path/Gui/Resources/panels/PageBaseLocationEdit.ui index 913c251ec3..7b944b3a5d 100644 --- a/src/Mod/Path/Gui/Resources/panels/PageBaseLocationEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/PageBaseLocationEdit.ui @@ -7,87 +7,83 @@ 0 0 415 - 573 + 430 Form - + - - - - - <html><head/><body><p>List of locations to be processed.</p></body></html> - - - true - - - - X + + + <html><head/><body><p>List of locations to be processed.</p></body></html> + + + + X + + + + + Y + + + + + + + + + + + <html><head/><body><p>Remove selected location from the list. The operation is no longer applied to them.</p></body></html> - - - Y + Remove - - - - - - - <html><head/><body><p>Edit selected location.</p></body></html> - - - Edit - - - - - - - All locations will be processed using the same operation properties. - - - Qt::AutoText - - - true - - - - - - - <html><head/><body><p>Remove selected location from the list. The operation is no longer applied to them.</p></body></html> - - - Remove - - - - - - - <html><head/><body><p>Opens a newe dialog that lets you add arbitrary locations.</p></body></html> - - - Add - - - - + + + + + + <html><head/><body><p>Edit selected location.</p></body></html> + + + Edit + + + + + + + <html><head/><body><p>Opens a dialog to add arbitrary locations.</p></body></html> + + + Add + + + + + + + All locations will be processed using the same operation properties. + + + Qt::AutoText + + + true + + + + + baseList - addLocation - removeLocation - editLocation diff --git a/src/Mod/Path/PathScripts/PathOpGui.py b/src/Mod/Path/PathScripts/PathOpGui.py index cacf200214..4deba84f85 100644 --- a/src/Mod/Path/PathScripts/PathOpGui.py +++ b/src/Mod/Path/PathScripts/PathOpGui.py @@ -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)