Skip to content

Commit

Permalink
Start adding bindings for extensions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Holt59 committed Aug 11, 2024
1 parent 4c6ed4a commit dc029f1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/mobase/mobase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ PYBIND11_MODULE(mobase, m)

// exceptions
//
py::register_exception<Exception>(m, "Exception");
py::register_exception<Exception>(m, "MO2Exception");
py::register_exception<InvalidNXMLinkException>(m, "InvalidNXMLinkException");
py::register_exception<IncompatibilityException>(m, "IncompatibilityException");
py::register_exception<InvalidVersionException>(m, "InvalidVersionException");
Expand Down
17 changes: 17 additions & 0 deletions src/mobase/wrappers/basic_classes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,22 @@ namespace mo2::python {
py::implicitly_convertible<QString, GuessedValue<QString>>();
}

void add_iextensionlist_classes(py::module_ m)
{
// TODO: add all bindings here

py::class_<IExtension>(m, "Extension");

py::class_<IExtensionList>(m, "IExtensionList")
.def("installed", &IExtensionList::installed, "identifier"_a)
.def(
"enabled",
py::overload_cast<const QString&>(&IExtensionList::enabled, py::const_),
"identifier"_a)
.def("__getitem__", &IExtensionList::at, py::return_value_policy::reference)
.def("__len__", &IExtensionList::size);
}

void add_ipluginlist_classes(py::module_ m)
{
py::enum_<IPluginList::PluginState>(m, "PluginState", py::arithmetic())
Expand Down Expand Up @@ -887,6 +903,7 @@ namespace mo2::python {
})
.def("absoluteIniFilePath", &IProfile::absoluteIniFilePath, "inifile"_a);

add_iextensionlist_classes(m);
add_ipluginlist_classes(m);
add_imodlist_classes(m);
add_idownload_manager_classes(m);
Expand Down

0 comments on commit dc029f1

Please sign in to comment.