Skip to content

Commit

Permalink
Merge pull request #5484 from ericmehl/stringPopupWider
Browse files Browse the repository at this point in the history
Spreadsheet : Make string popups wider
  • Loading branch information
johnhaddon authored Oct 3, 2023
2 parents 51d32ad + 4c6cf42 commit 07c01c5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
1.3.x.x (relative to 1.3.4.0)
=======

Improvements
------------

- Spreadsheet :
- Popups for string cells and row names are now sized to fit their column.
- Added "Triple" and "Quadruple" width options to the spreadsheet row name popup menu.

1.3.4.0 (relative to 1.3.3.0)
=======

Expand Down
5 changes: 4 additions & 1 deletion python/GafferUI/SpreadsheetUI/_CellPlugValueWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,16 @@ def walk( widget ) :
if childWidget is not None :
walk( childWidget )

if isinstance( plugValueWidget, GafferUI.VectorDataPlugValueWidget ) :
if isinstance( plugValueWidget, ( GafferUI.VectorDataPlugValueWidget, GafferUI.StringPlugValueWidget ) ) :
# It's pretty common to make wide spreadsheet columns to accommodate
# lists of long scene locations. When that is the case, we want
# to make sure the editor is equally wide, so that it shows at least
# as much content as the spreadsheet itself.
columnWidth = Gaffer.Metadata.value( plugValueWidget.getPlug().parent(), "spreadsheet:columnWidth" ) or 0
plugValueWidget._qtWidget().setFixedWidth( max( columnWidth, 250 ) )
if isinstance( plugValueWidget, GafferUI.StringPlugValueWidget ) :
plugValueWidget._qtWidget().layout().setSizeConstraint( QtWidgets.QLayout.SetNoConstraint )
plugValueWidget.textWidget().setFixedCharacterWidth( None )
else :
walk( plugValueWidget )

Expand Down
9 changes: 9 additions & 0 deletions python/GafferUI/SpreadsheetUI/_PlugTableView.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@ def __prependRowMenuItems( self, menuDefinition, plugs ) :
( "Half", GafferUI.PlugWidget.labelWidth() * 0.5 ),
( "Single", GafferUI.PlugWidget.labelWidth() ),
( "Double", GafferUI.PlugWidget.labelWidth() * 2 ),
( "Triple", GafferUI.PlugWidget.labelWidth() * 3 ),
( "Quadruple", GafferUI.PlugWidget.labelWidth() * 4 ),
]

currentWidth = self.__getRowNameWidth()
Expand Down Expand Up @@ -1126,6 +1128,13 @@ def __showEditor( self, plugs, plugBound, allowDirectEditing ) :
self.__editorWidget = GafferUI.PlugPopup( plugs, title = "" )
self.__editorWidget.popup( plugBound.center() )

widget = self.__editorWidget.plugValueWidget()
if isinstance( widget, GafferUI.StringPlugValueWidget ) :
columnWidth = Gaffer.Metadata.value( self._qtWidget().model().rowsPlug().defaultRow(), "spreadsheet:rowNameWidth" ) or 0
widget._qtWidget().setFixedWidth( max( columnWidth, 250 ) )
widget._qtWidget().layout().setSizeConstraint( QtWidgets.QLayout.SetNoConstraint )
widget.textWidget().setFixedCharacterWidth( None )

# Clears and selects a non-contiguous list of indexes if they're not already selected.
def __selectIndexes( self, indexes ) :

Expand Down

0 comments on commit 07c01c5

Please sign in to comment.