Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/mobase/pybind11_all.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "pybind11_utils/smart_variant_wrapper.h"

#include <uibase/game_features/game_feature.h>
#include <uibase/iprofile.h>
#include <uibase/isavegame.h>
#include <uibase/pluginrequirements.h>

Expand Down Expand Up @@ -140,6 +141,7 @@ namespace mo2::python {
} // namespace mo2::python

MO2_PYBIND11_SHARED_CPP_HOLDER(MOBase::IPluginRequirement)
MO2_PYBIND11_SHARED_CPP_HOLDER(MOBase::IProfile)
MO2_PYBIND11_SHARED_CPP_HOLDER(MOBase::ISaveGame)
MO2_PYBIND11_SHARED_CPP_HOLDER(MOBase::GameFeature)

Expand Down
8 changes: 6 additions & 2 deletions src/mobase/wrappers/basic_classes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "../pybind11_all.h"

#include <format>
#include <memory>

#include <uibase/executableinfo.h>
#include <uibase/filemapping.h>
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion tests/mocks/MockOrganizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -36,7 +37,9 @@ class MockOrganizer : public IOrganizer {
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));
Expand Down