Add instanceName and profiles methods to plugin API (#150)

This commit is contained in:
Jonathan Feenstra
2026-01-11 17:57:34 +01:00
committed by GitHub
parent 648db4db99
commit b81646562c
2 changed files with 10 additions and 3 deletions
+6 -2
View File
@@ -3,6 +3,7 @@
#include "../pybind11_all.h"
#include <format>
#include <memory>
#include <uibase/executableinfo.h>
#include <uibase/filemapping.h>
@@ -536,6 +537,7 @@ namespace mo2::python {
py::class_<IOrganizer>(m, "IOrganizer")
.def("createNexusBridge", &IOrganizer::createNexusBridge,
py::return_value_policy::reference)
.def("instanceName", &IOrganizer::instanceName)
.def("profileName", &IOrganizer::profileName)
.def("profilePath", &IOrganizer::profilePath)
.def("downloadsPath", &IOrganizer::downloadsPath)
@@ -625,7 +627,9 @@ namespace mo2::python {
.def("modList", &IOrganizer::modList, py::return_value_policy::reference)
.def("gameFeatures", &IOrganizer::gameFeatures,
py::return_value_policy::reference)
.def("profile", &IOrganizer::profile, py::return_value_policy::reference)
.def("profile", &IOrganizer::profile)
.def("profileNames", &IOrganizer::profileNames)
.def("getProfile", &IOrganizer::getProfile, "name"_a)
// custom implementation for startApplication and
// waitForApplication because 1) HANDLE (= void*) is not properly
@@ -880,7 +884,7 @@ namespace mo2::python {
// must be done BEFORE imodlist because there is a default argument to a
// IProfile* in the modlist class
py::class_<IProfile>(m, "IProfile")
py::class_<IProfile, std::shared_ptr<IProfile>>(m, "IProfile")
.def("name", &IProfile::name)
.def("absolutePath", &IProfile::absolutePath)
.def("localSavesEnabled", &IProfile::localSavesEnabled)
+4 -1
View File
@@ -7,6 +7,7 @@ class MockOrganizer : public IOrganizer {
public:
// clang-format off
MOCK_METHOD(IModRepositoryBridge*, createNexusBridge, (), (const, override));
MOCK_METHOD(QString, instanceName, (), (const, override));
MOCK_METHOD(QString, profileName, (), (const, override));
MOCK_METHOD(QString, profilePath, (), (const, override));
MOCK_METHOD(QString, downloadsPath, (), (const, override));
@@ -36,7 +37,9 @@ public:
MOCK_METHOD(MOBase::IDownloadManager*, downloadManager, (), (const, override));
MOCK_METHOD(MOBase::IPluginList*, pluginList, (), (const, override));
MOCK_METHOD(MOBase::IModList*, modList, (), (const, override));
MOCK_METHOD(MOBase::IProfile*, profile, (), (const, override));
MOCK_METHOD(std::shared_ptr<MOBase::IProfile>, profile, (), (const, override));
MOCK_METHOD(QStringList, profileNames, (), (const, override));
MOCK_METHOD(std::shared_ptr<const MOBase::IProfile>, getProfile, (const QString& name), (const, override));
MOCK_METHOD(MOBase::IGameFeatures*, gameFeatures, (), (const, override));
MOCK_METHOD(HANDLE, startApplication, (const QString &executable, const QStringList &args, const QString &cwd, const QString &profile, const QString &forcedCustomOverwrite, bool ignoreCustomOverwrite), (override));
MOCK_METHOD(bool, waitForApplication, (HANDLE handle, bool refresh, LPDWORD exitCode), (const, override));