do not use doCommand without using format string, add overloaded method of runCommand
This commit is contained in:
@@ -189,7 +189,7 @@ const QString TaskFemConstraint::makeRefText(const App::DocumentObject* obj, con
|
||||
void TaskDlgFemConstraint::open()
|
||||
{
|
||||
ConstraintView->setVisible(true);
|
||||
Gui::Command::doCommand(Gui::Command::Doc,ViewProviderFemConstraint::gethideMeshShowPartStr((static_cast<Fem::Constraint*>(ConstraintView->getObject()))->getNameInDocument()).c_str()); //OvG: Hide meshes and show parts
|
||||
Gui::Command::runCommand(Gui::Command::Doc,ViewProviderFemConstraint::gethideMeshShowPartStr((static_cast<Fem::Constraint*>(ConstraintView->getObject()))->getNameInDocument()).c_str()); //OvG: Hide meshes and show parts
|
||||
}
|
||||
|
||||
bool TaskDlgFemConstraint::accept()
|
||||
|
||||
@@ -453,7 +453,7 @@ void TaskDlgFemConstraintContact::open()
|
||||
QString msg = QObject::tr("Constraint Contact");
|
||||
Gui::Command::openCommand((const char*)msg.toUtf8());
|
||||
ConstraintView->setVisible(true);
|
||||
Gui::Command::doCommand(Gui::Command::Doc,ViewProviderFemConstraint::gethideMeshShowPartStr((static_cast<Fem::Constraint*>(ConstraintView->getObject()))->getNameInDocument()).c_str()); //OvG: Hide meshes and show parts
|
||||
Gui::Command::runCommand(Gui::Command::Doc,ViewProviderFemConstraint::gethideMeshShowPartStr((static_cast<Fem::Constraint*>(ConstraintView->getObject()))->getNameInDocument()).c_str()); //OvG: Hide meshes and show parts
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -328,7 +328,7 @@ bool Tessellation::accept()
|
||||
.arg(label);
|
||||
}
|
||||
}
|
||||
Gui::Command::doCommand(Gui::Command::Doc, (const char*)cmd.toUtf8());
|
||||
Gui::Command::runCommand(Gui::Command::Doc, cmd.toUtf8());
|
||||
|
||||
// if Standard mesher is used and face colors should be applied
|
||||
if (method == 0) { // Standard
|
||||
|
||||
@@ -1016,7 +1016,7 @@ void CmdPartMakeSolid::activated(int iMsg)
|
||||
{
|
||||
std::vector<App::DocumentObject*> objs = Gui::Selection().getObjectsOfType
|
||||
(Part::Feature::getClassTypeId());
|
||||
doCommand(Doc, "import Part");
|
||||
runCommand(Doc, "import Part");
|
||||
for (std::vector<App::DocumentObject*>::iterator it = objs.begin(); it != objs.end(); ++it) {
|
||||
const TopoDS_Shape& shape = static_cast<Part::Feature*>(*it)->Shape.getValue();
|
||||
if (!shape.IsNull()) {
|
||||
@@ -1057,7 +1057,7 @@ void CmdPartMakeSolid::activated(int iMsg)
|
||||
|
||||
try {
|
||||
if (!str.isEmpty())
|
||||
doCommand(Doc, (const char*)str.toLatin1());
|
||||
runCommand(Doc, str.toLatin1());
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("Cannot convert %s because %s.\n",
|
||||
@@ -1094,7 +1094,7 @@ void CmdPartReverseShape::activated(int iMsg)
|
||||
{
|
||||
std::vector<App::DocumentObject*> objs = Gui::Selection().getObjectsOfType
|
||||
(Part::Feature::getClassTypeId());
|
||||
doCommand(Doc, "import Part");
|
||||
runCommand(Doc, "import Part");
|
||||
for (std::vector<App::DocumentObject*>::iterator it = objs.begin(); it != objs.end(); ++it) {
|
||||
const TopoDS_Shape& shape = static_cast<Part::Feature*>(*it)->Shape.getValue();
|
||||
if (!shape.IsNull()) {
|
||||
@@ -1111,7 +1111,7 @@ void CmdPartReverseShape::activated(int iMsg)
|
||||
|
||||
try {
|
||||
if (!str.isEmpty())
|
||||
doCommand(Doc, (const char*)str.toLatin1());
|
||||
runCommand(Doc, str.toLatin1());
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("Cannot convert %s because %s.\n",
|
||||
@@ -1217,7 +1217,7 @@ void CmdPartMakeFace::activated(int iMsg)
|
||||
|
||||
str << ")";
|
||||
|
||||
doCommand(Doc,str.str().c_str());
|
||||
runCommand(Doc,str.str().c_str());
|
||||
commitCommand();
|
||||
updateActive();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
# include <QApplication>
|
||||
# include <QDir>
|
||||
# include <QFileInfo>
|
||||
# include <QLineEdit>
|
||||
# include <QLineEdit>
|
||||
#endif
|
||||
|
||||
#include <Gui/Application.h>
|
||||
@@ -57,13 +57,13 @@ void CmdPartCylinder::activated(int iMsg)
|
||||
cmd = qApp->translate("CmdPartCylinder","Cylinder");
|
||||
openCommand((const char*)cmd.toUtf8());
|
||||
|
||||
doCommand(Doc,"App.ActiveDocument.addObject(\"Part::Cylinder\",\"Cylinder\")");
|
||||
runCommand(Doc,"App.ActiveDocument.addObject(\"Part::Cylinder\",\"Cylinder\")");
|
||||
cmd = QString::fromLatin1("App.ActiveDocument.ActiveObject.Label = \"%1\"")
|
||||
.arg(qApp->translate("CmdPartCylinder","Cylinder"));
|
||||
doCommand(Doc,(const char*)cmd.toUtf8());
|
||||
runCommand(Doc,cmd.toUtf8());
|
||||
commitCommand();
|
||||
updateActive();
|
||||
doCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");
|
||||
runCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");
|
||||
}
|
||||
|
||||
bool CmdPartCylinder::isActive(void)
|
||||
@@ -97,13 +97,13 @@ void CmdPartBox::activated(int iMsg)
|
||||
cmd = qApp->translate("CmdPartBox","Cube");
|
||||
openCommand((const char*)cmd.toUtf8());
|
||||
|
||||
doCommand(Doc,"App.ActiveDocument.addObject(\"Part::Box\",\"Box\")");
|
||||
runCommand(Doc,"App.ActiveDocument.addObject(\"Part::Box\",\"Box\")");
|
||||
cmd = QString::fromLatin1("App.ActiveDocument.ActiveObject.Label = \"%1\"")
|
||||
.arg(qApp->translate("CmdPartBox","Cube"));
|
||||
doCommand(Doc,(const char*)cmd.toUtf8());
|
||||
runCommand(Doc,cmd.toUtf8());
|
||||
commitCommand();
|
||||
updateActive();
|
||||
doCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");
|
||||
runCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");
|
||||
}
|
||||
|
||||
bool CmdPartBox::isActive(void)
|
||||
@@ -137,13 +137,13 @@ void CmdPartSphere::activated(int iMsg)
|
||||
cmd = qApp->translate("CmdPartSphere","Sphere");
|
||||
openCommand((const char*)cmd.toUtf8());
|
||||
|
||||
doCommand(Doc,"App.ActiveDocument.addObject(\"Part::Sphere\",\"Sphere\")");
|
||||
runCommand(Doc,"App.ActiveDocument.addObject(\"Part::Sphere\",\"Sphere\")");
|
||||
cmd = QString::fromLatin1("App.ActiveDocument.ActiveObject.Label = \"%1\"")
|
||||
.arg(qApp->translate("CmdPartSphere","Sphere"));
|
||||
doCommand(Doc,(const char*)cmd.toUtf8());
|
||||
runCommand(Doc,cmd.toUtf8());
|
||||
commitCommand();
|
||||
updateActive();
|
||||
doCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");
|
||||
runCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");
|
||||
}
|
||||
|
||||
bool CmdPartSphere::isActive(void)
|
||||
@@ -177,13 +177,13 @@ void CmdPartCone::activated(int iMsg)
|
||||
cmd = qApp->translate("CmdPartCone","Cone");
|
||||
openCommand((const char*)cmd.toUtf8());
|
||||
|
||||
doCommand(Doc,"App.ActiveDocument.addObject(\"Part::Cone\",\"Cone\")");
|
||||
runCommand(Doc,"App.ActiveDocument.addObject(\"Part::Cone\",\"Cone\")");
|
||||
cmd = QString::fromLatin1("App.ActiveDocument.ActiveObject.Label = \"%1\"")
|
||||
.arg(qApp->translate("CmdPartCone","Cone"));
|
||||
doCommand(Doc,(const char*)cmd.toUtf8());
|
||||
runCommand(Doc,cmd.toUtf8());
|
||||
commitCommand();
|
||||
updateActive();
|
||||
doCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");
|
||||
runCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");
|
||||
}
|
||||
|
||||
bool CmdPartCone::isActive(void)
|
||||
@@ -217,13 +217,13 @@ void CmdPartTorus::activated(int iMsg)
|
||||
cmd = qApp->translate("CmdPartTorus","Torus");
|
||||
openCommand((const char*)cmd.toUtf8());
|
||||
|
||||
doCommand(Doc,"App.ActiveDocument.addObject(\"Part::Torus\",\"Torus\")");
|
||||
runCommand(Doc,"App.ActiveDocument.addObject(\"Part::Torus\",\"Torus\")");
|
||||
cmd = QString::fromLatin1("App.ActiveDocument.ActiveObject.Label = \"%1\"")
|
||||
.arg(qApp->translate("CmdPartTorus","Torus"));
|
||||
doCommand(Doc,(const char*)cmd.toUtf8());
|
||||
runCommand(Doc,cmd.toUtf8());
|
||||
commitCommand();
|
||||
updateActive();
|
||||
doCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");
|
||||
runCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");
|
||||
}
|
||||
|
||||
bool CmdPartTorus::isActive(void)
|
||||
|
||||
@@ -100,10 +100,10 @@ void Picker::createPrimitive(QWidget* widget, const QString& descr, Gui::Documen
|
||||
|
||||
// Execute the Python block
|
||||
doc->openCommand(descr.toUtf8());
|
||||
Gui::Command::doCommand(Gui::Command::Doc, (const char*)cmd.toLatin1());
|
||||
Gui::Command::runCommand(Gui::Command::Doc, cmd.toLatin1());
|
||||
doc->commitCommand();
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");
|
||||
Gui::Command::runCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
|
||||
Gui::Command::runCommand(Gui::Command::Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
QMessageBox::warning(widget, descr, QString::fromLatin1(e.what()));
|
||||
@@ -666,10 +666,10 @@ void DlgPrimitives::createPrimitive(const QString& placement)
|
||||
// Execute the Python block
|
||||
QString prim = tr("Create %1").arg(ui.comboBox1->currentText());
|
||||
Gui::Application::Instance->activeDocument()->openCommand(prim.toUtf8());
|
||||
Gui::Command::doCommand(Gui::Command::Doc, (const char*)cmd.toUtf8());
|
||||
Gui::Command::runCommand(Gui::Command::Doc, cmd.toUtf8());
|
||||
Gui::Application::Instance->activeDocument()->commitCommand();
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");
|
||||
Gui::Command::runCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
|
||||
Gui::Command::runCommand(Gui::Command::Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");
|
||||
}
|
||||
catch (const Base::PyException& e) {
|
||||
QMessageBox::warning(this, tr("Create %1")
|
||||
|
||||
@@ -327,7 +327,7 @@ bool TaskDlgBooleanParameters::accept()
|
||||
for (std::vector<std::string>::const_iterator it = bodies.begin(); it != bodies.end(); ++it)
|
||||
str << "App.ActiveDocument." << *it << ",";
|
||||
str << "]";
|
||||
Gui::Command::doCommand(Gui::Command::Doc,str.str().c_str());
|
||||
Gui::Command::runCommand(Gui::Command::Doc,str.str().c_str());
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
QMessageBox::warning(parameter, tr("Boolean: Accept: Input error"), QString::fromLatin1(e.what()));
|
||||
|
||||
@@ -219,7 +219,7 @@ bool TaskDlgDressUpParameters::accept()
|
||||
for (std::vector<std::string>::const_iterator it = refs.begin(); it != refs.end(); ++it)
|
||||
str << "\"" << *it << "\",";
|
||||
str << "])";
|
||||
Gui::Command::doCommand(Gui::Command::Doc,str.str().c_str());
|
||||
Gui::Command::runCommand(Gui::Command::Doc,str.str().c_str());
|
||||
|
||||
return TaskDlgFeatureParameters::accept();
|
||||
}
|
||||
|
||||
@@ -588,9 +588,9 @@ void TaskBoxPrimitives::setPrimitive(QString name)
|
||||
// Execute the Python block
|
||||
QString prim = tr("Create primitive");
|
||||
Gui::Application::Instance->activeDocument()->openCommand(prim.toUtf8());
|
||||
Gui::Command::doCommand(Gui::Command::Doc, (const char*)cmd.toUtf8());
|
||||
Gui::Command::runCommand(Gui::Command::Doc, cmd.toUtf8());
|
||||
Gui::Application::Instance->activeDocument()->commitCommand();
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
|
||||
Gui::Command::runCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
|
||||
}
|
||||
catch (const Base::PyException& e) {
|
||||
QMessageBox::warning(this, tr("Create primitive"), QString::fromLatin1(e.what()));
|
||||
|
||||
@@ -150,7 +150,7 @@ void CmdRaytracingWriteCamera::activated(int iMsg)
|
||||
<< "(" << upvec.getValue()[0] <<"," << upvec.getValue()[1] <<"," << upvec.getValue()[2] <<") )" ;
|
||||
|
||||
doCommand(Doc,"import Raytracing");
|
||||
doCommand(Gui,out.str().c_str());
|
||||
doCommand(Gui,"%s", out.str().c_str());
|
||||
|
||||
// Bring ref-count of root-node back to zero to cause the
|
||||
// destruction of the camera.
|
||||
@@ -201,7 +201,7 @@ void CmdRaytracingWritePart::activated(int iMsg)
|
||||
<< Name << "\",App.ActiveDocument." << obj.front()->getNameInDocument() << ".Shape)";
|
||||
|
||||
doCommand(Doc,"import Raytracing");
|
||||
doCommand(Doc,out.str().c_str());
|
||||
doCommand(Doc,"%s",out.str().c_str());
|
||||
}
|
||||
|
||||
bool CmdRaytracingWritePart::isActive(void)
|
||||
|
||||
@@ -171,7 +171,7 @@ void CmdApproxPlane::activated(int iMsg)
|
||||
<< "Base.Rotation(" << q0 << "," << q1 << "," << q2 << "," << q3 << "))" << std::endl;
|
||||
|
||||
openCommand("Fit plane");
|
||||
doCommand(Gui::Command::Doc, str.str().c_str());
|
||||
runCommand(Gui::Command::Doc, str.str().c_str());
|
||||
commitCommand();
|
||||
updateActive();
|
||||
}
|
||||
@@ -251,7 +251,7 @@ void CmdViewTriangulation::activated(int iMsg)
|
||||
.arg(document)
|
||||
.arg(object)
|
||||
;
|
||||
doCommand(Doc, command.toLatin1());
|
||||
runCommand(Doc, command.toLatin1());
|
||||
}
|
||||
|
||||
commitCommand();
|
||||
|
||||
@@ -165,7 +165,7 @@ bool FitBSplineSurfaceWidget::accept()
|
||||
Gui::WaitCursor wc;
|
||||
Gui::Command::addModule(Gui::Command::App, "ReverseEngineering");
|
||||
Gui::Command::openCommand("Fit B-Spline");
|
||||
Gui::Command::doCommand(Gui::Command::Doc, command.toLatin1());
|
||||
Gui::Command::runCommand(Gui::Command::Doc, command.toLatin1());
|
||||
Gui::Command::commitCommand();
|
||||
Gui::Command::updateActive();
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ bool PoissonWidget::accept()
|
||||
Gui::WaitCursor wc;
|
||||
Gui::Command::addModule(Gui::Command::App, "ReverseEngineering");
|
||||
Gui::Command::openCommand("Poisson reconstruction");
|
||||
Gui::Command::doCommand(Gui::Command::Doc, command.toLatin1());
|
||||
Gui::Command::runCommand(Gui::Command::Doc, command.toLatin1());
|
||||
Gui::Command::commitCommand();
|
||||
Gui::Command::updateActive();
|
||||
}
|
||||
|
||||
@@ -4255,7 +4255,7 @@ bool ViewProviderSketch::setEdit(int ModNum)
|
||||
);
|
||||
cmdstr.replace(QString::fromLatin1("{sketch_name}"),QString::fromLatin1(this->getSketchObject()->getNameInDocument()));
|
||||
QByteArray cmdstr_bytearray = cmdstr.toLatin1();
|
||||
Gui::Command::doCommand(Gui::Command::Gui, cmdstr_bytearray.data());
|
||||
Gui::Command::runCommand(Gui::Command::Gui, cmdstr_bytearray);
|
||||
} catch (Base::PyException &e){
|
||||
Base::Console().Error("ViewProviderSketch::setEdit: visibility automation failed with an error: \n");
|
||||
e.ReportException();
|
||||
@@ -4620,7 +4620,7 @@ void ViewProviderSketch::unsetEdit(int ModNum)
|
||||
);
|
||||
cmdstr.replace(QString::fromLatin1("{sketch_name}"),QString::fromLatin1(this->getSketchObject()->getNameInDocument()));
|
||||
QByteArray cmdstr_bytearray = cmdstr.toLatin1();
|
||||
Gui::Command::doCommand(Gui::Command::Gui, cmdstr_bytearray.data());
|
||||
Gui::Command::runCommand(Gui::Command::Gui, cmdstr_bytearray);
|
||||
} catch (Base::PyException &e){
|
||||
Base::Console().Error("ViewProviderSketch::unsetEdit: visibility automation failed with an error: \n");
|
||||
e.ReportException();
|
||||
@@ -4667,7 +4667,7 @@ void ViewProviderSketch::setEditViewer(Gui::View3DInventorViewer* viewer, int Mo
|
||||
);
|
||||
cmdstr.replace(QString::fromLatin1("{sketch_name}"),QString::fromLatin1(this->getSketchObject()->getNameInDocument()));
|
||||
QByteArray cmdstr_bytearray = cmdstr.toLatin1();
|
||||
Gui::Command::doCommand(Gui::Command::Gui, cmdstr_bytearray.data());
|
||||
Gui::Command::runCommand(Gui::Command::Gui, cmdstr_bytearray);
|
||||
} catch (Base::PyException &e){
|
||||
Base::Console().Error("ViewProviderSketch::setEdit: visibility automation failed with an error: \n");
|
||||
e.ReportException();
|
||||
|
||||
Reference in New Issue
Block a user