From 0b53e86e5a72d68850057d133f9f640c46e8768e Mon Sep 17 00:00:00 2001 From: Tannin Date: Sun, 6 Dec 2015 20:55:36 +0100 Subject: [PATCH] updated python api --- src/runner/pythonrunner.cpp | 9 ++++++++- src/runner/uibasewrappers.h | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index 115f540..4b9ece1 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -71,7 +71,7 @@ struct ModRepositoryFileInfo_to_python_dict PyDict_SetItemString(res, "description", bpy::incref(bpy::object(info.description.toUtf8().constData()).ptr())); PyDict_SetItemString(res, "categoryID", PyLong_FromLong(info.categoryID)); PyDict_SetItemString(res, "fileID", PyLong_FromLong(info.fileID)); - PyDict_SetItemString(res, "fileSize", PyLong_FromLong(info.fileSize)); + PyDict_SetItemString(res, "fileSize", PyLong_FromLong(static_cast(info.fileSize))); PyDict_SetItemString(res, "version", bpy::incref(bpy::object(info.version).ptr())); return bpy::incref(res); } @@ -731,6 +731,13 @@ BOOST_PYTHON_MODULE(mobase) .def("onFinishedRun", bpy::pure_virtual(&IOrganizer::onFinishedRun)) .def("onModInstalled", bpy::pure_virtual(&IOrganizer::onModInstalled)) .def("refreshModList", bpy::pure_virtual(&IOrganizer::refreshModList)) + .def("profile", bpy::pure_virtual(&IOrganizer::profile), bpy::return_value_policy()) + ; + + bpy::class_("IProfile") + .def("name", bpy::pure_virtual(&IProfile::name)) + .def("absolutePath", bpy::pure_virtual(&IProfile::absolutePath)) + .def("localSavesEnabled", bpy::pure_virtual(&IProfile::localSavesEnabled)) ; bpy::class_("ModRepositoryBridge") diff --git a/src/runner/uibasewrappers.h b/src/runner/uibasewrappers.h index 7c0edd2..93f1410 100644 --- a/src/runner/uibasewrappers.h +++ b/src/runner/uibasewrappers.h @@ -232,6 +232,14 @@ struct IOrganizerWrapper: MOBase::IOrganizer, boost::python::wrapper &func) { return this->get_override("onAboutToRun")(func); } virtual bool onFinishedRun(const std::function &func) { return this->get_override("onFinishedRun")(func); } virtual bool onModInstalled(const std::function &func) { return this->get_override("onModInstalled")(func); } + virtual MOBase::IProfile *profile() override { return this->get_override("profile")(); } +}; + +struct IProfileWrapper: MOBase::IProfile, boost::python::wrapper +{ + virtual QString name() const { return this->get_override("name")(); } + virtual QString absolutePath() const { return this->get_override("absolutePath")(); } + virtual bool localSavesEnabled() const { return this->get_override("localSavesEnabled")(); } }; struct IDownloadManagerWrapper: MOBase::IDownloadManager, boost::python::wrapper