Add registration and loading of extensions through a management window

This commit is contained in:
baldurk
2018-10-22 13:04:11 +01:00
parent 2dd293d691
commit dd3a352408
16 changed files with 953 additions and 1 deletions
@@ -506,6 +506,17 @@ bool PythonContext::LoadExtension(ICaptureContext &ctx, const rdcstr &extension)
{
qInfo() << "Reloading " << QString(extension);
// call unregister() if it exists
PyObject *unregister_func = PyObject_GetAttrString(extensions[extension], "unregister");
if(unregister_func)
{
PyObject *retval = PyObject_CallFunction(unregister_func, "");
// discard the return value, regardless of error we don't abort the reload
Py_XDECREF(retval);
}
// if the extension is a package, we need to manually reload any loaded submodules
PyObject *sysmodules = PyObject_GetAttrString(sysobj, "modules");