Fix #2972 Export Pdf Page Not in Foreground

exposes TechDrawGui.exportPageAsPdf(page,file)
also adds TechDrawGui.exportPageAsSvg(page,file)
This commit is contained in:
WandererFan
2017-05-08 20:43:39 -04:00
committed by wmayer
parent 6cb5372ad3
commit 62e657f71e
5 changed files with 247 additions and 157 deletions

View File

@@ -29,6 +29,8 @@
#include <Base/Console.h>
#include <Base/PyObjectBase.h>
#include <Base/Interpreter.h>
#include <Gui/Application.h>
#include <Gui/Language/Translator.h>
#include <Gui/WidgetFactory.h>
@@ -67,27 +69,9 @@ void loadTechDrawResource()
}
namespace TechDrawGui {
class Module : public Py::ExtensionModule<Module>
{
public:
Module() : Py::ExtensionModule<Module>("TechDrawGui")
{
initialize("This module is the TechDrawGui module."); // register with Python
}
virtual ~Module() {}
private:
};
PyObject* initModule()
{
return (new Module)->module().ptr();
extern PyObject* initModule();
}
} // namespace TechDrawGui
/* Python entry */
PyMOD_INIT_FUNC(TechDrawGui)
{
@@ -95,6 +79,14 @@ PyMOD_INIT_FUNC(TechDrawGui)
PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
PyMOD_Return(0);
}
// load dependent module
try {
Base::Interpreter().loadModule("TechDraw");
}
catch(const Base::Exception& e) {
PyErr_SetString(PyExc_ImportError, e.what());
PyMOD_Return(0);
}
PyObject* mod = TechDrawGui::initModule();
Base::Console().Log("Loading TechDrawGui module... done\n");