add escape sequence when executing as Python string
This commit is contained in:
@@ -505,6 +505,8 @@ void Application::open(const char* FileName, const char* Module)
|
||||
Base::FileInfo File(FileName);
|
||||
string te = File.extension();
|
||||
string unicodepath = Base::Tools::escapedUnicodeFromUtf8(File.filePath().c_str());
|
||||
unicodepath = Base::Tools::escapeEncodeFilename(unicodepath);
|
||||
|
||||
// if the active document is empty and not modified, close it
|
||||
// in case of an automatically created empty document at startup
|
||||
App::Document* act = App::GetApplication().getActiveDocument();
|
||||
@@ -556,6 +558,7 @@ void Application::importFrom(const char* FileName, const char* DocName, const ch
|
||||
Base::FileInfo File(FileName);
|
||||
std::string te = File.extension();
|
||||
string unicodepath = Base::Tools::escapedUnicodeFromUtf8(File.filePath().c_str());
|
||||
unicodepath = Base::Tools::escapeEncodeFilename(unicodepath);
|
||||
|
||||
if (Module != 0) {
|
||||
try {
|
||||
@@ -613,6 +616,7 @@ void Application::exportTo(const char* FileName, const char* DocName, const char
|
||||
Base::FileInfo File(FileName);
|
||||
std::string te = File.extension();
|
||||
string unicodepath = Base::Tools::escapedUnicodeFromUtf8(File.filePath().c_str());
|
||||
unicodepath = Base::Tools::escapeEncodeFilename(unicodepath);
|
||||
|
||||
if (Module != 0) {
|
||||
try {
|
||||
|
||||
@@ -457,10 +457,8 @@ void CmdMeshImport::activated(int)
|
||||
QStringList fn = Gui::FileDialog::getOpenFileNames(Gui::getMainWindow(),
|
||||
QObject::tr("Import mesh"), QString(), filter.join(QLatin1String(";;")));
|
||||
for (QStringList::Iterator it = fn.begin(); it != fn.end(); ++it) {
|
||||
QFileInfo fi;
|
||||
fi.setFile(*it);
|
||||
|
||||
std::string unicodepath = Base::Tools::escapedUnicodeFromUtf8((*it).toUtf8().data());
|
||||
unicodepath = Base::Tools::escapeEncodeFilename(unicodepath);
|
||||
openCommand("Import Mesh");
|
||||
doCommand(Doc,"import Mesh");
|
||||
doCommand(Doc,"Mesh.insert(u\"%s\")",
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObjectGroup.h>
|
||||
#include <App/DocumentObserver.h>
|
||||
@@ -1012,6 +1013,8 @@ void CmdPartImport::activated(int iMsg)
|
||||
Gui::WaitCursor wc;
|
||||
App::Document* pDoc = getDocument();
|
||||
if (!pDoc) return; // no document
|
||||
|
||||
fn = Base::Tools::escapeEncodeFilename(fn);
|
||||
openCommand("Import Part");
|
||||
if (select == filter[1] ||
|
||||
select == filter[3]) {
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Matrix.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <Gui/Application.h>
|
||||
@@ -81,9 +82,7 @@ void CmdPointsImport::activated(int iMsg)
|
||||
return;
|
||||
|
||||
if (!fn.isEmpty()) {
|
||||
QFileInfo fi;
|
||||
fi.setFile(fn);
|
||||
|
||||
fn = Base::Tools::escapeEncodeFilename(fn);
|
||||
Gui::Document* doc = getActiveGuiDocument();
|
||||
openCommand("Import points");
|
||||
addModule(Command::App, "Points");
|
||||
@@ -131,6 +130,7 @@ void CmdPointsExport::activated(int iMsg)
|
||||
break;
|
||||
|
||||
if (!fn.isEmpty()) {
|
||||
fn = Base::Tools::escapeEncodeFilename(fn);
|
||||
doCommand(Command::Doc, "Points.export([App.ActiveDocument.%s], \"%s\")",
|
||||
(*it)->getNameInDocument(), fn.toUtf8().data());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user