From d4e3792781ce5c915d97ecc99b0dad282e873a61 Mon Sep 17 00:00:00 2001 From: Eric Mehl Date: Fri, 29 Sep 2023 13:34:03 -0400 Subject: [PATCH 1/2] Spreadsheet : Make string popups wider --- Changes.md | 6 ++++++ python/GafferUI/SpreadsheetUI/_CellPlugValueWidget.py | 5 ++++- python/GafferUI/SpreadsheetUI/_PlugTableView.py | 7 +++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Changes.md b/Changes.md index 0c6409e36a0..95f69d051bc 100644 --- a/Changes.md +++ b/Changes.md @@ -1,6 +1,12 @@ 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. + 1.3.4.0 (relative to 1.3.3.0) ======= diff --git a/python/GafferUI/SpreadsheetUI/_CellPlugValueWidget.py b/python/GafferUI/SpreadsheetUI/_CellPlugValueWidget.py index 37d0f09750b..d4c9a1b6c14 100644 --- a/python/GafferUI/SpreadsheetUI/_CellPlugValueWidget.py +++ b/python/GafferUI/SpreadsheetUI/_CellPlugValueWidget.py @@ -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 ) diff --git a/python/GafferUI/SpreadsheetUI/_PlugTableView.py b/python/GafferUI/SpreadsheetUI/_PlugTableView.py index 6134a4da1b6..567224418d2 100755 --- a/python/GafferUI/SpreadsheetUI/_PlugTableView.py +++ b/python/GafferUI/SpreadsheetUI/_PlugTableView.py @@ -1126,6 +1126,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 ) : From 4c6cf42308675938783a8b80fa746ced51e5dac0 Mon Sep 17 00:00:00 2001 From: Eric Mehl Date: Mon, 2 Oct 2023 12:20:24 -0400 Subject: [PATCH 2/2] Spreadsheet : "Triple", "Quadruple" width options --- Changes.md | 1 + python/GafferUI/SpreadsheetUI/_PlugTableView.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Changes.md b/Changes.md index 95f69d051bc..aa935d5aad2 100644 --- a/Changes.md +++ b/Changes.md @@ -6,6 +6,7 @@ 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) ======= diff --git a/python/GafferUI/SpreadsheetUI/_PlugTableView.py b/python/GafferUI/SpreadsheetUI/_PlugTableView.py index 567224418d2..28e30453153 100755 --- a/python/GafferUI/SpreadsheetUI/_PlugTableView.py +++ b/python/GafferUI/SpreadsheetUI/_PlugTableView.py @@ -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()