remove Application::runPythonCode
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/Selection.h>
|
||||
#include <Gui/SelectionFilter.h>
|
||||
@@ -85,29 +86,28 @@ namespace PartGui {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
class ShapeBuilderWidget::Private
|
||||
{
|
||||
public:
|
||||
|
||||
class ShapeBuilderWidget::Private
|
||||
{
|
||||
public:
|
||||
Ui_TaskShapeBuilder ui;
|
||||
QButtonGroup bg;
|
||||
ShapeSelection* gate;
|
||||
Private()
|
||||
{
|
||||
}
|
||||
~Private()
|
||||
{
|
||||
}
|
||||
};
|
||||
{
|
||||
Gui::Command::runCommand(Gui::Command::App, "from FreeCAD import Base");
|
||||
Gui::Command::runCommand(Gui::Command::App, "import Part");
|
||||
}
|
||||
~Private()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/* TRANSLATOR PartGui::ShapeBuilderWidget */
|
||||
|
||||
ShapeBuilderWidget::ShapeBuilderWidget(QWidget* parent)
|
||||
: d(new Private())
|
||||
{
|
||||
Gui::Application::Instance->runPythonCode("from FreeCAD import Base");
|
||||
Gui::Application::Instance->runPythonCode("import Part");
|
||||
|
||||
d->ui.setupUi(this);
|
||||
d->ui.label->setText(QString());
|
||||
d->bg.addButton(d->ui.radioButtonEdgeFromVertex, 0);
|
||||
@@ -157,10 +157,10 @@ void ShapeBuilderWidget::on_createButton_clicked()
|
||||
}
|
||||
doc->getDocument()->recompute();
|
||||
Gui::Selection().clearSelection();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
}
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
Base::Console().Error("%s\n", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
void ShapeBuilderWidget::createEdgeFromVertex()
|
||||
@@ -200,14 +200,14 @@ void ShapeBuilderWidget::createEdgeFromVertex()
|
||||
).arg(elements[0]).arg(elements[1]);
|
||||
|
||||
try {
|
||||
Gui::Application::Instance->activeDocument()->openCommand("Edge");
|
||||
Gui::Application::Instance->runPythonCode((const char*)cmd.toLatin1(), false, false);
|
||||
Gui::Application::Instance->activeDocument()->commitCommand();
|
||||
}
|
||||
catch (const Base::Exception&) {
|
||||
Gui::Application::Instance->activeDocument()->abortCommand();
|
||||
throw;
|
||||
}
|
||||
Gui::Application::Instance->activeDocument()->openCommand("Edge");
|
||||
Gui::Command::runCommand(Gui::Command::App, cmd.toLatin1());
|
||||
Gui::Application::Instance->activeDocument()->commitCommand();
|
||||
}
|
||||
catch (const Base::Exception&) {
|
||||
Gui::Application::Instance->activeDocument()->abortCommand();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void ShapeBuilderWidget::createFaceFromVertex()
|
||||
@@ -252,14 +252,14 @@ void ShapeBuilderWidget::createFaceFromVertex()
|
||||
}
|
||||
|
||||
try {
|
||||
Gui::Application::Instance->activeDocument()->openCommand("Face");
|
||||
Gui::Application::Instance->runPythonCode((const char*)cmd.toLatin1(), false, false);
|
||||
Gui::Application::Instance->activeDocument()->commitCommand();
|
||||
}
|
||||
catch (const Base::Exception&) {
|
||||
Gui::Application::Instance->activeDocument()->abortCommand();
|
||||
throw;
|
||||
}
|
||||
Gui::Application::Instance->activeDocument()->openCommand("Face");
|
||||
Gui::Command::runCommand(Gui::Command::App, cmd.toLatin1());
|
||||
Gui::Application::Instance->activeDocument()->commitCommand();
|
||||
}
|
||||
catch (const Base::Exception&) {
|
||||
Gui::Application::Instance->activeDocument()->abortCommand();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void ShapeBuilderWidget::createFaceFromEdge()
|
||||
@@ -304,14 +304,14 @@ void ShapeBuilderWidget::createFaceFromEdge()
|
||||
}
|
||||
|
||||
try {
|
||||
Gui::Application::Instance->activeDocument()->openCommand("Face");
|
||||
Gui::Application::Instance->runPythonCode((const char*)cmd.toLatin1(), false, false);
|
||||
Gui::Application::Instance->activeDocument()->commitCommand();
|
||||
}
|
||||
catch (const Base::Exception&) {
|
||||
Gui::Application::Instance->activeDocument()->abortCommand();
|
||||
throw;
|
||||
}
|
||||
Gui::Application::Instance->activeDocument()->openCommand("Face");
|
||||
Gui::Command::runCommand(Gui::Command::App, cmd.toLatin1());
|
||||
Gui::Application::Instance->activeDocument()->commitCommand();
|
||||
}
|
||||
catch (const Base::Exception&) {
|
||||
Gui::Application::Instance->activeDocument()->abortCommand();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void ShapeBuilderWidget::createShellFromFace()
|
||||
@@ -367,14 +367,14 @@ void ShapeBuilderWidget::createShellFromFace()
|
||||
}
|
||||
|
||||
try {
|
||||
Gui::Application::Instance->activeDocument()->openCommand("Shell");
|
||||
Gui::Application::Instance->runPythonCode((const char*)cmd.toLatin1(), false, false);
|
||||
Gui::Application::Instance->activeDocument()->commitCommand();
|
||||
}
|
||||
catch (const Base::Exception&) {
|
||||
Gui::Application::Instance->activeDocument()->abortCommand();
|
||||
throw;
|
||||
}
|
||||
Gui::Application::Instance->activeDocument()->openCommand("Shell");
|
||||
Gui::Command::runCommand(Gui::Command::App, cmd.toLatin1());
|
||||
Gui::Application::Instance->activeDocument()->commitCommand();
|
||||
}
|
||||
catch (const Base::Exception&) {
|
||||
Gui::Application::Instance->activeDocument()->abortCommand();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void ShapeBuilderWidget::createSolidFromShell()
|
||||
@@ -419,14 +419,14 @@ void ShapeBuilderWidget::createSolidFromShell()
|
||||
}
|
||||
|
||||
try {
|
||||
Gui::Application::Instance->activeDocument()->openCommand("Solid");
|
||||
Gui::Application::Instance->runPythonCode((const char*)cmd.toLatin1(), false, false);
|
||||
Gui::Application::Instance->activeDocument()->commitCommand();
|
||||
}
|
||||
catch (const Base::Exception&) {
|
||||
Gui::Application::Instance->activeDocument()->abortCommand();
|
||||
throw;
|
||||
}
|
||||
Gui::Application::Instance->activeDocument()->openCommand("Solid");
|
||||
Gui::Command::runCommand(Gui::Command::App, cmd.toLatin1());
|
||||
Gui::Application::Instance->activeDocument()->commitCommand();
|
||||
}
|
||||
catch (const Base::Exception&) {
|
||||
Gui::Application::Instance->activeDocument()->abortCommand();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void ShapeBuilderWidget::switchMode(int mode)
|
||||
|
||||
Reference in New Issue
Block a user