diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-02-05 17:06:16 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-02-16 13:35:45 +0000 |
commit | 82afd88245a17b6ba759937a2b391c216857565a (patch) | |
tree | 1700964ad26a47e30e470fe679a80c72da17a26a /sources/pyside-tools | |
parent | b9aa61247c355a9330e52059951649c6ba7697c2 (diff) |
PySide6: Add a Designer plugin
Add a convencience class QPyDesignerCustomWidgetCollection to
the Qt Designer module, which provides functions for
registering widget types or adding QDesignerCustomWidgetInterface
instances. A static instance of it is stored as a dynamic
property on QCoreApplication, which is retrieved by a Qt Designer
plugin, which provides the collection of widgets registered in
Python.
Task-number: PYSIDE-1455
Change-Id: If4055e6c9db6a03b32016b013a1130051bbd472a
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside-tools')
-rw-r--r-- | sources/pyside-tools/pyside_tool.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sources/pyside-tools/pyside_tool.py b/sources/pyside-tools/pyside_tool.py index 485520f5d..c49b05054 100644 --- a/sources/pyside-tools/pyside_tool.py +++ b/sources/pyside-tools/pyside_tool.py @@ -40,6 +40,7 @@ ############################################################################# import sys import os +from pathlib import Path import subprocess from subprocess import Popen, PIPE @@ -79,7 +80,24 @@ def rcc(): qt_tool_wrapper("rcc", ['-g', 'python'] + sys.argv[1:]) +def _append_to_path_var(var, value): + env_value = os.environ.get(var) + if env_value: + env_value = f'{env_value}{os.pathsep}{value}' + else: + env_value = value + os.environ[var] = env_value + + def designer(): + # Add the examples to PYSIDE_DESIGNER_PLUGINS, as determined by starting from + # PySide6/scripts. + pyside_dir = Path(__file__).resolve().parents[1] + + # Add the Wiggly Widget example + wiggly_dir = os.fspath(pyside_dir / 'examples' / 'widgetbinding') + _append_to_path_var('PYSIDE_DESIGNER_PLUGINS', wiggly_dir) + if sys.platform == "darwin": qt_tool_wrapper("Designer.app/Contents/MacOS/Designer", sys.argv[1:]) else: |