From 861470c6ac11baa93b454cd3f5c88c33a51b64cf Mon Sep 17 00:00:00 2001 From: Krzysztof Date: Mon, 29 Sep 2025 17:43:23 +0200 Subject: [PATCH] FEM: Restore and harmonize FEM Task selection hints (#23678) * FEM: Add hint about selectable geometry types in 'Geometry reference selector' * FEM: Harmonize selection hint in FEM Task dialogs [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci FEM: Add translation support, correct selectable geometry FEM: Harmonize selection hint in FEM Task dialogs * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- src/Mod/Fem/Gui/TaskFemConstraintContact.cpp | 7 +++++++ src/Mod/Fem/Gui/TaskFemConstraintContact.ui | 4 ++-- src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp | 3 +++ src/Mod/Fem/Gui/TaskFemConstraintDisplacement.ui | 2 +- src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp | 3 +++ src/Mod/Fem/Gui/TaskFemConstraintFixed.ui | 2 +- src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp | 3 +++ src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.ui | 2 +- src/Mod/Fem/Gui/TaskFemConstraintForce.cpp | 3 +++ src/Mod/Fem/Gui/TaskFemConstraintForce.ui | 2 +- src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp | 3 +++ src/Mod/Fem/Gui/TaskFemConstraintHeatflux.ui | 2 +- src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp | 3 +++ src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.ui | 2 +- src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp | 3 +++ src/Mod/Fem/Gui/TaskFemConstraintPressure.ui | 2 +- src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp | 3 +++ src/Mod/Fem/Gui/TaskFemConstraintRigidBody.ui | 2 +- src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp | 3 +++ src/Mod/Fem/Gui/TaskFemConstraintSpring.ui | 2 +- src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp | 3 +++ src/Mod/Fem/Gui/TaskFemConstraintTemperature.ui | 2 +- src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp | 3 +++ src/Mod/Fem/Gui/TaskFemConstraintTransform.ui | 2 +- src/Mod/Fem/femguiutils/selection_widgets.py | 8 ++++++++ 25 files changed, 61 insertions(+), 13 deletions(-) diff --git a/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp b/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp index a0cf0d9025..d26a574ca7 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp @@ -136,6 +136,13 @@ TaskFemConstraintContact::TaskFemConstraintContact(ViewProviderFemConstraintCont ui->lw_referencesSlave->addItem(makeRefText(Objects[0], SubElements[0])); } + ui->lbl_info->setText(tr("Select slave geometry of type: ") + + QString::fromUtf8("%1; ").arg(tr("Face")) + + tr("click Add or Remove")); + ui->lbl_info_2->setText(tr("Select master geometry of type: ") + + QString::fromUtf8("%1; ").arg(tr("Face")) + + tr("click Add or Remove")); + // Selection buttons connect(ui->btnAddSlave, &QToolButton::clicked, diff --git a/src/Mod/Fem/Gui/TaskFemConstraintContact.ui b/src/Mod/Fem/Gui/TaskFemConstraintContact.ui index 0ff3b4e419..c981335625 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintContact.ui +++ b/src/Mod/Fem/Gui/TaskFemConstraintContact.ui @@ -17,7 +17,7 @@ - Select master face, click Add or Remove + Select master geometry of type: Face; click Add or Remove @@ -76,7 +76,7 @@ - Select slave face, click Add or Remove + Select slave geometry of type: Face; click Add or Remove diff --git a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp index 39aa688781..5910b2a7e4 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.cpp @@ -161,6 +161,9 @@ TaskFemConstraintDisplacement::TaskFemConstraintDisplacement( ui->DisplacementZFormulaCB->setChecked(bStates[8]); ui->FlowForceCB->setChecked(bStates[9]); + ui->lbl_info->setText(tr("Select geometry of type: ") + + QString::fromUtf8("%1").arg(tr("Vertex, Edge, Face"))); + // Selection buttons buttonGroup->addButton(ui->btnAdd, static_cast(SelectionChangeModes::refAdd)); buttonGroup->addButton(ui->btnRemove, static_cast(SelectionChangeModes::refRemove)); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.ui b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.ui index 4b5868c51e..26a0b9bb09 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.ui +++ b/src/Mod/Fem/Gui/TaskFemConstraintDisplacement.ui @@ -38,7 +38,7 @@ - Click Add or Remove and select geometric elements + Select geometry of type: Vertex, Edge, Face diff --git a/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp b/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp index 27fc132837..9c80cb43d5 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintFixed.cpp @@ -82,6 +82,9 @@ TaskFemConstraintFixed::TaskFemConstraintFixed(ViewProviderFemConstraintFixed* C ui->lw_references->setCurrentRow(0, QItemSelectionModel::ClearAndSelect); } + ui->lbl_info->setText(tr("Select geometry of type: ") + + QString::fromUtf8("%1").arg(tr("Vertex, Edge, Face"))); + // Selection buttons buttonGroup->addButton(ui->btnAdd, (int)SelectionChangeModes::refAdd); buttonGroup->addButton(ui->btnRemove, (int)SelectionChangeModes::refRemove); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintFixed.ui b/src/Mod/Fem/Gui/TaskFemConstraintFixed.ui index a0f9dd16d8..c26b927d64 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintFixed.ui +++ b/src/Mod/Fem/Gui/TaskFemConstraintFixed.ui @@ -17,7 +17,7 @@ - Click Add or Remove and select geometric elements + Select geometry of type: Vertex, Edge, Face diff --git a/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp b/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp index 08c4a79693..744b339007 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.cpp @@ -370,6 +370,9 @@ TaskFemConstraintFluidBoundary::TaskFemConstraintFluidBoundary( ui->buttonDirection->blockSignals(false); ui->checkReverse->blockSignals(false); + ui->lbl_info->setText(tr("Select geometry of type: ") + + QString::fromUtf8("%1").arg(tr("Face"))); + updateUI(); } diff --git a/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.ui b/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.ui index 25c2f793e2..59d1f3a709 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.ui +++ b/src/Mod/Fem/Gui/TaskFemConstraintFluidBoundary.ui @@ -67,7 +67,7 @@ - Select multiple faces, click Add or Remove + Select geometry of type: Face diff --git a/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp b/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp index a1cc98cbf5..23541fbd2f 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintForce.cpp @@ -86,6 +86,9 @@ TaskFemConstraintForce::TaskFemConstraintForce(ViewProviderFemConstraintForce* C ui->lineDirection->setText(dir.isEmpty() ? QString() : dir); ui->checkReverse->setChecked(reversed); + ui->lbl_info->setText(tr("Select geometry of type: ") + + QString::fromUtf8("%1").arg(tr("Vertex, Edge, Face"))); + // create a context menu for the listview of the references createActions(ui->listReferences); connect(deleteAction, &QAction::triggered, this, &TaskFemConstraintForce::onReferenceDeleted); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintForce.ui b/src/Mod/Fem/Gui/TaskFemConstraintForce.ui index 156af8b330..19dbfb420c 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintForce.ui +++ b/src/Mod/Fem/Gui/TaskFemConstraintForce.ui @@ -29,7 +29,7 @@ - Click Add or Remove and select geometric elements + Select geometry of type: Vertex, Edge, Face diff --git a/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp b/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp index 9c3f5046ad..8f51965597 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.cpp @@ -145,6 +145,9 @@ TaskFemConstraintHeatflux::TaskFemConstraintHeatflux( ui->lw_references->setCurrentRow(0, QItemSelectionModel::ClearAndSelect); } + ui->lbl_references->setText(tr("Select geometry of type: ") + + QString::fromUtf8("%1").arg(tr("Edge, Face"))); + // Selection buttons buttonGroup->addButton(ui->btnAdd, static_cast(SelectionChangeModes::refAdd)); buttonGroup->addButton(ui->btnRemove, static_cast(SelectionChangeModes::refRemove)); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.ui b/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.ui index 8e1c79a829..7dbae30425 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.ui +++ b/src/Mod/Fem/Gui/TaskFemConstraintHeatflux.ui @@ -17,7 +17,7 @@ - Click Add or Remove and select faces + Select geometry of type: Edge, Face diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp b/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp index 526c4e03d3..30ac2c209f 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.cpp @@ -92,6 +92,9 @@ TaskFemConstraintPlaneRotation::TaskFemConstraintPlaneRotation( ui->lw_references->setCurrentRow(0, QItemSelectionModel::ClearAndSelect); } + ui->lbl_info->setText(tr("Select single geometry of type: ") + + QString::fromUtf8("%1").arg(tr("Face"))); + // Selection buttons connect(ui->btnAdd, &QToolButton::clicked, diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.ui b/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.ui index 1fb68dbd81..63c963f966 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.ui +++ b/src/Mod/Fem/Gui/TaskFemConstraintPlaneRotation.ui @@ -17,7 +17,7 @@ - Select a single face, click Add or Remove + Select single geometry of type: Face diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp b/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp index 7da3e23bf3..f9faf6e4b4 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintPressure.cpp @@ -70,6 +70,9 @@ TaskFemConstraintPressure::TaskFemConstraintPressure( bool reversed = pcConstraint->Reversed.getValue(); ui->checkBoxReverse->setChecked(reversed); + ui->lbl_info->setText(tr("Select geometry of type: ") + + QString::fromUtf8("%1").arg(tr("Edge, Face"))); + ui->lw_references->clear(); for (std::size_t i = 0; i < Objects.size(); i++) { ui->lw_references->addItem(makeRefText(Objects[i], SubElements[i])); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintPressure.ui b/src/Mod/Fem/Gui/TaskFemConstraintPressure.ui index 9fb6bc5228..d5c68f4af1 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintPressure.ui +++ b/src/Mod/Fem/Gui/TaskFemConstraintPressure.ui @@ -17,7 +17,7 @@ - Click Add or Remove and select faces + Select geometry of type: Edge, Face diff --git a/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp b/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp index 2934fed33c..0550b5ae3b 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.cpp @@ -248,6 +248,9 @@ TaskFemConstraintRigidBody::TaskFemConstraintRigidBody( buttonGroup->addButton(ui->btnAdd, (int)SelectionChangeModes::refAdd); buttonGroup->addButton(ui->btnRemove, (int)SelectionChangeModes::refRemove); + ui->lbl_info->setText(tr("Select geometry of type: ") + + QString::fromUtf8("%1").arg(tr("Vertex, Edge, Face"))); + updateUI(); } diff --git a/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.ui b/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.ui index c6bb3f9d1d..ed958aabf3 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.ui +++ b/src/Mod/Fem/Gui/TaskFemConstraintRigidBody.ui @@ -17,7 +17,7 @@ - Click Add or Remove and select geometric elements + Select geometry of type: Vertex, Edge, Face diff --git a/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp b/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp index cb28d6ed66..f4642600af 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintSpring.cpp @@ -99,6 +99,9 @@ TaskFemConstraintSpring::TaskFemConstraintSpring(ViewProviderFemConstraintSpring ui->lw_references->setCurrentRow(0, QItemSelectionModel::ClearAndSelect); } + ui->lbl_info->setText(tr("Select geometry of type: ") + + QString::fromUtf8("%1").arg(tr("Face"))); + // Selection buttons buttonGroup->addButton(ui->btnAdd, (int)SelectionChangeModes::refAdd); buttonGroup->addButton(ui->btnRemove, (int)SelectionChangeModes::refRemove); diff --git a/src/Mod/Fem/Gui/TaskFemConstraintSpring.ui b/src/Mod/Fem/Gui/TaskFemConstraintSpring.ui index 3a829a55d2..8317c8fe73 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintSpring.ui +++ b/src/Mod/Fem/Gui/TaskFemConstraintSpring.ui @@ -17,7 +17,7 @@ - Click Add or Remove and select faces + Select geometry of type: Face diff --git a/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp b/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp index 747b1a8ef2..1a0eddab7d 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintTemperature.cpp @@ -97,6 +97,9 @@ TaskFemConstraintTemperature::TaskFemConstraintTemperature( ui->lw_references->setCurrentRow(0, QItemSelectionModel::ClearAndSelect); } + ui->lbl_info->setText(tr("Select geometry of type: ") + + QString::fromUtf8("%1").arg(tr("Vertex, Edge, Face"))); + // create a context menu for the listview of the references createActions(ui->lw_references); connect(deleteAction, diff --git a/src/Mod/Fem/Gui/TaskFemConstraintTemperature.ui b/src/Mod/Fem/Gui/TaskFemConstraintTemperature.ui index 803ad8d08c..8813036bfc 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintTemperature.ui +++ b/src/Mod/Fem/Gui/TaskFemConstraintTemperature.ui @@ -29,7 +29,7 @@ - Click Add or Remove and select geometric elements + Select geometry of type: Vertex, Edge, Face diff --git a/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp b/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp index 7fc7d35a13..538285b9e0 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintTransform.cpp @@ -153,6 +153,9 @@ TaskFemConstraintTransform::TaskFemConstraintTransform( ui->lw_Rect->clear(); + ui->lbl_info_2->setText(tr("Select single geometry of type: ") + + QString::fromUtf8("%1").arg(tr("Face"))); + // Transformable surfaces Gui::Command::doCommand(Gui::Command::Doc, TaskFemConstraintTransform::getSurfaceReferences( diff --git a/src/Mod/Fem/Gui/TaskFemConstraintTransform.ui b/src/Mod/Fem/Gui/TaskFemConstraintTransform.ui index 731c9f2c6c..b1b1f65b13 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintTransform.ui +++ b/src/Mod/Fem/Gui/TaskFemConstraintTransform.ui @@ -41,7 +41,7 @@ - Select a face, click Add or Remove + Select single geometry of type: Face diff --git a/src/Mod/Fem/femguiutils/selection_widgets.py b/src/Mod/Fem/femguiutils/selection_widgets.py index 48730817bf..46719f4aec 100644 --- a/src/Mod/Fem/femguiutils/selection_widgets.py +++ b/src/Mod/Fem/femguiutils/selection_widgets.py @@ -296,6 +296,13 @@ class GeometryElementsSelection(QtGui.QWidget): # button self.pushButton_Add = QtGui.QPushButton(self.tr("Add")) self.pushButton_Remove = QtGui.QPushButton(self.tr("Remove")) + # label + self.lb_help = QtGui.QLabel() + self.lb_help.setWordWrap(True) + selectHelpText = self.tr("Select geometry of type: {}{}{}").format( + "", self.sel_elem_text, "" + ) + self.lb_help.setText(selectHelpText) # list self.list_References = QtGui.QListWidget() # radiobutton down the list @@ -314,6 +321,7 @@ class GeometryElementsSelection(QtGui.QWidget): subLayout.addWidget(self.pushButton_Remove) # main layout mainLayout = QtGui.QVBoxLayout() + mainLayout.addWidget(self.lb_help) mainLayout.addLayout(subLayout) mainLayout.addWidget(self.list_References)