From: vsv Date: Thu, 3 Oct 2019 07:17:28 +0000 (+0300) Subject: Provide translation of DoF string X-Git-Tag: V9_4_0a2~4^2~31 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9f3145344ab3485d62f8cf822212581d91b435a2;p=modules%2Fshaper.git Provide translation of DoF string --- diff --git a/src/PartSet/PartSet_OverconstraintListener.cpp b/src/PartSet/PartSet_OverconstraintListener.cpp index ffa27418a..59fbfa96e 100644 --- a/src/PartSet/PartSet_OverconstraintListener.cpp +++ b/src/PartSet/PartSet_OverconstraintListener.cpp @@ -74,8 +74,13 @@ void PartSet_OverconstraintListener::setActive(const bool& theActive) PartSet_Module* aModule = module(); CompositeFeaturePtr aSketch = aModule->sketchMgr()->activeSketch(); if (aSketch.get()) { - std::string aDOFMessage = aSketch->string(SketchPlugin_Sketch::SOLVER_DOF())->value(); - myIsFullyConstrained = QString(aDOFMessage.c_str()).contains(" = 0"); + QString aDOFMessage(aSketch->string(SketchPlugin_Sketch::SOLVER_DOF())->value().c_str()); + if (aDOFMessage.contains('=')) { + // to support old data + aDOFMessage = + aDOFMessage.right(aDOFMessage.length() - aDOFMessage.lastIndexOf('=')).trimmed(); + } + myIsFullyConstrained = (aDOFMessage == "0"); } } } diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index 960429f71..44e3514b7 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -37,6 +37,7 @@ #include #include +#include #include #include @@ -180,6 +181,9 @@ myIsSelection(false) connect(aPlaneBtn, SIGNAL(clicked(bool)), SLOT(onChangePlane())); aLayout->addWidget(aPlaneBtn); + myDoFLabel = new QLabel("", aSecondWgt); + aLayout->addWidget(myDoFLabel); + myStackWidget->addWidget(aSecondWgt); //setLayout(aLayout); @@ -730,3 +734,30 @@ void PartSet_WidgetSketchLabel::setShowPointsState(bool theState) myShowPoints->setChecked(theState); myShowPoints->blockSignals(aBlock); } + +bool PartSet_WidgetSketchLabel::restoreValueCustom() +{ + if (myFeature.get()) { + CompositeFeaturePtr aSketch = std::dynamic_pointer_cast(myFeature); + if (aSketch.get() && (aSketch->numberOfSubs() > 0)) { + AttributeStringPtr aDOFStr = aSketch->string("SolverDOF"); + if (aDOFStr.get()) { + QString aVal(aDOFStr->value().c_str()); + if (aVal.contains('=')) { + // to support old data + aVal = aVal.right(aVal.length() - aVal.lastIndexOf('=')); + } + int aDoF = aVal.toInt(); + if (aDoF == 0) { + myDoFLabel->setText(tr("Sketch is fully fixed (DoF = 0)")); + } else { + myDoFLabel->setText(tr("DoF (degrees of freedom) = ") + aVal); + } + } + } + else { + myDoFLabel->setText(""); + } + } + return true; +} diff --git a/src/PartSet/PartSet_WidgetSketchLabel.h b/src/PartSet/PartSet_WidgetSketchLabel.h index b4158194b..fe9c14716 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.h +++ b/src/PartSet/PartSet_WidgetSketchLabel.h @@ -152,10 +152,7 @@ protected: return true; } - virtual bool restoreValueCustom() - { - return true; - } + virtual bool restoreValueCustom(); /// The methiod called when widget is activated virtual void activateCustom(); @@ -237,6 +234,8 @@ private: QLineEdit* mySizeOfView; ///< Value of square of size of View QStackedWidget* myStackWidget; + QLabel* myDoFLabel; + bool myOpenTransaction; bool myIsSelection; }; diff --git a/src/PartSet/PartSet_msg_fr.ts b/src/PartSet/PartSet_msg_fr.ts index 1f7584e47..34195fb35 100644 --- a/src/PartSet/PartSet_msg_fr.ts +++ b/src/PartSet/PartSet_msg_fr.ts @@ -1,160 +1,170 @@ - + PartSet_MenuMgr - - - Auxiliary - Auxiliaire + + + Auxiliary + Auxiliaire - - - Activate - Activer + + + Activate + Activer - - Edit... - Modifier... + + Edit... + Modifier... - - - - Detach - Détacher + + + + Detach + Détacher - - Detach %1 - Détachez %1 + + Detach %1 + Détachez %1 - - + + PartSet_WidgetPoint2D - - X - X + + X + X - - Y - Y + + Y + Y - - + + PartSet_WidgetSketchCreator - - Size of the view - Taille de la vue + + Size of the view + Taille de la vue - - Apply current feature - Appliquer la fonctionnalité actuelle + + Apply current feature + Appliquer la fonctionnalité actuelle - - Sketch is invalid and will be deleted. + + Sketch is invalid and will be deleted. Error: %1 - L'esquisse n'est pas valide et sera supprimée. + L'esquisse n'est pas valide et sera supprimée. Erreur : %1 - - + + PartSet_WidgetSketchLabel - - Size of the view - Taille de la vue + + Size of the view + Taille de la vue - - Remove external dependencies - Supprimer les dépendances externes + + Remove external dependencies + Supprimer les dépendances externes - - Sketcher plane - Plan du Sketcher + + Sketcher plane + Plan du Sketcher - - Reversed - Renversé + + Reversed + Renversé - - Set plane view - Définir la vue plane + + Set plane view + Définir la vue plane - - Show geometrical constraints - Afficher les contraintes géométriques + + Show geometrical constraints + Afficher les contraintes géométriques - - Show dimensional constraints - Afficher les contraintes dimensionnelles + + Show dimensional constraints + Afficher les contraintes dimensionnelles - - Show existing expressions - Afficher les expressions existantes + + Show existing expressions + Afficher les expressions existantes - - Show free points - Afficher les points libres + + Show free points + Afficher les points libres - - Automatic constraints - Contraintes automatiques + + Automatic constraints + Contraintes automatiques - - Change sketch plane - Changer le plan d'esquisse + + Change sketch plane + Changer le plan d'esquisse - - + + + Sketch is fully fixed (DoF = 0) + L'esquisse est entièrement fixée (DdL = 0) + + + + DoF (degrees of freedom) = + DdL (degrés de liberté) = + + + QObject - - Parameters - Paramètres + + Parameters + Paramètres - - Constructions - Constructions + + Constructions + Constructions - - Parts - Pièces + + Parts + Pièces - - Results - Résultats + + Results + Résultats - - Fields - Champs + + Fields + Champs - - Groups - Groupes + + Groups + Groupes - + diff --git a/src/SketchPlugin/SketchPlugin_msg_fr.ts b/src/SketchPlugin/SketchPlugin_msg_fr.ts index 9717b2dcd..e82b2f531 100644 --- a/src/SketchPlugin/SketchPlugin_msg_fr.ts +++ b/src/SketchPlugin/SketchPlugin_msg_fr.ts @@ -2223,14 +2223,6 @@ Sketch Esquisse - - DoF (degrees of freedom) = %1 - DdL (degrés de liberté) = %1 - - - Sketch is fully fixed (DoF = 0) - L'esquisse est entièrement fixée (DdL = 0) - Sketch:External diff --git a/src/SketchPlugin/plugin-Sketch.xml b/src/SketchPlugin/plugin-Sketch.xml index e57f5a3e8..69d6a1c71 100644 --- a/src/SketchPlugin/plugin-Sketch.xml +++ b/src/SketchPlugin/plugin-Sketch.xml @@ -25,7 +25,7 @@ -