Expose merge project function to python
This commit is contained in:
parent
6774f160be
commit
432a460fda
|
@ -294,9 +294,6 @@ void StdCmdMergeProjects::activated(int iMsg)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString dir1 = proj.absoluteDir().filePath(proj.baseName());
|
|
||||||
QString dir2 = info.absoluteDir().filePath(info.baseName());
|
|
||||||
|
|
||||||
Base::FileInfo fi((const char*)project.toUtf8());
|
Base::FileInfo fi((const char*)project.toUtf8());
|
||||||
Base::ifstream str(fi, std::ios::in | std::ios::binary);
|
Base::ifstream str(fi, std::ios::in | std::ios::binary);
|
||||||
MergeDocuments md(doc);
|
MergeDocuments md(doc);
|
||||||
|
|
|
@ -77,6 +77,11 @@
|
||||||
<Documentation>
|
<Documentation>
|
||||||
<UserDocu>Send a message to all views of the document</UserDocu>
|
<UserDocu>Send a message to all views of the document</UserDocu>
|
||||||
</Documentation>
|
</Documentation>
|
||||||
|
</Methode>
|
||||||
|
<Methode Name="mergeProject">
|
||||||
|
<Documentation>
|
||||||
|
<UserDocu>Merges this document with another project file</UserDocu>
|
||||||
|
</Documentation>
|
||||||
</Methode>
|
</Methode>
|
||||||
<Attribute Name="ActiveObject" ReadOnly="false">
|
<Attribute Name="ActiveObject" ReadOnly="false">
|
||||||
<Documentation>
|
<Documentation>
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <App/Document.h>
|
#include <App/Document.h>
|
||||||
|
|
||||||
#include "Document.h"
|
#include "Document.h"
|
||||||
|
#include "MergeDocuments.h"
|
||||||
#include "ViewProviderExtern.h"
|
#include "ViewProviderExtern.h"
|
||||||
|
|
||||||
// inclusion of the generated files (generated out of DocumentPy.xml)
|
// inclusion of the generated files (generated out of DocumentPy.xml)
|
||||||
|
@ -234,6 +235,22 @@ PyObject* DocumentPy::sendMsgToViews(PyObject *args)
|
||||||
} PY_CATCH;
|
} PY_CATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PyObject* DocumentPy::mergeProject(PyObject *args)
|
||||||
|
{
|
||||||
|
char* filename;
|
||||||
|
if (!PyArg_ParseTuple(args, "s", &filename)) // convert args: Python->C
|
||||||
|
return NULL; // NULL triggers exception
|
||||||
|
|
||||||
|
PY_TRY {
|
||||||
|
Base::FileInfo fi(filename);
|
||||||
|
Base::ifstream str(fi, std::ios::in | std::ios::binary);
|
||||||
|
App::Document* doc = getDocumentPtr()->getDocument();
|
||||||
|
MergeDocuments md(doc);
|
||||||
|
md.importObjects(str);
|
||||||
|
Py_Return;
|
||||||
|
} PY_CATCH;
|
||||||
|
}
|
||||||
|
|
||||||
Py::Object DocumentPy::getActiveObject(void) const
|
Py::Object DocumentPy::getActiveObject(void) const
|
||||||
{
|
{
|
||||||
App::DocumentObject *object = getDocumentPtr()->getDocument()->getActiveObject();
|
App::DocumentObject *object = getDocumentPtr()->getDocument()->getActiveObject();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user