Hi folks, out of curiosity I have started poking around in QGIS' code related to plugin management. It's an interesting mix of C++ and Python code. Even the plugin management GUI itself is partially C++ (the main window, QgsPluginManager[Interface], and part of its logic) and partially Python (all further dialogs and their logic). As an experiment for now, I am looking into how I could port at least the entire GUI to Python and disentangle some of the knots. The rational is that plugin management is not performance-critical and could become much more easy to maintain, among a lot of other interesting benefits that a potentially fully Python-based solution could offer. But that's a different story. For now, I think I have hit a roadblock and was wondering whether anyone could enlighten me. I'd greatly appreciate any help.
I *believe* I have a fairly good understanding of what happens underneath `/python/pyplugin_installer/`. The class `QgsPluginInstaller` from `installer.py` appears to be a Python API that is called from the C++-interface (`QgsPluginManagerInterface`) through `QgsPythonRunner`. Most of the C++ appears to be located underneath `/src/app/pluginmanager/` (with a single ui-file elsewhere, `/src/ui/qgspluginmanagerbase.ui`). Having analyzed the C++ class `QgsPluginManager` I believe most of the interface can easily ported to Python. The tricky bit appears to be `/src/app/qgspluginregistry.cpp`. It offers a class named `QgsPluginRegistry` (which is being used by `QgsPluginManager`). I have not found a way to access this class (or an/the instance of it) from Python. I figure it is required to handle both Python *and* C++ plugins. `QgsPluginRegistry` makes heavy use of `mPythonUtils`, which appears to be a C++ wrapper around `/python/utils.py` (through `/src/python/qgspythonutilsimpl.cpp`). So this portion of `QgsPluginRegistry` (about 50%) can be rewritten in Python rather quickly. Methods such as `loadCppPlugin` or `unloadCppPlugin` are a lot more problematic. As far as I can tell, those would need to remain in C++ and they would need to be exposed to Python somehow (if they are not already). Have I found all relevant components of QGIS responsible for plugin management? Does my analysis contain any major flaws? Is there a way to manage C++ plugins (i.e. to call `loadCppPlugin` and `unloadCppPlugin`) from Python? Best regards, Sebastian _______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
