Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EMSUSD-1984 collection tab look #4072

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -102,6 +102,10 @@ def themedIcon(self, name: str, theme: str) -> QIcon:
result.addPixmap(pixmap)

return result

def themeTab(self, tab: QTabWidget):
tab.setDocumentMode(True)
tab.tabBar().setCursor(Qt.ArrowCursor)

@property
def palette(self) -> Palette:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.'''
Expand Down Expand Up @@ -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)

Expand Down
10 changes: 10 additions & 0 deletions lib/mayaUsd/resources/ae/usdschemabase/collectionMayaHost.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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.'''
Expand Down