diff --git a/src/Mod/Path/Gui/Resources/panels/PageBaseGeometryEdit.ui b/src/Mod/Path/Gui/Resources/panels/PageBaseGeometryEdit.ui index 82bd54e4c1..c490abaee3 100644 --- a/src/Mod/Path/Gui/Resources/panels/PageBaseGeometryEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/PageBaseGeometryEdit.ui @@ -16,27 +16,7 @@ - - - - <html><head/><body><p>Clears list of base geometries.</p></body></html> - - - Clear - - - - - - - <html><head/><body><p>Remove the selected list items from the list of base geometries. The operation will not be applied to them.</p></body></html> - - - Remove - - - - + <html><head/><body><p>Add selected features to the list of base geometries for this operation.</p></body></html> @@ -46,20 +26,78 @@ - + + + + <html><head/><body><p>Clears list of base geometries.</p></body></html> + + + Clear + + + + + + + All objects will be processed using the same operation properties + + + Qt::AlignCenter + + + true + + + + + + true + + + + 0 + 0 + + + + + 0 + 25 + + <html><head/><body><p>Select one or more features in the 3d view and press 'Add' to add them as the base items for this operation.</p><p><br/></p><p>Selected features can be deleted entirely.</p></body></html> - - - - All objects will be processed using the same operation properties + + + + <html><head/><body><p>Remove the selected list items from the list of base geometries. The operation will not be applied to them.</p></body></html> - - true + + Remove + + + + + + + Import + + + + + + + + 0 + 0 + + + + <html><head/><body><p>List of operations with Base Geometry in current Job.</p></body></html> diff --git a/src/Mod/Path/PathScripts/PathOpGui.py b/src/Mod/Path/PathScripts/PathOpGui.py index 8c6cc532de..91fc946909 100644 --- a/src/Mod/Path/PathScripts/PathOpGui.py +++ b/src/Mod/Path/PathScripts/PathOpGui.py @@ -197,6 +197,7 @@ class TaskPanelPage(object): '''__init__(obj, features) ... framework initialisation. Do not overwrite, implement initPage(obj) instead.''' self.obj = obj + self.job = PathUtils.findParentJob(obj) self.form = self.getForm() # pylint: disable=assignment-from-no-return self.signalDirtyChanged = None self.setClean() @@ -416,7 +417,30 @@ class TaskPanelBaseGeometryPage(TaskPanelPage): self.panelTitle = 'Base Geometry' def getForm(self): - return FreeCADGui.PySideUic.loadUi(":/panels/PageBaseGeometryEdit.ui") + panel = FreeCADGui.PySideUic.loadUi(":/panels/PageBaseGeometryEdit.ui") + self.modifyPanel(panel) + return panel + + def modifyPanel(self, panel): + # Determine if possible operations are available + availableOps = list() + ops = self.job.Operations.Group + for op in ops: + if hasattr(op, 'Base') and op.Base.__len__() > 0: + availableOps.append(op.Label) + + if availableOps.__len__() > 0: + # Populate the operations list + addInputs = True + panel.geometryImportList.blockSignals(True) + panel.geometryImportList.clear() + availableOps.sort() + for opLbl in availableOps: + panel.geometryImportList.addItem(opLbl) + panel.geometryImportList.blockSignals(False) + else: + panel.geometryImportList.hide() + panel.geometryImportButton.hide() def getTitle(self, obj): return translate("PathOp", "Base Geometry") @@ -542,11 +566,23 @@ class TaskPanelBaseGeometryPage(TaskPanelPage): self.setDirty() self.updatePanelVisibility('Operation', self.obj) + def importBaseGeometry(self): + opLabel = str(self.form.geometryImportList.currentText()) + ops = FreeCAD.ActiveDocument.getObjectsByLabel(opLabel) + if ops.__len__() > 1: + msg = translate('PathOpGui', 'Mulitiple operations are labeled as') + msg += " {}\n".format(opLabel) + FreeCAD.Console.PrintWarning(msg) + for (base, subList) in ops[0].Base: + FreeCADGui.Selection.addSelection(base, subList) + self.addBase() + def registerSignalHandlers(self, obj): self.form.baseList.itemSelectionChanged.connect(self.itemActivated) self.form.addBase.clicked.connect(self.addBase) self.form.deleteBase.clicked.connect(self.deleteBase) self.form.clearBase.clicked.connect(self.clearBase) + self.form.geometryImportButton.clicked.connect(self.importBaseGeometry) def pageUpdateData(self, obj, prop): if prop in ['Base']: