Skip to content

Commit

Permalink
CatalogueUI : Use SplitContainer to allow resizing of listing/properties
Browse files Browse the repository at this point in the history
The description field was growing a little large for some folks' taste. I did try limiting the description field to a fixed number of lines, but I'm concerned that some other folks might be using large descriptions (lots of different notes on settings perhaps?), so I think providing explicit control is probably better.
  • Loading branch information
johnhaddon committed Aug 7, 2024
1 parent 0e8edf6 commit 61bd942
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 53 deletions.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Improvements
- Green : Render
- Blue : Proxy
- Red : Guide
- Catalogue : Added a handle for controlling the relative sizes of the listing and image property widgets.

Fixes
-----
Expand Down
116 changes: 63 additions & 53 deletions python/GafferImageUI/CatalogueUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,73 +721,79 @@ class ImageListing( GafferUI.PlugValueWidget ) :

def __init__( self, plug, **kw ) :

self.__column = GafferUI.ListContainer( spacing = 4 )
splitContainer = GafferUI.SplitContainer()

GafferUI.PlugValueWidget.__init__( self, self.__column, plug, **kw )
GafferUI.PlugValueWidget.__init__( self, splitContainer, plug, **kw )

with self.__column :
with splitContainer :

self.__pathListing = GafferUI.PathListingWidget(
_ImagesPath( self.__images(), [] ),
columns = self.__listingColumns(),
selectionMode = GafferUI.PathListingWidget.SelectionMode.Rows,
sortable = False,
horizontalScrollMode = GafferUI.ScrollMode.Automatic
)
self.__pathListing.setDragPointer( "" )
self.__pathListing.setHeaderVisible( True )
self.__pathListing.selectionChangedSignal().connect(
Gaffer.WeakMethod( self.__pathListingSelectionChanged ), scoped = False
)
self.__pathListing.dragEnterSignal().connect(
Gaffer.WeakMethod( self.__pathListingDragEnter ), scoped = False
)
self.__pathListing.dragLeaveSignal().connect(
Gaffer.WeakMethod( self.__pathListingDragLeave ), scoped = False
)
self.__pathListing.dragMoveSignal().connect(
Gaffer.WeakMethod( self.__pathListingDragMove ), scoped = False
)
self.__pathListing.dropSignal().connect(
Gaffer.WeakMethod( self.__pathListingDrop ), scoped = False
)
self.keyPressSignal().connect( Gaffer.WeakMethod( self.__keyPress ), scoped = False )
with GafferUI.ListContainer( spacing = 4 ) :

self.__pathListing = GafferUI.PathListingWidget(
_ImagesPath( self.__images(), [] ),
columns = self.__listingColumns(),
selectionMode = GafferUI.PathListingWidget.SelectionMode.Rows,
sortable = False,
horizontalScrollMode = GafferUI.ScrollMode.Automatic
)
self.__pathListing.setDragPointer( "" )
self.__pathListing.setHeaderVisible( True )
self.__pathListing.selectionChangedSignal().connect(
Gaffer.WeakMethod( self.__pathListingSelectionChanged ), scoped = False
)
self.__pathListing.dragEnterSignal().connect(
Gaffer.WeakMethod( self.__pathListingDragEnter ), scoped = False
)
self.__pathListing.dragLeaveSignal().connect(
Gaffer.WeakMethod( self.__pathListingDragLeave ), scoped = False
)
self.__pathListing.dragMoveSignal().connect(
Gaffer.WeakMethod( self.__pathListingDragMove ), scoped = False
)
self.__pathListing.dropSignal().connect(
Gaffer.WeakMethod( self.__pathListingDrop ), scoped = False
)
self.keyPressSignal().connect( Gaffer.WeakMethod( self.__keyPress ), scoped = False )

with GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal, spacing = 4 ) as self.__buttonRow :

addButton = GafferUI.Button( image = "pathChooser.png", hasFrame = False, toolTip = "Load image" )
addButton.clickedSignal().connect( Gaffer.WeakMethod( self.__addClicked ), scoped = False )

with GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal, spacing = 4 ) as self.__buttonRow :
self.__duplicateButton = GafferUI.Button( image = "duplicate.png", hasFrame = False, toolTip = "Duplicate selected image, hold <kbd>alt</kbd> to view copy. [<kbd>Ctrl-D</kbd>]" )
self.__duplicateButton.setEnabled( False )
self.__duplicateButton.clickedSignal().connect( Gaffer.WeakMethod( self.__duplicateClicked ), scoped = False )

