@@ -360,6 +360,38 @@ namespace mo2::python {
360
360
py::implicitly_convertible<QString, GuessedValue<QString>>();
361
361
}
362
362
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 (
376
+ " __getitem__" ,
377
+ [](IExtensionList const & self,
378
+ std::variant<std::size_t , QString> const & index ) {
379
+ return std::visit (
380
+ [&self](auto && value) {
381
+ if constexpr (std::is_same_v<std::decay_t <decltype (value)>,
382
+ std::size_t >) {
383
+ return self.at (value);
384
+ }
385
+ else {
386
+ return self.get (value);
387
+ }
388
+ },
389
+ index );
390
+ },
391
+ py::return_value_policy::reference)
392
+ .def (" __len__" , &IExtensionList::size);
393
+ }
394
+
363
395
void add_ipluginlist_classes (py::module_ m)
364
396
{
365
397
py::enum_<IPluginList::PluginState>(m, " PluginState" , py::arithmetic ())
@@ -887,6 +919,7 @@ namespace mo2::python {
887
919
})
888
920
.def (" absoluteIniFilePath" , &IProfile::absoluteIniFilePath, " inifile" _a);
889
921
922
+ add_iextensionlist_classes (m);
890
923
add_ipluginlist_classes (m);
891
924
add_imodlist_classes (m);
892
925
add_idownload_manager_classes (m);
0 commit comments