Sketcher: Issue #0004473: Expose openCommand() to translation
Continuing the work to expose the undo/redo functionality to translation. This commit does so for the Sketcher Wb. Ticket: https://tracker.freecadweb.org/view.php?id=4473
This commit is contained in:
@@ -316,7 +316,7 @@ public:
|
||||
resetPositionText();
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch line");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add sketch line"));
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.LineSegment(App.Vector(%f,%f,0),App.Vector(%f,%f,0)),%s)",
|
||||
EditCurve[0].x,EditCurve[0].y,EditCurve[1].x,EditCurve[1].y,
|
||||
geometryCreationMode==Construction?"True":"False");
|
||||
@@ -490,7 +490,7 @@ public:
|
||||
int firstCurve = getHighestCurveIndex() + 1;
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch box");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add sketch box"));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"geoList = []\n"
|
||||
"geoList.append(Part.LineSegment(App.Vector(%f,%f,0),App.Vector(%f,%f,0)))\n"
|
||||
@@ -978,7 +978,7 @@ public:
|
||||
// issue the geometry
|
||||
try {
|
||||
// open the transaction
|
||||
Gui::Command::openCommand("Add line to sketch wire");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add line to sketch wire"));
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.LineSegment(App.Vector(%f,%f,0),App.Vector(%f,%f,0)),%s)",
|
||||
EditCurve[0].x,EditCurve[0].y,EditCurve[1].x,EditCurve[1].y,
|
||||
geometryCreationMode==Construction?"True":"False");
|
||||
@@ -998,7 +998,7 @@ public:
|
||||
}
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add arc to sketch wire");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add arc to sketch wire"));
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.ArcOfCircle"
|
||||
"(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),%f,%f),%s)",
|
||||
CenterPoint.x, CenterPoint.y, std::abs(arcRadius),
|
||||
@@ -1441,7 +1441,7 @@ public:
|
||||
resetPositionText();
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch arc");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add sketch arc"));
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.ArcOfCircle"
|
||||
"(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),%f,%f),%s)",
|
||||
CenterPoint.x, CenterPoint.y, sqrt(rx*rx + ry*ry),
|
||||
@@ -1710,7 +1710,7 @@ public:
|
||||
resetPositionText();
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch arc");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add sketch arc"));
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.ArcOfCircle"
|
||||
"(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),%f,%f),%s)",
|
||||
CenterPoint.x, CenterPoint.y, radius,
|
||||
@@ -1979,7 +1979,7 @@ public:
|
||||
resetPositionText();
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch circle");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add sketch circle"));
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.Circle"
|
||||
"(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),%s)",
|
||||
EditCurve[0].x, EditCurve[0].y,
|
||||
@@ -2738,7 +2738,7 @@ private:
|
||||
int currentgeoid = getHighestCurveIndex(); // index of the ellipse we just created
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch ellipse");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add sketch ellipse"));
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.Ellipse"
|
||||
"(App.Vector(%f,%f,0),App.Vector(%f,%f,0),App.Vector(%f,%f,0)),%s)",
|
||||
periapsis.x, periapsis.y,
|
||||
@@ -3107,7 +3107,7 @@ public:
|
||||
int currentgeoid = getHighestCurveIndex();
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch arc of ellipse");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add sketch arc of ellipse"));
|
||||
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.ArcOfEllipse"
|
||||
"(Part.Ellipse(App.Vector(%f,%f,0),App.Vector(%f,%f,0),App.Vector(%f,%f,0)),%f,%f),%s)",
|
||||
@@ -3445,7 +3445,7 @@ public:
|
||||
|
||||
try {
|
||||
|
||||
Gui::Command::openCommand("Add sketch arc of hyperbola");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add sketch arc of hyperbola"));
|
||||
|
||||
//Add arc of hyperbola, point and constrain point as focus2. We add focus2 for it to balance
|
||||
//the intrinsic focus1, in order to balance out the intrinsic invisible focus1 when AOE is
|
||||
@@ -3747,7 +3747,7 @@ public:
|
||||
int currentgeoid = getHighestCurveIndex();
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch arc of Parabola");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add sketch arc of Parabola"));
|
||||
|
||||
//Add arc of parabola
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.ArcOfParabola"
|
||||
@@ -4070,7 +4070,7 @@ public:
|
||||
// insert circle point for pole, defer internal alignment constraining.
|
||||
try {
|
||||
|
||||
Gui::Command::openCommand("Add Pole circle");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add Pole circle"));
|
||||
|
||||
//Add pole
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),10),True)",
|
||||
@@ -4131,7 +4131,7 @@ public:
|
||||
// insert circle point for pole, defer internal alignment constraining.
|
||||
try {
|
||||
|
||||
//Gui::Command::openCommand("Add Pole circle");
|
||||
//Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add Pole circle"));
|
||||
|
||||
//Add pole
|
||||
double guess = (EditCurve[1]-EditCurve[0]).Length()/6;
|
||||
@@ -4223,7 +4223,7 @@ public:
|
||||
|
||||
try {
|
||||
|
||||
//Gui::Command::openCommand("Add B-spline curve");
|
||||
//Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add B-spline curve"));
|
||||
|
||||
/*Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.BSplineCurve"
|
||||
"(%s,%s),"
|
||||
@@ -4686,7 +4686,7 @@ public:
|
||||
resetPositionText();
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch circle");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add sketch circle"));
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.Circle"
|
||||
"(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),%s)",
|
||||
CenterPoint.x, CenterPoint.y,
|
||||
@@ -4913,7 +4913,7 @@ public:
|
||||
resetPositionText();
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add sketch point");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add sketch point"));
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addGeometry(Part.Point(App.Vector(%f,%f,0)))",
|
||||
EditPoint.x,EditPoint.y);
|
||||
|
||||
@@ -5156,7 +5156,7 @@ public:
|
||||
int currentgeoid= getHighestCurveIndex();
|
||||
// create fillet at point
|
||||
try {
|
||||
Gui::Command::openCommand("Create fillet");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Create fillet"));
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "fillet(%d,%d,%f)", GeoId, PosId, radius);
|
||||
|
||||
if (construction) {
|
||||
@@ -5232,7 +5232,7 @@ public:
|
||||
|
||||
// create fillet between lines
|
||||
try {
|
||||
Gui::Command::openCommand("Create fillet");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Create fillet"));
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "fillet(%d,%d,App.Vector(%f,%f,0),App.Vector(%f,%f,0),%f)",
|
||||
firstCurve, secondCurve,
|
||||
firstPos.x, firstPos.y,
|
||||
@@ -5384,7 +5384,7 @@ public:
|
||||
geom->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId() ||
|
||||
geom->getTypeId() == Part::GeomEllipse::getClassTypeId()) {
|
||||
try {
|
||||
Gui::Command::openCommand("Trim edge");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Trim edge"));
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "trim(%d,App.Vector(%f,%f,0))",
|
||||
GeoId, onSketchPos.x, onSketchPos.y);
|
||||
Gui::Command::commitCommand();
|
||||
@@ -5655,7 +5655,7 @@ public:
|
||||
}
|
||||
} else if (Mode == STATUS_SEEK_Second) {
|
||||
try {
|
||||
Gui::Command::openCommand("Extend edge");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Extend edge"));
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "extend(%d, %f, %d)\n", // GeoId, increment, PointPos
|
||||
BaseGeoId, Increment, ExtendFromStart ? Sketcher::start : Sketcher::end);
|
||||
Gui::Command::commitCommand();
|
||||
@@ -5871,7 +5871,7 @@ public:
|
||||
(subName.size() > 6 && subName.substr(0,6) == "Vertex") ||
|
||||
(subName.size() > 4 && subName.substr(0,4) == "Face")) {
|
||||
try {
|
||||
Gui::Command::openCommand("Add external geometry");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add external geometry"));
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "addExternal(\"%s\",\"%s\")",
|
||||
msg.pObjectName, msg.pSubName);
|
||||
Gui::Command::commitCommand();
|
||||
@@ -6052,7 +6052,7 @@ namespace SketcherGui {
|
||||
if (obj->getTypeId() == Sketcher::SketchObject::getClassTypeId()) {
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add carbon copy");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add carbon copy"));
|
||||
Gui::cmdAppObjectArgs(sketchgui->getObject(), "carbonCopy(\"%s\",%s)",
|
||||
msg.pObjectName, geometryCreationMode==Construction?"True":"False");
|
||||
|
||||
@@ -6233,7 +6233,7 @@ public:
|
||||
}
|
||||
|
||||
try {
|
||||
Gui::Command::openCommand("Add slot");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add slot"));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"geoList = []\n"
|
||||
"geoList.append(Part.ArcOfCircle(Part.Circle(App.Vector(%f,%f,0),App.Vector(0,0,1),%f),%f,%f))\n"
|
||||
@@ -6446,7 +6446,7 @@ public:
|
||||
if (Mode==STATUS_End){
|
||||
unsetCursor();
|
||||
resetPositionText();
|
||||
Gui::Command::openCommand("Add hexagon");
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add hexagon"));
|
||||
|
||||
try {
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
|
||||
Reference in New Issue
Block a user