diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index d75b405..2b943ba 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -139,6 +139,7 @@ BOOST_PYTHON_MODULE(mobase) // Tuple: bpy::register_tuple>(); // IOrganizer::waitForApplication bpy::register_tuple>(); // IProfile::invalidationActive + bpy::register_tuple>(); bpy::register_tuple, QString, int>>(); bpy::register_tuple>(); @@ -150,6 +151,7 @@ BOOST_PYTHON_MODULE(mobase) bpy::register_variant>(); bpy::register_variant>(); bpy::register_variant>>(); + bpy::register_variant>>(); // Functions: utils::register_functor_converter(); // converter for the onRefreshed-callback @@ -654,7 +656,20 @@ BOOST_PYTHON_MODULE(mobase) .def("extractFile", &IInstallationManager::extractFile, (bpy::arg("entry"), bpy::arg("silent") = false)) .def("extractFiles", &IInstallationManager::extractFiles, (bpy::arg("entries"), bpy::arg("silent") = false)) .def("createFile", &IInstallationManager::createFile, bpy::arg("entry")) - .def("installArchive", &IInstallationManager::installArchive, (bpy::arg("mod_name"), "archive", "mod_id")) + + // accept both QString and GuessedValue since the conversion is not automatic in Python, and + // return a tuple to get back the mod name and the mod ID + .def("installArchive", +[](IInstallationManager* m, std::variant> modName, QString archive, int modId) { + GuessedValue tmp; + if (auto* p = std::get_if(&modName)) { + tmp = *p; + } + else { + tmp = std::get>(modName); + } + auto result = m->installArchive(tmp, archive, modId); + return std::make_tuple(result, static_cast(tmp), modId); + }, (bpy::arg("mod_name"), "archive", bpy::arg("mod_id") = 0)) ; bpy::enum_("EndorsedState")