mirror of
https://github.com/ModOrganizer2/modorganizer-plugin_python.git
synced 2026-07-27 14:03:33 -07:00
Final eradication of igameinfo and adding python wrappers for IPluginGame
This commit is contained in:
@@ -62,4 +62,5 @@ QMAKE_POST_LINK += xcopy /y /s /i $$quote($$SRCDIR\\$${TARGET}*.dll) $$quote($$D
|
||||
QMAKE_POST_LINK += xcopy /y /I $$quote($$SRCDIR\\$${TARGET}*.pdb) $$quote($$DSTDIR)\\plugins $$escape_expand(\\n)
|
||||
|
||||
OTHER_FILES += \
|
||||
SConscript
|
||||
SConscript\
|
||||
CMakeLists.txt
|
||||
|
||||
+46
-14
@@ -687,13 +687,6 @@ BOOST_PYTHON_MODULE(mobase)
|
||||
.value("notAttempted", MOBase::IPluginInstaller::RESULT_NOTATTEMPTED)
|
||||
;
|
||||
|
||||
bpy::enum_<MOBase::IGameInfo::Type>("GameType")
|
||||
.value("oblivion", MOBase::IGameInfo::TYPE_OBLIVION)
|
||||
.value("fallout3", MOBase::IGameInfo::TYPE_FALLOUT3)
|
||||
.value("falloutnv", MOBase::IGameInfo::TYPE_FALLOUTNV)
|
||||
.value("skyrim", MOBase::IGameInfo::TYPE_SKYRIM)
|
||||
;
|
||||
|
||||
bpy::class_<VersionInfo>("VersionInfo")
|
||||
.def(bpy::init<QString>())
|
||||
.def(bpy::init<QString, VersionInfo::VersionScheme>())
|
||||
@@ -705,14 +698,7 @@ BOOST_PYTHON_MODULE(mobase)
|
||||
|
||||
bpy::class_<PluginSetting>("PluginSetting", bpy::init<const QString&, const QString&, const QVariant&>());
|
||||
|
||||
bpy::class_<IGameInfoWrapper, boost::noncopyable>("GameInfo")
|
||||
// .def("type", bpy::pure_virtual(&IGameInfo::type))
|
||||
// .def("path", bpy::pure_virtual(&IGameInfo::path))
|
||||
// .def("binaryName", bpy::pure_virtual(&IGameInfo::binaryName))
|
||||
;
|
||||
|
||||
bpy::class_<IOrganizerWrapper, boost::noncopyable>("IOrganizer")
|
||||
.def("gameInfo", bpy::pure_virtual(&IOrganizer::gameInfo), bpy::return_value_policy<bpy::reference_existing_object>())
|
||||
.def("createNexusBridge", bpy::pure_virtual(&IOrganizer::createNexusBridge), bpy::return_value_policy<bpy::reference_existing_object>())
|
||||
.def("profileName", bpy::pure_virtual(&IOrganizer::profileName))
|
||||
.def("profilePath", bpy::pure_virtual(&IOrganizer::profilePath))
|
||||
@@ -812,6 +798,7 @@ BOOST_PYTHON_MODULE(mobase)
|
||||
;
|
||||
|
||||
Functor0_converter(); // converter for the onRefreshed-callback
|
||||
|
||||
bpy::class_<IPluginListWrapper, boost::noncopyable>("IPluginList")
|
||||
.def("state", bpy::pure_virtual(&MOBase::IPluginList::state))
|
||||
.def("priority", bpy::pure_virtual(&MOBase::IPluginList::priority))
|
||||
@@ -825,6 +812,7 @@ BOOST_PYTHON_MODULE(mobase)
|
||||
|
||||
bpy::to_python_converter<IModList::ModStates, QFlags_to_int<IModList::ModState>>();
|
||||
Functor2_converter<const QString&, IModList::ModStates>(); // converter for the onModStateChanged-callback
|
||||
|
||||
bpy::class_<IModListWrapper, boost::noncopyable>("IModList")
|
||||
.def("displayName", bpy::pure_virtual(&MOBase::IModList::displayName))
|
||||
.def("allMods", bpy::pure_virtual(&MOBase::IModList::allMods))
|
||||
@@ -836,6 +824,50 @@ BOOST_PYTHON_MODULE(mobase)
|
||||
.def("onModMoved", bpy::pure_virtual(&MOBase::IModList::onModMoved))
|
||||
;
|
||||
|
||||
bpy::enum_<MOBase::IPluginGame::LoadOrderMechanism>("LoadOrderMechanism")
|
||||
.value("FileTime", MOBase::IPluginGame::LoadOrderMechanism::FileTime)
|
||||
.value("PluginsTxt", MOBase::IPluginGame::LoadOrderMechanism::PluginsTxt)
|
||||
;
|
||||
|
||||
bpy::enum_<MOBase::IPluginGame::ProfileSetting>("ProfileSetting")
|
||||
.value("mods", MOBase::IPluginGame::MODS)
|
||||
.value("configuration", MOBase::IPluginGame::CONFIGURATION)
|
||||
.value("savegames", MOBase::IPluginGame::SAVEGAMES)
|
||||
.value("preferDefaults", MOBase::IPluginGame::PREFER_DEFAULTS)
|
||||
;
|
||||
|
||||
|
||||
bpy::class_<IPluginGameWrapper, boost::noncopyable>("IPluginGame")
|
||||
.def("gameName", bpy::pure_virtual(&MOBase::IPluginGame::gameName))
|
||||
.def("initializeProfile", bpy::pure_virtual(&MOBase::IPluginGame::initializeProfile))
|
||||
.def("savegameExtension", bpy::pure_virtual(&MOBase::IPluginGame::savegameExtension))
|
||||
.def("isInstalled", bpy::pure_virtual(&MOBase::IPluginGame::isInstalled))
|
||||
.def("gameIcon", bpy::pure_virtual(&MOBase::IPluginGame::gameIcon))
|
||||
.def("gameDirectory", bpy::pure_virtual(&MOBase::IPluginGame::gameDirectory))
|
||||
.def("dataDirectory", bpy::pure_virtual(&MOBase::IPluginGame::dataDirectory))
|
||||
.def("setGamePath", bpy::pure_virtual(&MOBase::IPluginGame::setGamePath))
|
||||
.def("documentsDirectory", bpy::pure_virtual(&MOBase::IPluginGame::documentsDirectory))
|
||||
.def("savesDirectory", bpy::pure_virtual(&MOBase::IPluginGame::savesDirectory))
|
||||
.def("executables", bpy::pure_virtual(&MOBase::IPluginGame::executables))
|
||||
.def("steamAPPId", bpy::pure_virtual(&MOBase::IPluginGame::steamAPPId))
|
||||
.def("getPrimaryPlugins", bpy::pure_virtual(&MOBase::IPluginGame::getPrimaryPlugins))
|
||||
.def("gameVariants", bpy::pure_virtual(&MOBase::IPluginGame::gameVariants))
|
||||
.def("setGameVariant", bpy::pure_virtual(&MOBase::IPluginGame::setGameVariant))
|
||||
.def("getBinaryName", bpy::pure_virtual(&MOBase::IPluginGame::getBinaryName))
|
||||
.def("getNexusName", bpy::pure_virtual(&MOBase::IPluginGame::getNexusName))
|
||||
.def("getIniFiles", bpy::pure_virtual(&MOBase::IPluginGame::getIniFiles))
|
||||
|
||||
//Plugin interface.
|
||||
.def("init", bpy::pure_virtual(&MOBase::IPluginGame::init))
|
||||
.def("name", bpy::pure_virtual(&MOBase::IPluginGame::name))
|
||||
.def("author", bpy::pure_virtual(&MOBase::IPluginGame::author))
|
||||
.def("description", bpy::pure_virtual(&MOBase::IPluginGame::description))
|
||||
.def("version", bpy::pure_virtual(&MOBase::IPluginGame::version))
|
||||
.def("isActive", bpy::pure_virtual(&MOBase::IPluginGame::isActive))
|
||||
.def("settings", bpy::pure_virtual(&MOBase::IPluginGame::settings))
|
||||
|
||||
;
|
||||
|
||||
GuessedValue_converters<QString>();
|
||||
|
||||
bpy::to_python_converter<ModRepositoryFileInfo, ModRepositoryFileInfo_to_python_dict>();
|
||||
|
||||
+40
-14
@@ -8,10 +8,11 @@
|
||||
#pragma warning (pop)
|
||||
#endif
|
||||
|
||||
#include <QIcon>
|
||||
#include <QString>
|
||||
|
||||
#include "iplugingame.h"
|
||||
#include <imoinfo.h>
|
||||
#include <igameinfo.h>
|
||||
#include <imodrepositorybridge.h>
|
||||
#include <imodinterface.h>
|
||||
#include <iinstallationmanager.h>
|
||||
@@ -21,8 +22,6 @@
|
||||
#include "error.h"
|
||||
#include "gilock.h"
|
||||
|
||||
namespace MOBase { class IPluginGame; }
|
||||
|
||||
extern MOBase::IOrganizer *s_Organizer;
|
||||
|
||||
using MOBase::ModRepositoryFileInfo;
|
||||
@@ -198,10 +197,6 @@ private:
|
||||
|
||||
struct IOrganizerWrapper: MOBase::IOrganizer, boost::python::wrapper<MOBase::IOrganizer>
|
||||
{
|
||||
virtual MOBase::IGameInfo &gameInfo() const {
|
||||
MOBase::IGameInfo *result = this->get_override("gameInfo")();
|
||||
return *result;
|
||||
}
|
||||
virtual MOBase::IModRepositoryBridge *createNexusBridge() const { return this->get_override("createNexusBridge")(); }
|
||||
virtual QString profileName() const { return this->get_override("profileName")(); }
|
||||
virtual QString profilePath() const { return this->get_override("profilePath")(); }
|
||||
@@ -258,13 +253,6 @@ struct IInstallationManagerWrapper: MOBase::IInstallationManager, boost::python:
|
||||
virtual MOBase::IPluginInstaller::EInstallResult installArchive(MOBase::GuessedValue<QString> &modName, const QString &archiveFile) { return this->get_override("installArchive")(modName, archiveFile); }
|
||||
};
|
||||
|
||||
struct IGameInfoWrapper: MOBase::IGameInfo, boost::python::wrapper<MOBase::IGameInfo>
|
||||
{
|
||||
// virtual Type type() const { return this->get_override("type")(); }
|
||||
// virtual QString path() const { return this->get_override("path")(); }
|
||||
// virtual QString binaryName() const { return this->get_override("binaryName")(); }
|
||||
};
|
||||
|
||||
struct IModInterfaceWrapper: MOBase::IModInterface, boost::python::wrapper<MOBase::IModInterface>
|
||||
{
|
||||
virtual QString name() const override { return this->get_override("name")(); }
|
||||
@@ -307,4 +295,42 @@ struct IModListWrapper: MOBase::IModList, boost::python::wrapper<MOBase::IModLis
|
||||
virtual bool onModMoved(const std::function<void (const QString &, int, int)> &func) override { return this->get_override("onModMoved")(func); }
|
||||
};
|
||||
|
||||
|
||||
struct IPluginGameWrapper: MOBase::IPluginGame, boost::python::wrapper<MOBase::IPluginGame> {
|
||||
virtual QString gameName() const override { return this->get_override("gameName")(); }
|
||||
virtual void initializeProfile(const QDir &directory, ProfileSettings settings) const override {
|
||||
this->get_override("initializeProfile")(directory, settings);
|
||||
}
|
||||
virtual QString savegameExtension() const override { return this->get_override("savegameExtension")(); }
|
||||
virtual bool isInstalled() const override { return this->get_override("isInstalled")(); }
|
||||
virtual QIcon gameIcon() const override { return this->get_override("gameIcon")(); }
|
||||
virtual QDir gameDirectory() const override { return this->get_override("gameDirectory")(); }
|
||||
virtual QDir dataDirectory() const override { return this->get_override("dataDirectory")(); }
|
||||
virtual void setGamePath(const QString &path) override { this->get_override("setGamePath")(path); }
|
||||
virtual QDir documentsDirectory() const override { return this->get_override("documentsDirectory")(); }
|
||||
virtual QDir savesDirectory() const override { return this->get_override("savesDirectory")(); }
|
||||
virtual QList<MOBase::ExecutableInfo> executables() const override { return this->get_override("executables")(); }
|
||||
virtual QString steamAPPId() const override { return this->get_override("steamAPPId")(); }
|
||||
virtual QStringList getPrimaryPlugins() const override { return this->get_override("getPrimaryPlugins")(); }
|
||||
virtual QStringList gameVariants() const override { return this->get_override("gameVariants")(); }
|
||||
virtual void setGameVariant(const QString &variant) override { this->get_override("setGameVariant")(variant); }
|
||||
virtual QString getBinaryName() const override { return this->get_override("getBinaryName")(); }
|
||||
virtual QString getNexusName() const override { return this->get_override("getNexusName")(); }
|
||||
virtual QStringList getIniFiles() const override { return this->get_override("getIniFiles")(); }
|
||||
|
||||
//Plugin interface. Could this bit be implemented just once?
|
||||
virtual bool init(MOBase::IOrganizer *moInfo) override { return this->get_override("init")(moInfo); }
|
||||
virtual QString name() const override { return this->get_override("name")(); }
|
||||
virtual QString author() const override { return this->get_override("author")(); }
|
||||
virtual QString description() const override { return this->get_override("description")(); }
|
||||
virtual MOBase::VersionInfo version() const override { return this->get_override("version")(); }
|
||||
virtual bool isActive() const override { return this->get_override("isActive")(); }
|
||||
virtual QList<MOBase::PluginSetting> settings() const override { return this->get_override("settings")(); }
|
||||
|
||||
protected:
|
||||
|
||||
virtual std::map<std::type_index, boost::any> featureList() const override { return this->get_override("featureList")(); }
|
||||
|
||||
};
|
||||
|
||||
#endif // UIBASEWRAPPERS_H
|
||||
|
||||
Reference in New Issue
Block a user