diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index c503221..404f299 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -371,16 +371,15 @@ BOOST_PYTHON_MODULE(mobase) } - bpy::class_("IProfile") - .def("name", bpy::pure_virtual(&IProfile::name)) - .def("absolutePath", bpy::pure_virtual(&IProfile::absolutePath)) - .def("localSavesEnabled", bpy::pure_virtual(&IProfile::localSavesEnabled)) - .def("localSettingsEnabled", bpy::pure_virtual(&IProfile::localSettingsEnabled)) - .def("invalidationActive", bpy::pure_virtual(&IProfile::invalidationActive)) + bpy::class_("IProfile", bpy::no_init) + .def("name", &IProfile::name) + .def("absolutePath", &IProfile::absolutePath) + .def("localSavesEnabled", &IProfile::localSavesEnabled) + .def("localSettingsEnabled", &IProfile::localSettingsEnabled) + .def("invalidationActive", &IProfile::invalidationActive) ; - bpy::class_("ModRepositoryBridge") - .def(bpy::init>()) + bpy::class_("ModRepositoryBridge", bpy::no_init) .def("requestDescription", &IModRepositoryBridge::requestDescription) .def("requestFiles", &IModRepositoryBridge::requestFiles) .def("requestFileInfo", &IModRepositoryBridge::requestFileInfo) @@ -390,15 +389,7 @@ BOOST_PYTHON_MODULE(mobase) Q_DELEGATE(IModRepositoryBridge, QObject, "_object") ; - bpy::class_("IModRepositoryBridge") - .def("requestDescription", bpy::pure_virtual(&IModRepositoryBridge::requestDescription)) - .def("requestFiles", bpy::pure_virtual(&IModRepositoryBridge::requestFiles)) - .def("requestFileInfo", bpy::pure_virtual(&IModRepositoryBridge::requestFileInfo)) - .def("requestDownloadURL", bpy::pure_virtual(&IModRepositoryBridge::requestDownloadURL)) - .def("requestToggleEndorsement", bpy::pure_virtual(&IModRepositoryBridge::requestToggleEndorsement)) - ; - - bpy::class_("ModRepositoryFileInfo") + bpy::class_("ModRepositoryFileInfo", bpy::no_init) .def(bpy::init()) .def(bpy::init>()) .def("__str__", &ModRepositoryFileInfo::toString) @@ -421,10 +412,10 @@ BOOST_PYTHON_MODULE(mobase) .def_readwrite("userData", &ModRepositoryFileInfo::userData) ; - bpy::class_("IDownloadManager") - .def("startDownloadURLs", bpy::pure_virtual(&IDownloadManager::startDownloadURLs)) - .def("startDownloadNexusFile", bpy::pure_virtual(&IDownloadManager::startDownloadNexusFile)) - .def("downloadPath", bpy::pure_virtual(&IDownloadManager::downloadPath)) + bpy::class_("IDownloadManager", bpy::no_init) + .def("startDownloadURLs", &IDownloadManager::startDownloadURLs) + .def("startDownloadNexusFile", &IDownloadManager::startDownloadNexusFile) + .def("downloadPath", &IDownloadManager::downloadPath) Q_DELEGATE(IDownloadManager, QObject, "_object") ; @@ -436,20 +427,20 @@ BOOST_PYTHON_MODULE(mobase) .def("setURL", &IInstallationManager::setURL) ; - bpy::class_("IModInterface") - .def("name", bpy::pure_virtual(&IModInterface::name)) - .def("absolutePath", bpy::pure_virtual(&IModInterface::absolutePath)) - .def("setVersion", bpy::pure_virtual(&IModInterface::setVersion)) - .def("setNewestVersion", bpy::pure_virtual(&IModInterface::setNewestVersion)) - .def("setIsEndorsed", bpy::pure_virtual(&IModInterface::setIsEndorsed)) - .def("setNexusID", bpy::pure_virtual(&IModInterface::setNexusID)) - .def("addNexusCategory", bpy::pure_virtual(&IModInterface::addNexusCategory)) - .def("addCategory", bpy::pure_virtual(&IModInterface::addCategory)) - .def("removeCategory", bpy::pure_virtual(&IModInterface::removeCategory)) - .def("categories", bpy::pure_virtual(&IModInterface::categories)) - .def("setGamePlugin", bpy::pure_virtual(&IModInterface::setGamePlugin)) - .def("setName", bpy::pure_virtual(&IModInterface::setName)) - .def("remove", bpy::pure_virtual(&IModInterface::remove)) + bpy::class_("IModInterface", bpy::no_init) + .def("name", &IModInterface::name) + .def("absolutePath", &IModInterface::absolutePath) + .def("setVersion", &IModInterface::setVersion) + .def("setNewestVersion", &IModInterface::setNewestVersion) + .def("setIsEndorsed", &IModInterface::setIsEndorsed) + .def("setNexusID", &IModInterface::setNexusID) + .def("addNexusCategory", &IModInterface::addNexusCategory) + .def("addCategory", &IModInterface::addCategory) + .def("removeCategory", &IModInterface::removeCategory) + .def("categories", &IModInterface::categories) + .def("setGamePlugin", &IModInterface::setGamePlugin) + .def("setName", &IModInterface::setName) + .def("remove", &IModInterface::remove) ; bpy::enum_("GuessQuality") @@ -503,18 +494,18 @@ BOOST_PYTHON_MODULE(mobase) .value("active", IPluginList::STATE_ACTIVE) ; - bpy::class_("IPluginList") - .def("state", bpy::pure_virtual(&MOBase::IPluginList::state)) - .def("priority", bpy::pure_virtual(&MOBase::IPluginList::priority)) - .def("loadOrder", bpy::pure_virtual(&MOBase::IPluginList::loadOrder)) - .def("isMaster", bpy::pure_virtual(&MOBase::IPluginList::isMaster)) - .def("masters", bpy::pure_virtual(&MOBase::IPluginList::masters)) - .def("origin", bpy::pure_virtual(&MOBase::IPluginList::origin)) - .def("onRefreshed", bpy::pure_virtual(&MOBase::IPluginList::onRefreshed)) - .def("onPluginMoved", bpy::pure_virtual(&MOBase::IPluginList::onPluginMoved)) - .def("pluginNames", bpy::pure_virtual(&MOBase::IPluginList::pluginNames)) - .def("setState", bpy::pure_virtual(&MOBase::IPluginList::setState)) - .def("setLoadOrder", bpy::pure_virtual(&MOBase::IPluginList::setLoadOrder)) + bpy::class_("IPluginList", bpy::no_init) + .def("state", &MOBase::IPluginList::state) + .def("priority", &MOBase::IPluginList::priority) + .def("loadOrder", &MOBase::IPluginList::loadOrder) + .def("isMaster", &MOBase::IPluginList::isMaster) + .def("masters", &MOBase::IPluginList::masters) + .def("origin", &MOBase::IPluginList::origin) + .def("onRefreshed", &MOBase::IPluginList::onRefreshed) + .def("onPluginMoved", &MOBase::IPluginList::onPluginMoved) + .def("pluginNames", &MOBase::IPluginList::pluginNames) + .def("setState", &MOBase::IPluginList::setState) + .def("setLoadOrder", &MOBase::IPluginList::setLoadOrder) ; bpy::enum_("ModState") @@ -527,15 +518,15 @@ BOOST_PYTHON_MODULE(mobase) .value("alternate", IModList::STATE_ALTERNATE) ; - bpy::class_("IModList") - .def("displayName", bpy::pure_virtual(&MOBase::IModList::displayName)) - .def("allMods", bpy::pure_virtual(&MOBase::IModList::allMods)) - .def("state", bpy::pure_virtual(&MOBase::IModList::state)) - .def("setActive", bpy::pure_virtual(&MOBase::IModList::setActive)) - .def("priority", bpy::pure_virtual(&MOBase::IModList::priority)) - .def("setPriority", bpy::pure_virtual(&MOBase::IModList::setPriority)) - .def("onModStateChanged", bpy::pure_virtual(&MOBase::IModList::onModStateChanged)) - .def("onModMoved", bpy::pure_virtual(&MOBase::IModList::onModMoved)) + bpy::class_("IModList", bpy::no_init) + .def("displayName", &MOBase::IModList::displayName) + .def("allMods", &MOBase::IModList::allMods) + .def("state", &MOBase::IModList::state) + .def("setActive", &MOBase::IModList::setActive) + .def("priority", &MOBase::IModList::priority) + .def("setPriority", &MOBase::IModList::setPriority) + .def("onModStateChanged", &MOBase::IModList::onModStateChanged) + .def("onModMoved", &MOBase::IModList::onModMoved) ; bpy::class_("IPlugin") diff --git a/src/runner/uibasewrappers.h b/src/runner/uibasewrappers.h index 6a1419a..d7e4397 100644 --- a/src/runner/uibasewrappers.h +++ b/src/runner/uibasewrappers.h @@ -31,79 +31,6 @@ extern MOBase::IOrganizer *s_Organizer; -struct IProfileWrapper: MOBase::IProfile, boost::python::wrapper -{ - virtual QString name() const override { return this->get_override("name")(); } - virtual QString absolutePath() const override { return this->get_override("absolutePath")(); } - virtual bool localSavesEnabled() const override { return this->get_override("localSavesEnabled")(); } - virtual bool localSettingsEnabled() const override { return this->get_override("localSettingsEnabled")(); } - virtual bool invalidationActive(bool *supported) const override { return this->get_override("invalidationActive")(supported); } -}; - -struct IDownloadManagerWrapper: MOBase::IDownloadManager, boost::python::wrapper -{ - virtual int startDownloadURLs(const QStringList &urls) { return this->get_override("startDownloadURLs")(urls); } - virtual int startDownloadNexusFile(int modID, int fileID) { return this->get_override("startDownloadNexusFile")(modID, fileID); } - virtual QString downloadPath(int id) { return this->get_override("downloadPath")(id); } -}; - -struct IModRepositoryBridgeWrapper: MOBase::IModRepositoryBridge, boost::python::wrapper -{ - using IModRepositoryBridge::IModRepositoryBridge; - virtual void requestDescription(QString gameName, int modID, QVariant userData) { this->get_override("requestDescription")(gameName, modID, userData); } - virtual void requestFiles(QString gameName, int modID, QVariant userData) { this->get_override("requestFiles")(gameName, modID, userData); } - virtual void requestFileInfo(QString gameName, int modID, int fileID, QVariant userData) { this->get_override("requestFileInfo")(gameName, modID, fileID, userData); } - virtual void requestDownloadURL(QString gameName, int modID, int fileID, QVariant userData) { this->get_override("requestDownloadURL")(gameName, modID, fileID, userData); } - virtual void requestToggleEndorsement(QString gameName, int modID, QString modVersion, bool endorse, QVariant userData) { this->get_override("requestToggleEndorsement")(gameName, modID, endorse, userData); } -}; - -struct IModInterfaceWrapper: MOBase::IModInterface, boost::python::wrapper -{ - virtual QString name() const override { return this->get_override("name")(); } - virtual QString absolutePath() const override { return this->get_override("absolutePath")(); } - virtual void setVersion(const MOBase::VersionInfo &version) override { this->get_override("setVersion")(version); } - virtual void setNewestVersion(const MOBase::VersionInfo &version) override { this->get_override("setNewestVersion")(version); } - virtual void setIsEndorsed(bool endorsed) override { this->get_override("setIsEndorsed")(endorsed); } - virtual void setNexusID(int nexusID) override { this->get_override("setNexusID")(nexusID); } - virtual void setInstallationFile(const QString &fileName) override { this->get_override("setInstallationFile")(fileName); } - virtual void addNexusCategory(int categoryID) override { this->get_override("addNexusCategory")(categoryID); } - virtual void setGamePlugin(const MOBase::IPluginGame *gamePlugin) override { this->get_override("setGamePlugin")(gamePlugin); } - virtual bool setName(const QString &name) override { return this->get_override("setName")(name); } - virtual bool remove() override { return this->get_override("remove")(); } - virtual void addCategory(const QString &categoryName) override { this->get_override("addCategory")(categoryName); } - virtual bool removeCategory(const QString &categoryName) override { return this->get_override("removeCategory")(categoryName); } - virtual QStringList categories() const override { return this->get_override("categories")(); } -}; - - -struct IPluginListWrapper: MOBase::IPluginList, boost::python::wrapper { - virtual PluginStates state(const QString &name) const { return this->get_override("state")(name); } - virtual int priority(const QString &name) const { return this->get_override("priority")(name); } - virtual int loadOrder(const QString &name) const { return this->get_override("loadOrder")(name); } - virtual bool isMaster(const QString &name) const { return this->get_override("isMaster")(name); } - virtual QStringList masters(const QString &name) const { return this->get_override("masters")(name); } - virtual QString origin(const QString &name) const { return this->get_override("origin")(name); } - virtual bool onRefreshed(const std::function &callback) { return this->get_override("onRefreshed")(callback); } - virtual bool onPluginMoved(const std::function &callback) { return this->get_override("onPluginMoved")(callback); } - virtual bool onPluginStateChanged(const std::function &callback) override { return this->get_override("onPluginStateChanged")(callback); } - virtual QStringList pluginNames() const override { return this->get_override("pluginNames")(); } - virtual void setState(const QString &name, PluginStates state) override { this->get_override("setState")(name, state); } - virtual void setLoadOrder(const QStringList &pluginList) override { this->get_override("setLoadOrder")(pluginList); } -}; - - -struct IModListWrapper: MOBase::IModList, boost::python::wrapper { - virtual QString displayName(const QString &internalName) const override { return this->get_override("displayName")(internalName); } - virtual QStringList allMods() const override { return this->get_override("allMods")(); } - virtual ModStates state(const QString &name) const override { return this->get_override("state")(name); } - virtual int priority(const QString &name) const override { return this->get_override("priority")(name); } - virtual bool setActive(const QString &name, bool active) override { return this->get_override("setActive")(name, active); } - virtual bool setPriority(const QString &name, int newPriority) override { return this->get_override("setPriority")(name, newPriority); } - virtual bool onModStateChanged(const std::function &func) override { return this->get_override("onModStateChanged")(func); } - virtual bool onModMoved(const std::function &func) override { return this->get_override("onModMoved")(func); } -}; - - // This needs to be extendable in Python, so actually needs a wrapper (everything else probably doesn't): class ISaveGameWrapper : public MOBase::ISaveGame, public boost::python::wrapper {