Skip to content

Commit dc029f1

Browse files
committed
Start adding bindings for extensions.
1 parent 4c6ed4a commit dc029f1

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/mobase/mobase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ PYBIND11_MODULE(mobase, m)
2929

3030
// exceptions
3131
//
32-
py::register_exception<Exception>(m, "Exception");
32+
py::register_exception<Exception>(m, "MO2Exception");
3333
py::register_exception<InvalidNXMLinkException>(m, "InvalidNXMLinkException");
3434
py::register_exception<IncompatibilityException>(m, "IncompatibilityException");
3535
py::register_exception<InvalidVersionException>(m, "InvalidVersionException");

src/mobase/wrappers/basic_classes.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,22 @@ namespace mo2::python {
360360
py::implicitly_convertible<QString, GuessedValue<QString>>();
361361
}
362362

363+
void add_iextensionlist_classes(py::module_ m)
364+
{
365+
// TODO: add all bindings here
366+
367+
py::class_<IExtension>(m, "Extension");
368+
369+
py::class_<IExtensionList>(m, "IExtensionList")
370+
.def("installed", &IExtensionList::installed, "identifier"_a)
371+
.def(
372+
"enabled",
373+
py::overload_cast<const QString&>(&IExtensionList::enabled, py::const_),
374+
"identifier"_a)
375+
.def("__getitem__", &IExtensionList::at, py::return_value_policy::reference)
376+
.def("__len__", &IExtensionList::size);
377+
}
378+
363379
void add_ipluginlist_classes(py::module_ m)
364380
{
365381
py::enum_<IPluginList::PluginState>(m, "PluginState", py::arithmetic())
@@ -887,6 +903,7 @@ namespace mo2::python {
887903
})
888904
.def("absoluteIniFilePath", &IProfile::absoluteIniFilePath, "inifile"_a);
889905

906+
add_iextensionlist_classes(m);
890907
add_ipluginlist_classes(m);
891908
add_imodlist_classes(m);
892909
add_idownload_manager_classes(m);

0 commit comments

Comments
 (0)