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

StyleSheet : Reserve space for valueChanged icon #5737

Merged
merged 4 commits into from
Apr 3, 2024
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
2 changes: 2 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Fixes
- Display : Fixed shutdown crashes caused by Python slots connected to `driverCreatedSignal()` and `imageReceivedSignal()` [^1].
- LightPositionTool : Fixed crash when changing the tool mode with nothing selected [^1].
- ViewportGadget : Fixed selection issues with Intel GPUs (#901, #2788).
- TransformTool : Fixed alignment of green "value changed" icon for `orientation` plugs.

API
---
Expand All @@ -39,6 +40,7 @@ API
- ProcessorWidget provides a base class for custom widgets, and a factory mechanism for registering them against processors.
- SimpleProcessorWidget provides a base class for widgets with a simple summary label and optional action links.
- TractorDispatcher : The `preSpoolSignal()` now provides an additional `taskData` argument to slots, which maps from Tractor tasks to information about the Gaffer tasks they will execute.
- LabelPlugValueWidget : Added optional `labelPlugValueWidget:showValueChangedIndicator` metadata entry. If a plug has this entry set to `False`, the icon next to the label that indicates the value has changed will not be shown. Defaults to `True` if the value is not set.

Breaking Changes
----------------
Expand Down
13 changes: 13 additions & 0 deletions python/GafferUI/LabelPlugValueWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
# Supported plug metadata :
#
# - "renameable"
# - "labelPlugValueWidget:showValueChangedIndicator" : If `False`, the indicator that the
# plug value has changed will not be shown. Defaults to `True` if not set.
class LabelPlugValueWidget( GafferUI.PlugValueWidget ) :

## \todo Remove alignment arguments. Vertically the only alignment that looks good is `Center`, and
Expand Down Expand Up @@ -72,6 +74,17 @@ def __init__( self, plug, horizontalAlignment=GafferUI.Label.HorizontalAlignment
self.__label._qtWidget().setFixedHeight( 20 )
layout.addWidget( self.__label._qtWidget() )

self.__label._qtWidget().setProperty(
"gafferShowValueChangedIndicator",
all(
(
p.direction() == Gaffer.Plug.Direction.In and
Gaffer.Metadata.value( p, "labelPlugValueWidget:showValueChangedIndicator" ) != False
)
for p in self.getPlugs()
)
)

self.__editableLabel = None # we'll make this lazily as needed

# Connecting at front so we're called before the slots
Expand Down
2 changes: 2 additions & 0 deletions python/GafferUI/SplinePlugValueWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ def __buttonPress( self, button, event ) :
Gaffer.Metadata.registerValue( plugType, "interpolation", "plugValueWidget:type", "GafferUI.PresetsPlugValueWidget" )
for name, value in sorted( Gaffer.SplineDefinitionInterpolation.names.items() ):
Gaffer.Metadata.registerValue( plugType, "interpolation", "preset:" + name, value )
Gaffer.Metadata.registerValue( plugType, "p[0-9]*.x", "labelPlugValueWidget:showValueChangedIndicator", False )
Gaffer.Metadata.registerValue( plugType, "p[0-9]*.y", "labelPlugValueWidget:showValueChangedIndicator", False )

## \todo See comments for `ColorSwatchPlugValueWidget._ColorPlugValueDialogue`.
# I think the best approach is probably to move the `acquire()` mechanism to the
Expand Down
13 changes: 5 additions & 8 deletions python/GafferUI/_StyleSheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,21 +239,18 @@ def styleColor( key ) :
color: #b0d8fb;
}

QLabel#gafferPlugLabel {
QLabel#gafferPlugLabel[gafferShowValueChangedIndicator="true"] {
/*
QLabel's text layout seems to lurch from one approach
to another in the presence of non-zero padding. So we
need some padding here so that we get a layout that
matches the `gafferValueChanged="true"` styling below.
Ensure that there is enough space reserved for the `valueChanged`
icon whether it is visible or not.
*/
padding-left: 1px;
padding-left: 10px;
}

QLabel#gafferPlugLabel[gafferValueChanged="true"] {
QLabel#gafferPlugLabel[gafferShowValueChangedIndicator="true"][gafferValueChanged="true"] {
background-image: url(:/valueChanged.png);
background-repeat: no-repeat;
background-position: left;
padding-left: 16px;
}

QLabel#gafferDefaultRowLabel {
Expand Down
20 changes: 10 additions & 10 deletions resources/graphics.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading