43#include <pybind11/pybind11.h>
44#include <pybind11/embed.h>
50#include <QCoreApplication>
52#include <OpenFlipper/BasePlugin/PythonFunctions.hh>
53#include <OpenFlipper/PythonInterpreter/PythonTypeConversions.hh>
57namespace py = pybind11;
61PYBIND11_EMBEDDED_MODULE(FilePTS, m) {
63 QObject* pluginPointer = getPluginPointer(
"FilePTS");
66 std::cerr <<
"Error Getting plugin pointer for Plugin-FilePTS" << std::endl;
70 FilePTSPlugin* plugin = qobject_cast<FilePTSPlugin*>(pluginPointer);
73 std::cerr <<
"Error converting plugin pointer for Plugin-FilePTS" << std::endl;
79 py::class_< FilePTSPlugin,std::unique_ptr<FilePTSPlugin, py::nodelete> > pts(m,
"FilePTS");
84 pts.def(py::init([plugin]() {
return plugin; }));
88 pts.def(
"loadObject",
static_cast<int (
FilePTSPlugin::*)(QString)
>( &FilePTSPlugin::loadObject),
89 QCoreApplication::translate(
"PythonDocFilePTS",
"Loads an object and returns its id").toLatin1().data(),
90 py::arg(QCoreApplication::translate(
"PythonDocFilePTS",
"Filename").toLatin1().data()) );
92 pts.def(
"saveObject", &FilePTSPlugin::saveObject,
93 QCoreApplication::translate(
"PythonDocFilePTS",
"saves a given object to a file").toLatin1().data(),
94 py::arg(QCoreApplication::translate(
"PythonDocFilePTS",
"Object id to save").toLatin1().data()),
95 py::arg(QCoreApplication::translate(
"PythonDocFilePTS",
"Filename").toLatin1().data()) );