From 17f65d87466352c402df650cf59f4381e7af6cae Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Sun, 21 May 2023 17:42:54 +0200 Subject: [PATCH] Sketcher: Make Command Constraints show the severity of warning for typical user mistakes --- src/Mod/Sketcher/Gui/CommandConstraints.cpp | 302 +++++++++--------- src/Mod/Sketcher/Gui/TaskSketcherElements.cpp | 2 +- 2 files changed, 153 insertions(+), 151 deletions(-) diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 5ce9e6b69e..8ba8a18725 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -145,14 +145,14 @@ void finishDatumConstraint (Gui::Command* cmd, Sketcher::SketchObject* sketch, b void showNoConstraintBetweenExternal(const App::DocumentObject * obj) { - Gui::TranslatedNotification(obj, + Gui::TranslatedUserWarning(obj, QObject::tr("Wrong selection"), QObject::tr("Cannot add a constraint between two external geometries.")); } void showNoConstraintBetweenFixedGeometry(const App::DocumentObject * obj) { - Gui::TranslatedNotification(obj, + Gui::TranslatedUserWarning(obj, QObject::tr("Wrong selection"), QObject::tr("Cannot add a constraint between two fixed geometries. " "Fixed geometries include external geometry, " @@ -913,7 +913,7 @@ void CmdSketcherConstrainHorizontal::activated(int iMsg) new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } else { - Gui::TranslatedNotification("Sketcher", QObject::tr("Wrong selection"), + Gui::TranslatedUserWarning("Sketcher", QObject::tr("Wrong selection"), QObject::tr("Select an edge from the sketch.")); } return; @@ -939,7 +939,7 @@ void CmdSketcherConstrainHorizontal::activated(int iMsg) if (isEdge(GeoId,PosId)) {// it is an edge const Part::Geometry *geo = Obj->getGeometry(GeoId); if (geo->getTypeId() != Part::GeomLineSegment::getClassTypeId()) { - Gui::TranslatedNotification(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected edge is not a line segment.")); + Gui::TranslatedUserWarning(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected edge is not a line segment.")); return; } @@ -947,16 +947,16 @@ void CmdSketcherConstrainHorizontal::activated(int iMsg) for (std::vector< Sketcher::Constraint * >::const_iterator it= vals.begin(); it != vals.end(); ++it) { if ((*it)->Type == Sketcher::Horizontal && (*it)->First == GeoId && (*it)->FirstPos == Sketcher::PointPos::none){ - Gui::TranslatedNotification(Obj, QObject::tr("Double constraint"), QObject::tr("The selected edge already has a horizontal constraint!")); + Gui::TranslatedUserWarning(Obj, QObject::tr("Double constraint"), QObject::tr("The selected edge already has a horizontal constraint!")); return; } if ((*it)->Type == Sketcher::Vertical && (*it)->First == GeoId && (*it)->FirstPos == Sketcher::PointPos::none) { - Gui::TranslatedNotification(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a vertical constraint!")); + Gui::TranslatedUserWarning(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a vertical constraint!")); return; } // check if the edge already has a Block constraint if ((*it)->Type == Sketcher::Block && (*it)->First == GeoId && (*it)->FirstPos == Sketcher::PointPos::none) { - Gui::TranslatedNotification(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a Block constraint!")); + Gui::TranslatedUserWarning(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a Block constraint!")); return; } } @@ -974,7 +974,7 @@ void CmdSketcherConstrainHorizontal::activated(int iMsg) } if (edgegeoids.empty() && pointgeoids.empty()) { - Gui::TranslatedNotification(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected item(s) can't accept a horizontal constraint!")); + Gui::TranslatedUserWarning(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected item(s) can't accept a horizontal constraint!")); return; } @@ -1001,7 +1001,7 @@ void CmdSketcherConstrainHorizontal::activated(int iMsg) } } else { // vertex mode, fixedpoints > 1 - Gui::TranslatedNotification(Obj, QObject::tr("Impossible constraint"), QObject::tr("There are more than one fixed points selected. Select a maximum of one fixed point!")); + Gui::TranslatedUserWarning(Obj, QObject::tr("Impossible constraint"), QObject::tr("There are more than one fixed points selected. Select a maximum of one fixed point!")); return; } // finish the transaction and update @@ -1028,7 +1028,7 @@ void CmdSketcherConstrainHorizontal::applyConstraint(std::vector &sel if (CrvId != -1) { const Part::Geometry *geo = Obj->getGeometry(CrvId); if (geo->getTypeId() != Part::GeomLineSegment::getClassTypeId()) { - Gui::TranslatedNotification(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected edge is not a line segment.")); + Gui::TranslatedUserWarning(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected edge is not a line segment.")); return; } @@ -1036,16 +1036,16 @@ void CmdSketcherConstrainHorizontal::applyConstraint(std::vector &sel for (std::vector< Sketcher::Constraint * >::const_iterator it= vals.begin(); it != vals.end(); ++it) { if ((*it)->Type == Sketcher::Horizontal && (*it)->First == CrvId && (*it)->FirstPos == Sketcher::PointPos::none){ - Gui::TranslatedNotification(Obj, QObject::tr("Double constraint"), QObject::tr("The selected edge already has a horizontal constraint!")); + Gui::TranslatedUserWarning(Obj, QObject::tr("Double constraint"), QObject::tr("The selected edge already has a horizontal constraint!")); return; } if ((*it)->Type == Sketcher::Vertical && (*it)->First == CrvId && (*it)->FirstPos == Sketcher::PointPos::none) { - Gui::TranslatedNotification(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a vertical constraint!")); + Gui::TranslatedUserWarning(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a vertical constraint!")); return; } // check if the edge already has a Block constraint if ((*it)->Type == Sketcher::Block && (*it)->First == CrvId && (*it)->FirstPos == Sketcher::PointPos::none) { - Gui::TranslatedNotification(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a Block constraint!")); + Gui::TranslatedUserWarning(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a Block constraint!")); return; } } @@ -1141,7 +1141,7 @@ void CmdSketcherConstrainVertical::activated(int iMsg) new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } else { - Gui::TranslatedNotification("Sketcher", QObject::tr("Wrong selection"), + Gui::TranslatedUserWarning("Sketcher", QObject::tr("Wrong selection"), QObject::tr("Select an edge from the sketch.")); } return; @@ -1167,7 +1167,7 @@ void CmdSketcherConstrainVertical::activated(int iMsg) if (isEdge(GeoId,PosId)) {// it is an edge const Part::Geometry *geo = Obj->getGeometry(GeoId); if (geo->getTypeId() != Part::GeomLineSegment::getClassTypeId()) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected edge is not a line segment.")); return; @@ -1177,20 +1177,20 @@ void CmdSketcherConstrainVertical::activated(int iMsg) for (std::vector< Sketcher::Constraint * >::const_iterator it= vals.begin(); it != vals.end(); ++it) { if ((*it)->Type == Sketcher::Vertical && (*it)->First == GeoId && (*it)->FirstPos == Sketcher::PointPos::none){ - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Double constraint"), QObject::tr("The selected edge already has a horizontal constraint!")); return; } if ((*it)->Type == Sketcher::Horizontal && (*it)->First == GeoId && (*it)->FirstPos == Sketcher::PointPos::none) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a horizontal constraint!")); return; } // check if the edge already has a Block constraint if ((*it)->Type == Sketcher::Block && (*it)->First == GeoId && (*it)->FirstPos == Sketcher::PointPos::none) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a Block constraint!")); return; @@ -1209,7 +1209,7 @@ void CmdSketcherConstrainVertical::activated(int iMsg) } if (edgegeoids.empty() && pointgeoids.empty()) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected item(s) can't accept a vertical constraint!")); return; @@ -1236,7 +1236,7 @@ void CmdSketcherConstrainVertical::activated(int iMsg) } } else { // vertex mode, fixedpoints > 1 - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Impossible constraint"), QObject::tr("There are more than one fixed points selected. Select a maximum of one fixed point!")); return; @@ -1266,7 +1266,7 @@ void CmdSketcherConstrainVertical::applyConstraint(std::vector &selSe if (CrvId != -1) { const Part::Geometry *geo = Obj->getGeometry(CrvId); if (geo->getTypeId() != Part::GeomLineSegment::getClassTypeId()) { - Gui::TranslatedNotification(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected edge is not a line segment.")); + Gui::TranslatedUserWarning(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected edge is not a line segment.")); return; } @@ -1274,16 +1274,16 @@ void CmdSketcherConstrainVertical::applyConstraint(std::vector &selSe for (std::vector< Sketcher::Constraint * >::const_iterator it= vals.begin(); it != vals.end(); ++it) { if ((*it)->Type == Sketcher::Horizontal && (*it)->First == CrvId && (*it)->FirstPos == Sketcher::PointPos::none){ - Gui::TranslatedNotification(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a horizontal constraint!")); + Gui::TranslatedUserWarning(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a horizontal constraint!")); return; } if ((*it)->Type == Sketcher::Vertical && (*it)->First == CrvId && (*it)->FirstPos == Sketcher::PointPos::none) { - Gui::TranslatedNotification(Obj, QObject::tr("Double constraint"), QObject::tr("The selected edge already has a vertical constraint!")); + Gui::TranslatedUserWarning(Obj, QObject::tr("Double constraint"), QObject::tr("The selected edge already has a vertical constraint!")); return; } // check if the edge already has a Block constraint if ((*it)->Type == Sketcher::Block && (*it)->First == CrvId && (*it)->FirstPos == Sketcher::PointPos::none) { - Gui::TranslatedNotification(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a Block constraint!")); + Gui::TranslatedUserWarning(Obj, QObject::tr("Impossible constraint"), QObject::tr("The selected edge already has a Block constraint!")); return; } } @@ -1379,7 +1379,7 @@ void CmdSketcherConstrainLock::activated(int iMsg) new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } else { - Gui::TranslatedNotification("Sketcher", QObject::tr("Wrong selection"), + Gui::TranslatedUserWarning("Sketcher", QObject::tr("Wrong selection"), QObject::tr("Select vertices from the sketch.")); } return; @@ -1402,12 +1402,12 @@ void CmdSketcherConstrainLock::activated(int iMsg) if ((it != std::prev(SubNames.end()) && (isEdge(GeoIdt,PosIdt) || (GeoIdt < 0 && GeoIdt >= Sketcher::GeoEnum::VAxis))) || (it == std::prev(SubNames.end()) && isEdge(GeoIdt,PosIdt)) ) { if(selection.size() == 1) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select one vertex from the sketch other than the origin.")); } else { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select only vertices from the sketch. The last selected vertex may be the origin.")); } @@ -1604,7 +1604,7 @@ void CmdSketcherConstrainBlock::activated(int iMsg) new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } else { - Gui::TranslatedNotification("Sketcher", QObject::tr("Wrong selection"), + Gui::TranslatedUserWarning("Sketcher", QObject::tr("Wrong selection"), QObject::tr("Select vertices from the sketch.")); } return; @@ -1616,7 +1616,7 @@ void CmdSketcherConstrainBlock::activated(int iMsg) // Check that the solver does not report redundant/conflicting constraints if(Obj->getLastSolverStatus()!=GCS::Success || Obj->getLastHasConflicts() || Obj->getLastHasRedundancies()) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong solver status"), QObject::tr("A Block constraint cannot be added " "if the sketch is unsolved " @@ -1635,12 +1635,12 @@ void CmdSketcherConstrainBlock::activated(int iMsg) if ( isVertex(GeoIdt,PosIdt) || GeoIdt < 0 ) { if(selection.size() == 1) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select one edge from the sketch.")); } else { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select only edges from the sketch.")); } @@ -1651,7 +1651,7 @@ void CmdSketcherConstrainBlock::activated(int iMsg) // check if the edge already has a Block constraint if ( checkConstraint(vals, Sketcher::Block, GeoIdt, Sketcher::PointPos::none)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Double constraint"), QObject::tr("The selected edge already has a Block constraint!")); return; @@ -1669,6 +1669,8 @@ void CmdSketcherConstrainBlock::activated(int iMsg) Gui::cmdAppObjectArgs(Obj, "addConstraint(Sketcher.Constraint('Block',%d))", (*itg)); } catch (const Base::Exception& e) { + // Exceptions originating in Python have already been reported by the Interpreter as + // Untranslated developer intended messages (i.e. to the Report View) Gui::NotifyError(Obj, QT_TRANSLATE_NOOP("Notifications", "Error"), e.what()); @@ -1701,7 +1703,7 @@ void CmdSketcherConstrainBlock::applyConstraint(std::vector &selSeq, const std::vector< Sketcher::Constraint * > &vals = Obj->Constraints.getValues(); if ( checkConstraint(vals, Sketcher::Block, selSeq.front().GeoId, Sketcher::PointPos::none)) { - Gui::TranslatedNotification(Obj, QObject::tr("Double constraint"), QObject::tr("The selected edge already has a Block constraint!")); + Gui::TranslatedUserWarning(Obj, QObject::tr("Double constraint"), QObject::tr("The selected edge already has a Block constraint!")); return; } @@ -1984,7 +1986,7 @@ void CmdSketcherConstrainCoincident::activated(int iMsg) getSelection().clearSelection(); } else { // TODO: Get the exact message from git history and put it here - Gui::TranslatedNotification("Sketcher", QObject::tr("Wrong selection"), + Gui::TranslatedUserWarning("Sketcher", QObject::tr("Wrong selection"), QObject::tr("Select two or more points from the sketch.")); } return; @@ -1995,7 +1997,7 @@ void CmdSketcherConstrainCoincident::activated(int iMsg) Sketcher::SketchObject* Obj = static_cast(selection[0].getObject()); if (SubNames.size() < 2) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select two or more vertices from the sketch.")); return; @@ -2016,7 +2018,7 @@ void CmdSketcherConstrainCoincident::activated(int iMsg) allConicsEdges = false; //at least one point is selected, so concentric can't be applied. if (atLeastOneEdge && !allConicsEdges) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select two or more vertices from the sketch for a coincident constraint, or two or more circles, ellipses, arcs or arcs of ellipse for a concentric constraint.")); return; @@ -2092,7 +2094,7 @@ void CmdSketcherConstrainCoincident::applyConstraint(std::vector &sel case 4: // {SelExternalEdge, SelEdge} //Concentric for circles, ellipse, arc, arcofEllipse only. if (!isGeoConcentricCompatible(Obj->getGeometry(GeoId1)) || !isGeoConcentricCompatible(Obj->getGeometry(GeoId2))) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select two vertices from the sketch for a coincident constraint, or two circles, ellipses, arcs or arcs of ellipse for a concentric constraint.")); return; @@ -2180,7 +2182,7 @@ void CmdSketcherConstrainDistance::activated(int iMsg) getSelection().clearSelection(); } else { - Gui::TranslatedNotification("Sketcher", QObject::tr("Wrong selection"), + Gui::TranslatedUserWarning("Sketcher", QObject::tr("Wrong selection"), QObject::tr("Select vertices from the sketch.")); } return; @@ -2191,7 +2193,7 @@ void CmdSketcherConstrainDistance::activated(int iMsg) Sketcher::SketchObject* Obj = static_cast(selection[0].getObject()); if (SubNames.empty() || SubNames.size() > 2) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select exactly one line or one point and one line or two points from the sketch.")); return; @@ -2376,7 +2378,7 @@ void CmdSketcherConstrainDistance::activated(int iMsg) } else if (isEdge(GeoId1,PosId1)) { // line length if (GeoId1 < 0 && GeoId1 >= Sketcher::GeoEnum::VAxis) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Cannot add a length constraint on an axis!")); return; @@ -2410,7 +2412,7 @@ void CmdSketcherConstrainDistance::activated(int iMsg) } } - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select exactly one line or one point and one line or two points or two circles from the sketch.")); return; @@ -2505,7 +2507,7 @@ void CmdSketcherConstrainDistance::applyConstraint(std::vector &selSe // allow this selection but do nothing as it needs 2 circles or 1 circle and 1 line } else { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("This constraint does not make sense for non-linear curves.")); } @@ -2597,7 +2599,7 @@ void CmdSketcherConstrainDistance::applyConstraint(std::vector &selSe return; } else { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select exactly one line or one point and one line or two points or two circles from the sketch.")); @@ -2706,7 +2708,7 @@ void CmdSketcherConstrainPointOnObject::activated(int iMsg) getSelection().clearSelection(); } else { // TODO: Get the exact message from git history and put it here - Gui::TranslatedNotification("Sketcher", QObject::tr("Wrong selection"), + Gui::TranslatedUserWarning("Sketcher", QObject::tr("Wrong selection"), QObject::tr("Select the right things from the sketch.")); } return; @@ -2745,7 +2747,7 @@ void CmdSketcherConstrainPointOnObject::activated(int iMsg) const Part::Geometry *geom = Obj->getGeometry(curves[iCrv].GeoId); if( geom && isBsplinePole(geom)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select an edge that is not a B-spline weight.")); abortCommand(); @@ -2768,7 +2770,7 @@ void CmdSketcherConstrainPointOnObject::activated(int iMsg) getSelection().clearSelection(); } else { abortCommand(); - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("None of the selected points were constrained " "onto the respective curves, " @@ -2780,7 +2782,7 @@ void CmdSketcherConstrainPointOnObject::activated(int iMsg) return; } - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select either one point and several curves, " "or one curve and several points.")); @@ -2827,7 +2829,7 @@ void CmdSketcherConstrainPointOnObject::applyConstraint(std::vector & const Part::Geometry *geom = Obj->getGeometry(GeoIdCrv); if( geom && isBsplinePole(geom)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select an edge that is not a B-spline weight.")); abortCommand(); @@ -2845,7 +2847,7 @@ void CmdSketcherConstrainPointOnObject::applyConstraint(std::vector & } else { abortCommand(); - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("None of the selected points " "were constrained onto the respective curves, " @@ -2907,7 +2909,7 @@ void CmdSketcherConstrainDistanceX::activated(int iMsg) } else { // TODO: Get the exact message from git history and put it here - Gui::TranslatedNotification("Sketcher", QObject::tr("Wrong selection"), + Gui::TranslatedUserWarning("Sketcher", QObject::tr("Wrong selection"), QObject::tr("Select the right things from the sketch.")); } return; @@ -2918,7 +2920,7 @@ void CmdSketcherConstrainDistanceX::activated(int iMsg) Sketcher::SketchObject* Obj = static_cast(selection[0].getObject()); if (SubNames.empty() || SubNames.size() > 2) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select exactly one line or up to two points from the sketch.")); return; @@ -2948,7 +2950,7 @@ void CmdSketcherConstrainDistanceX::activated(int iMsg) if (isEdge(GeoId1,PosId1) && GeoId2 == GeoEnum::GeoUndef) { // horizontal length of a line if (GeoId1 < 0 && GeoId1 >= Sketcher::GeoEnum::VAxis) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Cannot add a horizontal length constraint on an axis!")); return; @@ -2999,7 +3001,7 @@ void CmdSketcherConstrainDistanceX::activated(int iMsg) // point on fixed x-coordinate if (GeoId1 < 0 && GeoId1 >= Sketcher::GeoEnum::VAxis) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Cannot add a fixed x-coordinate constraint on the origin point!")); return; @@ -3029,7 +3031,7 @@ void CmdSketcherConstrainDistanceX::activated(int iMsg) return; } - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select exactly one line or up to two points from the sketch.")); @@ -3060,7 +3062,7 @@ void CmdSketcherConstrainDistanceX::applyConstraint(std::vector &selS const Part::Geometry *geom = Obj->getGeometry(GeoId1); if (geom->getTypeId() != Part::GeomLineSegment::getClassTypeId()) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("This constraint only makes sense on a line segment or a pair of points.")); return; @@ -3165,7 +3167,7 @@ void CmdSketcherConstrainDistanceY::activated(int iMsg) getSelection().clearSelection(); } else { // TODO: Get the exact message from git history and put it here - Gui::TranslatedNotification("Sketcher", QObject::tr("Wrong selection"), + Gui::TranslatedUserWarning("Sketcher", QObject::tr("Wrong selection"), QObject::tr("Select the right things from the sketch.")); } return; @@ -3176,7 +3178,7 @@ void CmdSketcherConstrainDistanceY::activated(int iMsg) Sketcher::SketchObject* Obj = static_cast(selection[0].getObject()); if (SubNames.empty() || SubNames.size() > 2) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select exactly one line or up to two points from the sketch.")); return; @@ -3202,7 +3204,7 @@ void CmdSketcherConstrainDistanceY::activated(int iMsg) if (isEdge(GeoId1,PosId1) && GeoId2 == GeoEnum::GeoUndef) { // vertical length of a line if (GeoId1 < 0 && GeoId1 >= Sketcher::GeoEnum::VAxis) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Cannot add a vertical length constraint on an axis!")); return; @@ -3253,7 +3255,7 @@ void CmdSketcherConstrainDistanceY::activated(int iMsg) else if (isVertex(GeoId1,PosId1) && GeoId2 == GeoEnum::GeoUndef) { // point on fixed y-coordinate if (GeoId1 < 0 && GeoId1 >= Sketcher::GeoEnum::VAxis) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Cannot add a fixed y-coordinate constraint on the origin point!")); return; @@ -3283,7 +3285,7 @@ void CmdSketcherConstrainDistanceY::activated(int iMsg) return; } - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select exactly one line or up to two points from the sketch.")); @@ -3314,7 +3316,7 @@ void CmdSketcherConstrainDistanceY::applyConstraint(std::vector &selS const Part::Geometry *geom = Obj->getGeometry(GeoId1); if (geom->getTypeId() != Part::GeomLineSegment::getClassTypeId()) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("This constraint only makes sense on a line segment or a pair of points.")); return; @@ -3416,7 +3418,7 @@ void CmdSketcherConstrainParallel::activated(int iMsg) getSelection().clearSelection(); } else { // TODO: Get the exact message from git history and put it here - Gui::TranslatedNotification("Sketcher", QObject::tr("Wrong selection"), + Gui::TranslatedUserWarning("Sketcher", QObject::tr("Wrong selection"), QObject::tr("Select two or more lines from the sketch.")); } return; @@ -3429,7 +3431,7 @@ void CmdSketcherConstrainParallel::activated(int iMsg) // go through the selected subelements if (SubNames.size() < 2) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select at least two lines from the sketch.")); return; @@ -3444,7 +3446,7 @@ void CmdSketcherConstrainParallel::activated(int iMsg) getIdsFromName(*it, Obj, GeoId, PosId); if (!isEdge(GeoId,PosId)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select a valid line.")); return; @@ -3461,7 +3463,7 @@ void CmdSketcherConstrainParallel::activated(int iMsg) // Check that the curve is a line segment const Part::Geometry *geo = Obj->getGeometry(GeoId); if (geo->getTypeId() != Part::GeomLineSegment::getClassTypeId()) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("The selected edge is not a valid line.")); @@ -3501,7 +3503,7 @@ void CmdSketcherConstrainParallel::applyConstraint(std::vector &selSe // Check that the curves are line segments if ( Obj->getGeometry(GeoId1)->getTypeId() != Part::GeomLineSegment::getClassTypeId() || Obj->getGeometry(GeoId2)->getTypeId() != Part::GeomLineSegment::getClassTypeId()) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("The selected edge is not a valid line.")); return; @@ -3589,7 +3591,7 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg) QString strError = QObject::tr("Select some geometry from the sketch.", "perpendicular constraint"); strError.append(QString::fromLatin1("\n\n")); strError.append(strBasicHelp); - Gui::TranslatedNotification("Sketcher", QObject::tr("Wrong selection"), + Gui::TranslatedUserWarning("Sketcher", QObject::tr("Wrong selection"), std::move(strError)); } return; @@ -3600,7 +3602,7 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg) Sketcher::SketchObject* Obj = dynamic_cast(selection[0].getObject()); if (!Obj || (SubNames.size() != 2 && SubNames.size() != 3)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Wrong number of selected objects!")); return; @@ -3631,7 +3633,7 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg) if (isEdge(GeoId1, PosId1) && isEdge(GeoId2, PosId2) && isVertex(GeoId3, PosId3)) { if(isBsplinePole(Obj, GeoId1) || isBsplinePole(Obj, GeoId2)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select an edge that is not a B-spline weight.")); return; @@ -3678,7 +3680,7 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg) }; - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("With 3 objects, there must be 2 curves and 1 point.")); @@ -3689,7 +3691,7 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg) if (isSimpleVertex(Obj, GeoId1, PosId1) || isSimpleVertex(Obj, GeoId2, PosId2)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Cannot add a perpendicularity constraint at an unconnected point!")); return; @@ -3727,7 +3729,7 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg) } if (isSimpleVertex(Obj, GeoId1, PosId1)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Cannot add a perpendicularity constraint at an unconnected point!")); return; @@ -3737,14 +3739,14 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg) if( geom2 && geom2->getTypeId() == Part::GeomBSplineCurve::getClassTypeId() ){ // unsupported until normal to B-spline at any point implemented. - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Perpendicular to B-spline edge currently unsupported.")); return; } if(isBsplinePole(geom2)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select an edge that is not a B-spline weight.")); return; @@ -3769,7 +3771,7 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg) if (geo1->getTypeId() != Part::GeomLineSegment::getClassTypeId() && geo2->getTypeId() != Part::GeomLineSegment::getClassTypeId()) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("One of the selected edges should be a line.")); return; @@ -3779,7 +3781,7 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg) geo2->getTypeId() == Part::GeomBSplineCurve::getClassTypeId()){ // unsupported until tangent to B-spline at any point implemented. - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Perpendicular to B-spline edge currently unsupported.")); return; @@ -3789,7 +3791,7 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg) std::swap(GeoId1,GeoId2); if(isBsplinePole(Obj, GeoId1)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select an edge that is not a B-spline weight.")); return; @@ -3950,7 +3952,7 @@ void CmdSketcherConstrainPerpendicular::applyConstraint(std::vector & if (geo1->getTypeId() != Part::GeomLineSegment::getClassTypeId() && geo2->getTypeId() != Part::GeomLineSegment::getClassTypeId()) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("One of the selected edges should be a line.")); return; @@ -3960,7 +3962,7 @@ void CmdSketcherConstrainPerpendicular::applyConstraint(std::vector & geo2->getTypeId() == Part::GeomBSplineCurve::getClassTypeId()){ // unsupported until tangent to B-spline at any point implemented. - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Perpendicular to B-spline edge currently unsupported.")); @@ -3971,7 +3973,7 @@ void CmdSketcherConstrainPerpendicular::applyConstraint(std::vector & std::swap(GeoId1,GeoId2); if(isBsplinePole(Obj, GeoId1)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select an edge that is not a B-spline weight.")); return; @@ -4129,7 +4131,7 @@ void CmdSketcherConstrainPerpendicular::applyConstraint(std::vector & } if(isBsplinePole(Obj, GeoId1) || isBsplinePole(Obj, GeoId2)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select an edge that is not a B-spline weight.")); @@ -4301,7 +4303,7 @@ void CmdSketcherConstrainTangent::activated(int iMsg) QString strError = QObject::tr("Select some geometry from the sketch.", "tangent constraint"); strError.append(QString::fromLatin1("\n\n")); strError.append(strBasicHelp); - Gui::TranslatedNotification("Sketcher", QObject::tr("Wrong selection"), + Gui::TranslatedUserWarning("Sketcher", QObject::tr("Wrong selection"), std::move(strError)); } return; @@ -4312,7 +4314,7 @@ void CmdSketcherConstrainTangent::activated(int iMsg) Sketcher::SketchObject* Obj = static_cast(selection[0].getObject()); if (SubNames.size() != 2 && SubNames.size() != 3){ - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Wrong number of selected objects!")); @@ -4344,7 +4346,7 @@ void CmdSketcherConstrainTangent::activated(int iMsg) if (isEdge(GeoId1, PosId1) && isEdge(GeoId2, PosId2) && isVertex(GeoId3, PosId3)) { if(isBsplinePole(Obj, GeoId1) || isBsplinePole(Obj, GeoId2)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select an edge that is not a B-spline weight.")); @@ -4390,7 +4392,7 @@ void CmdSketcherConstrainTangent::activated(int iMsg) }; - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("With 3 objects, there must be 2 curves and 1 point.")); @@ -4410,7 +4412,7 @@ void CmdSketcherConstrainTangent::activated(int iMsg) if (isBsplineKnot(Obj, GeoId1)) { const Part::Geometry *geom2 = Obj->getGeometry(GeoId2); if (!geom2 || geom2->getTypeId() !=Part::GeomLineSegment::getClassTypeId()) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Tangent constraint at B-spline knot is only supported with lines!")); @@ -4418,7 +4420,7 @@ void CmdSketcherConstrainTangent::activated(int iMsg) } } else { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Cannot add a tangency constraint at an unconnected point!")); @@ -4445,14 +4447,14 @@ void CmdSketcherConstrainTangent::activated(int iMsg) if (isBsplineKnot(Obj, GeoId1)) { const Part::Geometry *geom2 = Obj->getGeometry(GeoId2); if (!geom2 || geom2->getTypeId() !=Part::GeomLineSegment::getClassTypeId()) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Tangent constraint at B-spline knot is only supported with lines!")); return; } } else { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Cannot add a tangency constraint at an unconnected point!")); @@ -4464,7 +4466,7 @@ void CmdSketcherConstrainTangent::activated(int iMsg) if( geom2 && geom2->getTypeId() == Part::GeomBSplineCurve::getClassTypeId() ){ // unsupported until tangent to B-spline at any point implemented. - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Tangency to B-spline edge currently unsupported.")); @@ -4472,7 +4474,7 @@ void CmdSketcherConstrainTangent::activated(int iMsg) } if(isBsplinePole(geom2)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select an edge that is not a B-spline weight.")); @@ -4498,7 +4500,7 @@ void CmdSketcherConstrainTangent::activated(int iMsg) geom2->getTypeId() == Part::GeomBSplineCurve::getClassTypeId() )){ // unsupported until tangent to B-spline at any point implemented. - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Tangency to B-spline edge currently unsupported.")); @@ -4506,7 +4508,7 @@ void CmdSketcherConstrainTangent::activated(int iMsg) } if(isBsplinePole(geom1) || isBsplinePole(geom2)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select an edge that is not a B-spline weight.")); @@ -4696,7 +4698,7 @@ void CmdSketcherConstrainTangent::applyConstraint(std::vector &selSeq geom2->getTypeId() == Part::GeomBSplineCurve::getClassTypeId() )){ // unsupported until tangent to B-spline at any point implemented. - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Tangency to B-spline edge currently unsupported.")); @@ -4704,7 +4706,7 @@ void CmdSketcherConstrainTangent::applyConstraint(std::vector &selSeq } if(isBsplinePole(geom1) || isBsplinePole(geom2)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select an edge that is not a B-spline weight.")); @@ -4857,7 +4859,7 @@ void CmdSketcherConstrainTangent::applyConstraint(std::vector &selSeq if (isSimpleVertex(Obj, GeoId1, PosId1) || isSimpleVertex(Obj, GeoId2, PosId2)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Cannot add a tangency constraint at an unconnected point!")); @@ -4901,7 +4903,7 @@ void CmdSketcherConstrainTangent::applyConstraint(std::vector &selSeq } if(isBsplinePole(Obj, GeoId1) || isBsplinePole(Obj, GeoId2)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select an edge that is not a B-spline weight.")); @@ -4997,7 +4999,7 @@ void CmdSketcherConstrainRadius::activated(int iMsg) getSelection().clearSelection(); } else { // TODO: Get the exact message from git history and put it here - Gui::TranslatedNotification("Sketcher", QObject::tr("Wrong selection"), + Gui::TranslatedUserWarning("Sketcher", QObject::tr("Wrong selection"), QObject::tr("Select the right things from the sketch.")); } return; @@ -5008,7 +5010,7 @@ void CmdSketcherConstrainRadius::activated(int iMsg) Sketcher::SketchObject* Obj = static_cast(selection[0].getObject()); if (SubNames.empty()) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select one or more arcs or circles from the sketch.")); return; @@ -5070,7 +5072,7 @@ void CmdSketcherConstrainRadius::activated(int iMsg) } if (geoIdRadiusMap.empty() && externalGeoIdRadiusMap.empty()) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select one or more arcs or circles from the sketch.")); @@ -5078,7 +5080,7 @@ void CmdSketcherConstrainRadius::activated(int iMsg) } if(poles && nonpoles) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select either only one or more B-Spline poles or only one or more arcs or circles from the sketch, but not mixed.")); @@ -5199,7 +5201,7 @@ void CmdSketcherConstrainRadius::applyConstraint(std::vector &selSeq, radius = circle->getRadius(); } else { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Constraint only applies to arcs or circles.")); @@ -5304,7 +5306,7 @@ void CmdSketcherConstrainDiameter::activated(int iMsg) getSelection().clearSelection(); } else { // TODO: Get the exact message from git history and put it here - Gui::TranslatedNotification("Sketcher", QObject::tr("Wrong selection"), + Gui::TranslatedUserWarning("Sketcher", QObject::tr("Wrong selection"), QObject::tr("Select the right things from the sketch.")); } return; @@ -5315,7 +5317,7 @@ void CmdSketcherConstrainDiameter::activated(int iMsg) Sketcher::SketchObject* Obj = static_cast(selection[0].getObject()); if (SubNames.empty()) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select one or more arcs or circles from the sketch.")); @@ -5359,7 +5361,7 @@ void CmdSketcherConstrainDiameter::activated(int iMsg) double radius = circle->getRadius(); if(isBsplinePole(geom)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select an edge that is not a B-spline weight.")); @@ -5376,7 +5378,7 @@ void CmdSketcherConstrainDiameter::activated(int iMsg) } if (geoIdDiameterMap.empty() && externalGeoIdDiameterMap.empty()) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select one or more arcs or circles from the sketch.")); @@ -5484,7 +5486,7 @@ void CmdSketcherConstrainDiameter::applyConstraint(std::vector &selSe diameter = 2*circle->getRadius(); } else { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Constraint only applies to arcs or circles.")); @@ -5492,7 +5494,7 @@ void CmdSketcherConstrainDiameter::applyConstraint(std::vector &selSe } if(isBsplinePole(geom)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select an edge that is not a B-spline weight.")); @@ -5588,7 +5590,7 @@ void CmdSketcherConstrainRadiam::activated(int iMsg) getSelection().clearSelection(); } else { // TODO: Get the exact message from git history and put it here - Gui::TranslatedNotification("Sketcher", QObject::tr("Wrong selection"), + Gui::TranslatedUserWarning("Sketcher", QObject::tr("Wrong selection"), QObject::tr("Select the right things from the sketch.")); } return; @@ -5599,7 +5601,7 @@ void CmdSketcherConstrainRadiam::activated(int iMsg) Sketcher::SketchObject* Obj = static_cast(selection[0].getObject()); if (SubNames.empty()) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select one or more arcs or circles from the sketch.")); @@ -5656,7 +5658,7 @@ void CmdSketcherConstrainRadiam::activated(int iMsg) } if (geoIdRadiamMap.empty() && externalGeoIdRadiamMap.empty()) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select one or more arcs or circles from the sketch.")); @@ -5664,7 +5666,7 @@ void CmdSketcherConstrainRadiam::activated(int iMsg) } if(poles && nonpoles) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select either only one or more B-Spline poles or only one or more arcs or circles from the sketch, but not mixed.")); @@ -5805,7 +5807,7 @@ void CmdSketcherConstrainRadiam::applyConstraint(std::vector &selSeq, isPole = true; } else { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Constraint only applies to arcs or circles.")); @@ -6055,7 +6057,7 @@ void CmdSketcherConstrainAngle::activated(int iMsg) getSelection().clearSelection(); } else { // TODO: Get the exact message from git history and put it here - Gui::TranslatedNotification("Sketcher", QObject::tr("Wrong selection"), + Gui::TranslatedUserWarning("Sketcher", QObject::tr("Wrong selection"), QObject::tr("Select the right things from the sketch.")); } return; @@ -6066,7 +6068,7 @@ void CmdSketcherConstrainAngle::activated(int iMsg) Sketcher::SketchObject* Obj = static_cast(selection[0].getObject()); if (SubNames.empty() || SubNames.size() > 3) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select one or two lines from the sketch. Or select two edges and a point.")); @@ -6099,7 +6101,7 @@ void CmdSketcherConstrainAngle::activated(int iMsg) if (isEdge(GeoId1, PosId1) && isEdge(GeoId2, PosId2) && isVertex(GeoId3, PosId3)) { if(isBsplinePole(Obj, GeoId1) || isBsplinePole(Obj, GeoId2)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select an edge that is not a B-spline weight.")); return; @@ -6162,7 +6164,7 @@ void CmdSketcherConstrainAngle::activated(int iMsg) } if(isBsplinePole(Obj, GeoId1) || (GeoId2 != GeoEnum::GeoUndef && isBsplinePole(Obj, GeoId2))) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select an edge that is not a B-spline weight.")); @@ -6228,7 +6230,7 @@ void CmdSketcherConstrainAngle::activated(int iMsg) if (dir3.Length() < Precision::Intersection()) { Base::Vector3d dist = (p1[0] - p2[0]) % dir1; if (dist.Sqr() > Precision::Intersection()) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Parallel lines"), QObject::tr("An angle constraint cannot be set for two parallel lines.")); @@ -6262,7 +6264,7 @@ void CmdSketcherConstrainAngle::activated(int iMsg) } } else if (isEdge(GeoId1,PosId1)) { // line angle if (GeoId1 < 0 && GeoId1 >= Sketcher::GeoEnum::VAxis) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Cannot add an angle constraint on an axis!")); @@ -6320,7 +6322,7 @@ void CmdSketcherConstrainAngle::activated(int iMsg) } }; - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select one or two lines from the sketch. Or select two edges and a point.")); @@ -6401,7 +6403,7 @@ void CmdSketcherConstrainAngle::applyConstraint(std::vector &selSeq, if (dir3.Length() < Precision::Intersection()) { Base::Vector3d dist = (p1[0] - p2[0]) % dir1; if (dist.Sqr() > Precision::Intersection()) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Parallel lines"), QObject::tr("An angle constraint cannot be set for two parallel lines.")); @@ -6464,7 +6466,7 @@ void CmdSketcherConstrainAngle::applyConstraint(std::vector &selSeq, if (isEdge(GeoId1, PosId1) && isEdge(GeoId2, PosId2) && isVertex(GeoId3, PosId3)) { if(isBsplinePole(Obj, GeoId1) || isBsplinePole(Obj, GeoId2)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select an edge that is not a B-spline weight.")); @@ -6583,7 +6585,7 @@ void CmdSketcherConstrainEqual::activated(int iMsg) new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } else { - Gui::TranslatedNotification("Sketcher", QObject::tr("Wrong selection"), + Gui::TranslatedUserWarning("Sketcher", QObject::tr("Wrong selection"), QObject::tr("Select two edges from the sketch.")); } return; @@ -6596,7 +6598,7 @@ void CmdSketcherConstrainEqual::activated(int iMsg) // go through the selected subelements if (SubNames.size() < 2) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select at least two lines from the sketch.")); @@ -6614,14 +6616,14 @@ void CmdSketcherConstrainEqual::activated(int iMsg) getIdsFromName(*it, Obj, GeoId, PosId); if (!isEdge(GeoId,PosId)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select two or more compatible edges.")); return; } else if (GeoId == Sketcher::GeoEnum::HAxis || GeoId == Sketcher::GeoEnum::VAxis) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Sketch axes cannot be used in equality constraints.")); @@ -6642,7 +6644,7 @@ void CmdSketcherConstrainEqual::activated(int iMsg) if(geo->getTypeId() == Part::GeomBSplineCurve::getClassTypeId()) { // unsupported as they are generally hereogeneus shapes - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Equality for B-spline edge currently unsupported.")); @@ -6674,7 +6676,7 @@ void CmdSketcherConstrainEqual::activated(int iMsg) parabSel = true; } else { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select two or more edges of similar type.")); @@ -6691,7 +6693,7 @@ void CmdSketcherConstrainEqual::activated(int iMsg) ( hyperbSel && (parabSel || weightSel)) || ( parabSel && weightSel)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select two or more edges of similar type.")); @@ -6744,7 +6746,7 @@ void CmdSketcherConstrainEqual::applyConstraint(std::vector &selSeq, ( (geo1->getTypeId() == Part::GeomEllipse::getClassTypeId() || geo1->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId()) && !(geo2->getTypeId() == Part::GeomEllipse::getClassTypeId() || geo2->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId())) ){ - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select two or more edges of similar type.")); @@ -6828,7 +6830,7 @@ void CmdSketcherConstrainSymmetric::activated(int iMsg) new DrawSketchHandlerGenConstraint(this)); getSelection().clearSelection(); } else { - Gui::TranslatedNotification("Sketcher", QObject::tr("Wrong selection"), + Gui::TranslatedUserWarning("Sketcher", QObject::tr("Wrong selection"), QObject::tr("Select two points and a symmetry line, " "two points and a symmetry point " "or a line and a symmetry point from the sketch.")); @@ -6841,7 +6843,7 @@ void CmdSketcherConstrainSymmetric::activated(int iMsg) Sketcher::SketchObject* Obj = static_cast(selection[0].getObject()); if (SubNames.size() != 3 && SubNames.size() != 2) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select two points and a symmetry line, " "two points and a symmetry point " @@ -6868,7 +6870,7 @@ void CmdSketcherConstrainSymmetric::activated(int iMsg) const Part::Geometry *geom = Obj->getGeometry(GeoId1); if (geom->getTypeId() == Part::GeomLineSegment::getClassTypeId()) { if (GeoId1 == GeoId2) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Cannot add a symmetry constraint " "between a line and its end points.")); @@ -6892,7 +6894,7 @@ void CmdSketcherConstrainSymmetric::activated(int iMsg) } } - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select two points and a symmetry line, " "two points and a symmetry point " @@ -6924,7 +6926,7 @@ void CmdSketcherConstrainSymmetric::activated(int iMsg) const Part::Geometry *geom = Obj->getGeometry(GeoId3); if (geom->getTypeId() == Part::GeomLineSegment::getClassTypeId()) { if (GeoId1 == GeoId2 && GeoId2 == GeoId3) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Cannot add a symmetry constraint " "between a line and its end points!")); @@ -6964,7 +6966,7 @@ void CmdSketcherConstrainSymmetric::activated(int iMsg) } } - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select two points and a symmetry line, " "two points and a symmetry point " @@ -6988,7 +6990,7 @@ void CmdSketcherConstrainSymmetric::applyConstraint(std::vector &selS PosId1 = Sketcher::PointPos::start; PosId2 = Sketcher::PointPos::end; PosId3 = selSeq.at(1).PosId; if (GeoId1 == GeoId3) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Cannot add a symmetry constraint between a line and its end points!")); @@ -7032,7 +7034,7 @@ void CmdSketcherConstrainSymmetric::applyConstraint(std::vector &selS const Part::Geometry *geom = Obj->getGeometry(GeoId3); if (geom->getTypeId() == Part::GeomLineSegment::getClassTypeId()) { if (GeoId1 == GeoId2 && GeoId2 == GeoId3) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Cannot add a symmetry constraint " "between a line and its end points.")); @@ -7050,7 +7052,7 @@ void CmdSketcherConstrainSymmetric::applyConstraint(std::vector &selS tryAutoRecompute(Obj); } else { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select two points and a symmetry line, " "two points and a symmetry point " @@ -7135,7 +7137,7 @@ void CmdSketcherConstrainSnellsLaw::activated(int iMsg) "from one sketch.", dmbg); strError.append(strHelp); - Gui::TranslatedNotification("Sketcher", QObject::tr("Wrong selection"), + Gui::TranslatedUserWarning("Sketcher", QObject::tr("Wrong selection"), std::move(strError)); } @@ -7144,7 +7146,7 @@ void CmdSketcherConstrainSnellsLaw::activated(int iMsg) const std::vector &SubNames = selection[0].getSubNames(); if (SubNames.size() != 3) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Number of selected objects is not 3")); @@ -7169,7 +7171,7 @@ void CmdSketcherConstrainSnellsLaw::activated(int iMsg) //a bunch of validity checks if (areAllPointsOrSegmentsFixed(Obj, GeoId1, GeoId2, GeoId3) ) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Cannot create constraint with external geometry only.")); @@ -7180,7 +7182,7 @@ void CmdSketcherConstrainSnellsLaw::activated(int iMsg) isVertex(GeoId2,PosId2) && !isSimpleVertex(Obj, GeoId2, PosId2) && isEdge(GeoId3,PosId3) )) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Incompatible geometry is selected.")); @@ -7191,7 +7193,7 @@ void CmdSketcherConstrainSnellsLaw::activated(int iMsg) if( geo && geo->getTypeId() == Part::GeomBSplineCurve::getClassTypeId() ){ // unsupported until normal to B-spline at any point implemented. - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("SnellsLaw on B-spline edge is currently unsupported.")); @@ -7199,7 +7201,7 @@ void CmdSketcherConstrainSnellsLaw::activated(int iMsg) } if(isBsplinePole(geo)) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select an edge that is not a B-spline weight.")); @@ -7326,7 +7328,7 @@ void CmdSketcherToggleDrivingConstraint::activated(int iMsg) // only one sketch with its subelements are allowed to be selected if (selection.size() != 1 || !selection[0].isObjectTypeOf(Sketcher::SketchObject::getClassTypeId())) { - Gui::TranslatedNotification("Sketcher", QObject::tr("Wrong selection"), + Gui::TranslatedUserWarning("Sketcher", QObject::tr("Wrong selection"), QObject::tr("Select constraints from the sketch.")); return; } @@ -7336,7 +7338,7 @@ void CmdSketcherToggleDrivingConstraint::activated(int iMsg) // get the needed lists and objects const std::vector &SubNames = selection[0].getSubNames(); if (SubNames.empty()) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select constraints from the sketch.")); @@ -7370,7 +7372,7 @@ void CmdSketcherToggleDrivingConstraint::activated(int iMsg) // get the needed lists and objects const std::vector &SubNames = selection[0].getSubNames(); if (SubNames.empty()) { - Gui::TranslatedNotification(Obj, + Gui::TranslatedUserWarning(Obj, QObject::tr("Wrong selection"), QObject::tr("Select constraints from the sketch.")); @@ -7444,7 +7446,7 @@ void CmdSketcherToggleActiveConstraint::activated(int iMsg) // only one sketch with its subelements are allowed to be selected if (selection.size() != 1 || !selection[0].isObjectTypeOf(Sketcher::SketchObject::getClassTypeId())) { - Gui::TranslatedNotification("Sketcher", + Gui::TranslatedUserWarning("Sketcher", QObject::tr("Wrong selection"), QObject::tr("Select constraints from the sketch.")); return; @@ -7455,7 +7457,7 @@ void CmdSketcherToggleActiveConstraint::activated(int iMsg) // get the needed lists and objects const std::vector &SubNames = selection[0].getSubNames(); if (SubNames.empty()) { - Gui::TranslatedNotification( Obj, + Gui::TranslatedUserWarning( Obj, QObject::tr("Wrong selection"), QObject::tr("Select constraints from the sketch.")); diff --git a/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp b/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp index 15f144f648..9929fb39b3 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp @@ -469,7 +469,7 @@ void ElementView::changeLayer(int layer) } } else { - Gui::TranslatedNotification(sketchobject, + Gui::TranslatedUserWarning(sketchobject, QObject::tr("Unsupported visual layer operation"), QObject::tr("It is currently unsupported to move external geometry to another visual layer. External geometry will be omitted")); }