mirror of
https://github.com/ModOrganizer2/modorganizer-plugin_python.git
synced 2026-07-27 14:03:33 -07:00
extended plugin interface. Plugins can now activate/deactivate mods, install mods
suggesting a name and retrieve a list of all installed mods
This commit is contained in:
@@ -385,6 +385,7 @@ template <> struct MetaData<IDownloadManager> { static const char *className() {
|
||||
template <> struct MetaData<QObject> { static const char *className() { return "QObject"; } };
|
||||
template <> struct MetaData<QWidget> { static const char *className() { return "QWidget"; } };
|
||||
template <> struct MetaData<QIcon> { static const char *className() { return "QIcon"; } };
|
||||
template <> struct MetaData<QStringList> { static const char *className() { return "QStringList"; } };
|
||||
template <> struct MetaData<QVariant> { static const char *className() { return "QVariant"; } };
|
||||
|
||||
|
||||
@@ -648,6 +649,7 @@ BOOST_PYTHON_MODULE(mobase)
|
||||
//QClass_converters<QObject>();
|
||||
QClass_converters<QWidget>();
|
||||
QClass_converters<QIcon>();
|
||||
QClass_converters<QStringList>();
|
||||
QInterface_converters<IDownloadManager>();
|
||||
|
||||
|
||||
@@ -718,7 +720,7 @@ BOOST_PYTHON_MODULE(mobase)
|
||||
.def("persistent", bpy::pure_virtual(&IOrganizer::persistent))
|
||||
.def("setPersistent", bpy::pure_virtual(&IOrganizer::setPersistent))
|
||||
.def("pluginDataPath", bpy::pure_virtual(&IOrganizer::pluginDataPath))
|
||||
.def("installMod", bpy::pure_virtual(&IOrganizer::installMod), bpy::return_value_policy<bpy::reference_existing_object>())
|
||||
.def("installMod", bpy::pure_virtual(&IOrganizer::installMod),(bpy::arg("nameSuggestion")=""), bpy::return_value_policy<bpy::reference_existing_object>())
|
||||
.def("downloadManager", bpy::pure_virtual(&IOrganizer::downloadManager), bpy::return_value_policy<bpy::reference_existing_object>())
|
||||
.def("pluginList", bpy::pure_virtual(&IOrganizer::pluginList), bpy::return_value_policy<bpy::reference_existing_object>())
|
||||
.def("modList", bpy::pure_virtual(&IOrganizer::modList), bpy::return_value_policy<bpy::reference_existing_object>())
|
||||
@@ -814,7 +816,9 @@ BOOST_PYTHON_MODULE(mobase)
|
||||
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))
|
||||
.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))
|
||||
|
||||
@@ -217,7 +217,7 @@ struct IOrganizerWrapper: MOBase::IOrganizer, boost::python::wrapper<MOBase::IOr
|
||||
virtual QVariant persistent(const QString &pluginName, const QString &key, const QVariant &def = QVariant()) const { return this->get_override("persistent")(pluginName, key, def); }
|
||||
virtual void setPersistent(const QString &pluginName, const QString &key, const QVariant &value, bool sync = true) { this->get_override("setPersistent")(pluginName, key, value, sync); }
|
||||
virtual QString pluginDataPath() const { return this->get_override("pluginDataPath")(); }
|
||||
virtual MOBase::IModInterface *installMod(const QString &fileName) { return this->get_override("installMod")(fileName); }
|
||||
virtual MOBase::IModInterface *installMod(const QString &fileName, const QString &nameSuggestion = QString()) { return this->get_override("installMod")(fileName, nameSuggestion); }
|
||||
virtual MOBase::IDownloadManager *downloadManager() { return this->get_override("downloadManager")(); }
|
||||
virtual MOBase::IPluginList *pluginList() { return this->get_override("pluginList")(); }
|
||||
virtual MOBase::IModList *modList() { return this->get_override("modList")(); }
|
||||
@@ -293,12 +293,14 @@ struct IPluginListWrapper: MOBase::IPluginList, boost::python::wrapper<MOBase::I
|
||||
|
||||
|
||||
struct IModListWrapper: MOBase::IModList, boost::python::wrapper<MOBase::IModList> {
|
||||
virtual QString displayName(const QString &internalName) const { return this->get_override("displayName")(internalName); }
|
||||
virtual ModStates 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 bool setPriority(const QString &name, int newPriority) { return this->get_override("setPriority")(name, newPriority); }
|
||||
virtual bool onModStateChanged(const std::function<void (const QString &, ModStates)> &func) { return this->get_override("onModStateChanged")(func); }
|
||||
virtual bool onModMoved(const std::function<void (const QString &, int, int)> &func) { return this->get_override("onModMoved")(func); }
|
||||
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<void (const QString &, ModStates)> &func) override { return this->get_override("onModStateChanged")(func); }
|
||||
virtual bool onModMoved(const std::function<void (const QString &, int, int)> &func) override { return this->get_override("onModMoved")(func); }
|
||||
};
|
||||
|
||||
#endif // UIBASEWRAPPERS_H
|
||||
|
||||
Reference in New Issue
Block a user