addButton = GafferUI.Button( image = "pathChooser.png", hasFrame = False, toolTip = "Load image" )
addButton.clickedSignal().connect( Gaffer.WeakMethod( self.__addClicked ), scoped = False )
self.__exportButton = GafferUI.Button( image = "export.png", hasFrame = False, toolTip = "Export selected image" )
self.__exportButton.setEnabled( False )
self.__exportButton.clickedSignal().connect( Gaffer.WeakMethod( self.__exportClicked ), scoped = False )

self.__duplicateButton = GafferUI.Button( image = "duplicate.png", hasFrame = False, toolTip = "Duplicate selected image, hold <kbd>alt</kbd> to view copy. [<kbd>Ctrl-D</kbd>]" )
self.__duplicateButton.setEnabled( False )
self.__duplicateButton.clickedSignal().connect( Gaffer.WeakMethod( self.__duplicateClicked ), scoped = False )
self.__extractButton = GafferUI.Button( image = "extract.png", hasFrame = False, toolTip = "Create CatalogueSelect node for selected image" )
self.__extractButton.setEnabled( False )
self.__extractButton.clickedSignal().connect( Gaffer.WeakMethod( self.__extractClicked ), scoped = False )

self.__exportButton = GafferUI.Button( image = "export.png", hasFrame = False, toolTip = "Export selected image" )
self.__exportButton.setEnabled( False )
self.__exportButton.clickedSignal().connect( Gaffer.WeakMethod( self.__exportClicked ), scoped = False )
GafferUI.Spacer( imath.V2i( 0 ), parenting = { "expand" : True } )

self.__extractButton = GafferUI.Button( image = "extract.png", hasFrame = False, toolTip = "Create CatalogueSelect node for selected image" )
self.__extractButton.setEnabled( False )
self.__extractButton.clickedSignal().connect( Gaffer.WeakMethod( self.__extractClicked ), scoped = False )
self.__removeButton = GafferUI.Button( image = "delete.png", hasFrame = False, toolTip = "Remove selected image [<kbd>Delete</kbd>]" )
self.__removeButton.setEnabled( False )
self.__removeButton.clickedSignal().connect( Gaffer.WeakMethod( self.__removeClicked ), scoped = False )

GafferUI.Spacer( imath.V2i( 0 ), parenting = { "expand" : True } )
GafferUI.Spacer( size = imath.V2i( 2 ) )

self.__removeButton = GafferUI.Button( image = "delete.png", hasFrame = False, toolTip = "Remove selected image [<kbd>Delete</kbd>]" )
self.__removeButton.setEnabled( False )
self.__removeButton.clickedSignal().connect( Gaffer.WeakMethod( self.__removeClicked ), scoped = False )
with GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Vertical, spacing = 4 ) :

GafferUI.Divider()
GafferUI.Spacer( size = imath.V2i( 2 ) )

with GafferUI.Collapsible( label = "Image Properties", collapsed = False ) :
GafferUI.Label( "<h4>Image Properties</h4>" )

with GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Vertical, spacing = 4 ) :
GafferUI.Spacer( size = imath.V2i( 2 ) )

with GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal, spacing = 4 ) :
GafferUI.Label( "Name" )
self.__nameWidget = GafferUI.NameWidget( graphComponent = None )
with GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal, spacing = 4 ) :
GafferUI.Label( "Name" )
self.__nameWidget = GafferUI.NameWidget( graphComponent = None )

GafferUI.Label( "Description" )
self.__descriptionWidget = GafferUI.MultiLineStringPlugValueWidget( plug = None )
GafferUI.Label( "Description" )
self.__descriptionWidget = GafferUI.MultiLineStringPlugValueWidget( plug = None )

self.__mergeGroupId = 0

Expand Down Expand Up @@ -826,7 +832,11 @@ def _updateFromValues( self, values, exception ) :

def _updateFromEditable( self ) :

self.__column.setEnabled( self._editable() )
self.__pathListing.setEnabled( self._editable() )
self.__buttonRow.setEnabled( self._editable() )
# No need to manage editability of `self.__nameWidget` and
# `self.__descriptionWidget` because they deal with that
# internally.

def __plugMetadataValueChanged( self, plug, key, reason ) :

Expand Down

0 comments on commit 61bd942

Please sign in to comment.