diff --git a/lib/mayaUsd/resources/ae/usd-shared-components/src/python/usdSharedComponents/collection/widget.py b/lib/mayaUsd/resources/ae/usd-shared-components/src/python/usdSharedComponents/collection/widget.py index af9eb75a5..9f4c9f40a 100644 --- a/lib/mayaUsd/resources/ae/usd-shared-components/src/python/usdSharedComponents/collection/widget.py +++ b/lib/mayaUsd/resources/ae/usd-shared-components/src/python/usdSharedComponents/collection/widget.py @@ -50,7 +50,6 @@ def __init__( self._tabWidget = QTabWidget() self._tabWidget.setTabBar(NonScrollingTabBar(self._tabWidget)) self._tabWidget.currentChanged.connect(self.onTabChanged) - self._tabWidget.setDocumentMode(True) self._expressionWidget = ExpressionWidget(self._collData, self._tabWidget) self._tabWidget.addTab(self._includeExcludeWidget, QIcon(), "Include/Exclude") @@ -60,8 +59,7 @@ def __init__( self._includeExcludeWidget.setContentsMargins(0, offset, 0, 0) self._expressionWidget.setContentsMargins(0, offset, 0, 0) - self._tabWidget.tabBar().setExpanding(True) - self._tabWidget.tabBar().setCursor(Qt.ArrowCursor) + Theme.instance().themeTab(self._tabWidget) mainLayout.addWidget(self._tabWidget) else: mainLayout.addWidget(self._includeExcludeWidget) diff --git a/lib/mayaUsd/resources/ae/usd-shared-components/src/python/usdSharedComponents/common/theme.py b/lib/mayaUsd/resources/ae/usd-shared-components/src/python/usdSharedComponents/common/theme.py index d392c2605..09b831010 100644 --- a/lib/mayaUsd/resources/ae/usd-shared-components/src/python/usdSharedComponents/common/theme.py +++ b/lib/mayaUsd/resources/ae/usd-shared-components/src/python/usdSharedComponents/common/theme.py @@ -2,12 +2,12 @@ from PySide6 import QtSvg from PySide6.QtCore import QRect, Qt # type: ignore from PySide6.QtGui import QImage, QPixmap, QPalette, QPainter, QColor, QPen, QIcon # type: ignore - from PySide6.QtWidgets import QWidget # type: ignore + from PySide6.QtWidgets import QWidget, QTabWidget # type: ignore except: from PySide2 import QtSvg # type: ignore from PySide2.QtCore import QRect, Qt # type: ignore from PySide2.QtGui import QImage, QPixmap, QPalette, QPainter, QColor, QPen, QIcon # type: ignore - from PySide2.QtWidgets import QWidget # type: ignore + from PySide2.QtWidgets import QWidget, QTabWidget # type: ignore from enum import Flag, auto from typing import Union @@ -102,6 +102,9 @@ def themedIcon(self, name: str, theme: str) -> QIcon: result.addPixmap(pixmap) return result + + def themeTab(self, tab: QTabWidget): + tab.tabBar().setCursor(Qt.ArrowCursor) @property def palette(self) -> Palette: diff --git a/lib/mayaUsd/resources/ae/usdschemabase/collectionCustomControl.py b/lib/mayaUsd/resources/ae/usdschemabase/collectionCustomControl.py index 97d65752f..462837387 100644 --- a/lib/mayaUsd/resources/ae/usdschemabase/collectionCustomControl.py +++ b/lib/mayaUsd/resources/ae/usdschemabase/collectionCustomControl.py @@ -3,8 +3,9 @@ from usd_shared_components.collection.widget import CollectionWidget # type: ignore from usd_shared_components.common.host import Host # type: ignore +from usd_shared_components.common.theme import Theme # type: ignore -from .collectionMayaHost import MayaHost +from .collectionMayaHost import MayaHost, MayaTheme class CollectionCustomControl(object): '''Custom control for the light linking data we want to display.''' @@ -65,7 +66,9 @@ def onCreate(self, *args): ptr = MQtUtil.findControl(self.parent) parentWidget = wrapInstance(int(ptr), QWidget) - Host.injectInstance(MayaHost()) + if Host._instance is None: + Host.injectInstance(MayaHost()) + Theme.injectInstance(MayaTheme()) self.widget = CollectionWidget(self.prim, Usd.CollectionAPI.Get(self.prim, self.instanceName)) parentWidget.layout().addWidget(self.widget) diff --git a/lib/mayaUsd/resources/ae/usdschemabase/collectionMayaHost.py b/lib/mayaUsd/resources/ae/usdschemabase/collectionMayaHost.py index 20b6772b7..3b8f3e5e8 100644 --- a/lib/mayaUsd/resources/ae/usdschemabase/collectionMayaHost.py +++ b/lib/mayaUsd/resources/ae/usdschemabase/collectionMayaHost.py @@ -1,5 +1,6 @@ from usd_shared_components.common.host import Host +from usd_shared_components.common.theme import Theme from usd_shared_components.usdData.usdCollectionData import UsdCollectionData from usd_shared_components.usdData.usdCollectionStringListData import CollectionStringListData @@ -307,6 +308,15 @@ def removeStrings(self, items: Sequence[AnyStr]): with _UsdUndoBlockContext(_RemoveItemsCommand.commandName): super().removeStrings(items) +class MayaTheme(Theme): + def __init__(self): + self._palette = None + self._icons = {} + + def themeTab(self, tab): + super().themeTab(tab) + tab.setDocumentMode(False) + tab.tabBar().setExpanding(False) class MayaHost(Host): '''Class to host and override Maya-specific functions for the collection API.'''