-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
The Medium article referenced here repeatedly mentions the environment variable PYSIDE_DESINGER_PLUGINS. The correct name is PYSIDE_DESIGNER_PLUGINS (i.e., "GN" not "NG"). Not helpful to those using cut/paste to a terminal window.
Also, in the customcompassplugin.py file, line 44 uses "customcomopass" (extra 'o'). Makes me wonder if the includeFile() method is actually ever invoked. In general, '_' characters are cheap: use them! E.g.: custom_compass_... adds a lot to readability and decreases the odds of a typo.
As to the content, there is a much simpler way of doing this. Leave the actual plugin code customcompass.py "as is", delete the customcompassplugin.py file, and change the register_customcompass.py file to something like:
from pathlib import Path
from PySide6.QtDesigner import QPyDesignerCustomWidgetCollection
import customcompass
DOM_XML = """ <as you have> """
icon_path = Path(customcompass.__file__).parent / 'compassIcon.ico'
# If you assume icon files are always the class filename with '.ico' instead of '.py', you can generalize to
# icon_path = Path(customcompass.__file__).with_suffix('.ico')
QPyDesignerCustomWidgetCollection.registerCustomWidget(
customcompass.CustomCompass,
xml=DOM_XML,
tool_tip='<Your tool-tip here>',
group='Custom Compass Widgets',
module='customcompass',
container=False,
icon=str(icon_path),
)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels