From f7c072ce2a339deeedd5d002c5eb17c1b63fbec7 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Wed, 28 May 2025 13:17:41 +0200 Subject: [PATCH] show action icon in menu --- .../tools/launcher/ui/actions_widget.py | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/tools/launcher/ui/actions_widget.py b/client/ayon_core/tools/launcher/ui/actions_widget.py index 15547db03f..3760d8b470 100644 --- a/client/ayon_core/tools/launcher/ui/actions_widget.py +++ b/client/ayon_core/tools/launcher/ui/actions_widget.py @@ -14,7 +14,12 @@ from ayon_core.lib.attribute_definitions import ( HiddenDef, ) from ayon_core.tools.flickcharm import FlickCharm -from ayon_core.tools.utils import get_qt_icon, SquareButton, ClickableLabel +from ayon_core.tools.utils import ( + get_qt_icon, + SquareButton, + ClickableLabel, + PixmapLabel, +) from ayon_core.tools.attribute_defs import AttributeDefinitionsDialog from ayon_core.tools.launcher.abstract import WebactionContext @@ -69,9 +74,13 @@ class ActionVariantWidget(QtWidgets.QFrame): action_triggered = QtCore.Signal(str) settings_requested = QtCore.Signal(str) - def __init__(self, item_id, label, has_settings, parent): + def __init__(self, item_id, icon, label, has_settings, parent): super().__init__(parent) + icon_widget = None + if icon: + icon_widget = PixmapLabel(icon.pixmap(512, 512), self) + label_widget = ClickableLabel(label, self) settings_btn = None if has_settings: @@ -80,6 +89,10 @@ class ActionVariantWidget(QtWidgets.QFrame): layout = QtWidgets.QHBoxLayout(self) layout.setContentsMargins(6, 4, 4, 4) layout.setSpacing(0) + if icon_widget is not None: + layout.addWidget(icon_widget, 0) + layout.addSpacing(6) + layout.addWidget(label_widget, 1) if settings_btn is not None: layout.addSpacing(6) @@ -89,6 +102,7 @@ class ActionVariantWidget(QtWidgets.QFrame): label_widget.clicked.connect(self._on_trigger) self._item_id = item_id + self._icon_widget = icon_widget self._label_widget = label_widget self._settings_btn = settings_btn @@ -471,7 +485,11 @@ class ActionMenuToolTip(QtWidgets.QFrame): label = action_item.full_label if widget is None: widget = ActionVariantWidget( - action_item.identifier, label, has_settings, self + action_item.identifier, + icon, + label, + has_settings, + self ) widget.action_triggered.connect(self._on_trigger) widget.settings_requested.connect(