diff options
author | Eike Ziller <eike.ziller@qt.io> | 2018-09-12 15:01:46 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2018-09-14 09:46:29 +0000 |
commit | 876ff8853f42b4ea6fae60adf994f531898cba57 (patch) | |
tree | e0a7e9fc9d6694b1d8a4660a89d4478e5c0caf36 /docs | |
parent | 6452612845d7edebbef26a0d2b483c129ab3a073 (diff) |
Fix encapsulation of plugins
Fixes that triggering "About Python Extensions" action resulted in
python runtime error "TypeError: must be type, not None" when
referencing PySide2.QtWidgets.
To improve encapsulation of plugins, all modules that they loaded
were deleted after their main.py finished running. This breaks
if these modules were accessed later e.g. triggered by actions.
Instead of this hack, ensure encapsulation of plugins by making them
actual Python packages.
Qt Creator's python extension path is added to python's module search
path, and extensions are simply imported as packages.
The python extension's main.py simply becomes a standard python
module __init__.py.
This also means that python extensions can depend on, and use other
python extensions' functionality by importing them with "import".
Change-Id: Ibe74c24e337b321007f5fa19c97bd35a5c1f0375
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/extensions.md | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/docs/extensions.md b/docs/extensions.md index eda9c4c..6d4998d 100644 --- a/docs/extensions.md +++ b/docs/extensions.md @@ -102,14 +102,12 @@ When importing modules, the following important locations will be checked (in th 1. The folder of the extension itself (files and folders in your extension) 2. The system Python path entries (anything you `pip install`ed globally) - 3. The QtCreator specific Python module directory + 3. Qt Creator's python extension directory + 4. The Qt Creator specific Python module directory - Note: This is where you should install any dependencies missing if you want to use non-standard Python packages / modules - This last path is accessible with `PluginInstance.pythonPackagePath()` -Any changes you make to sys.path and any modules you import, will be cleared after your script -finished executing. - ## Reserved variable names Names that look like ```Python |