@@ -773,17 +773,12 @@ class ColorForm(QWidget):
773773 Selector for colormap
774774 dataIndicatorCheckBox : QCheckBox
775775 Inidcates whether or not the data indicator will appear on the colorbar
776- userMinMaxBox : QCheckBox
777- Indicates whether or not the user defined values in the min and max
778- will be used to set the bounds of the colorbar.
776+ minMaxTypeBox : QComboBox
777+ Dropdown to select min/max type: "Full data", "Visible data", or "Custom"
779778 maxBox : ScientificDoubleSpinBox
780- Max value of the colorbar. If the userMinMaxBox is checked, this will be
781- the user's input. If the userMinMaxBox is not checked, this box will
782- hold the max value of the visible data.
779+ Max value of the colorbar. Only visible when minMaxTypeBox is set to "Custom".
783780 minBox : ScientificDoubleSpinBox
784- Min value of the colorbar. If the userMinMaxBox is checked, this will be
785- the user's input. If the userMinMaxBox is not checked, this box will
786- hold the max value of the visible data.
781+ Min value of the colorbar. Only visible when minMaxTypeBox is set to "Custom".
787782 scaleBox : QCheckBox
788783 Indicates whether or not the data is displayed on a log or linear
789784 scale
@@ -844,10 +839,13 @@ def __init__(self, model, main_window, field, colormaps=None):
844839 self .dataIndicatorCheckBox .stateChanged .connect (
845840 data_indicator_connector )
846841
847- # User specified min/max check box
848- self .userMinMaxBox = QCheckBox ()
849- minmax_connector = partial (main_window .toggleTallyDataUserMinMax )
850- self .userMinMaxBox .stateChanged .connect (minmax_connector )
842+ # Min/max type dropdown
843+ self .minMaxTypeBox = QComboBox ()
844+ self .minMaxTypeBox .addItem ("Full data" )
845+ self .minMaxTypeBox .addItem ("Visible data" )
846+ self .minMaxTypeBox .addItem ("Custom" )
847+ minmax_type_connector = partial (main_window .setTallyMinMaxType )
848+ self .minMaxTypeBox .currentIndexChanged .connect (minmax_type_connector )
851849
852850 # Data min spin box
853851 self .minBox = ScientificDoubleSpinBox ()
@@ -861,6 +859,10 @@ def __init__(self, model, main_window, field, colormaps=None):
861859 max_connector = partial (main_window .editTallyDataMax )
862860 self .maxBox .valueChanged .connect (max_connector )
863861
862+ # Labels for min/max (so we can show/hide them)
863+ self .minLabel = QLabel ("Min: " )
864+ self .maxLabel = QLabel ("Max: " )
865+
864866 # Linear/Log scaling check box
865867 self .scaleBox = QCheckBox ()
866868 scale_connector = partial (main_window .toggleTallyLogScale )
@@ -894,9 +896,9 @@ def __init__(self, model, main_window, field, colormaps=None):
894896 self .layout .addRow ("Colormap: " , self .colormapBox )
895897 self .layout .addRow ("Reverse colormap: " , self .reverseCmapBox )
896898 self .layout .addRow ("Data Indicator: " , self .dataIndicatorCheckBox )
897- self .layout .addRow ("Custom Min/Max : " , self .userMinMaxBox )
898- self .layout .addRow ("Min: " , self .minBox )
899- self .layout .addRow ("Max: " , self .maxBox )
899+ self .layout .addRow ("Min/max : " , self .minMaxTypeBox )
900+ self .layout .addRow (self . minLabel , self .minBox )
901+ self .layout .addRow (self . maxLabel , self .maxBox )
900902 self .layout .addRow ("Log Scale: " , self .scaleBox )
901903 self .layout .addRow ("Clip Data: " , self .clipDataBox )
902904 self .layout .addRow ("Mask Zeros: " , self .maskZeroBox )
@@ -914,16 +916,26 @@ def updateDataIndicator(self):
914916 cv = self .model .currentView
915917 self .dataIndicatorCheckBox .setChecked (cv .tallyDataIndicator )
916918
917- def setMinMaxEnabled (self , enable ):
918- enable = bool (enable )
919- self .minBox .setEnabled (enable )
920- self .maxBox .setEnabled (enable )
919+ def updateMinMaxType (self ):
920+ """Update the min/max type dropdown and show/hide min/max inputs."""
921+ cv = self .model .currentView
922+ type_map = {'full' : 0 , 'visible' : 1 , 'custom' : 2 }
923+ idx = type_map .get (cv .tallyDataMinMaxType , 0 )
924+ self .minMaxTypeBox .blockSignals (True )
925+ self .minMaxTypeBox .setCurrentIndex (idx )
926+ self .minMaxTypeBox .blockSignals (False )
927+ # Show/hide min/max inputs based on whether custom is selected
928+ show_custom = (cv .tallyDataMinMaxType == 'custom' )
929+ self .minLabel .setVisible (show_custom )
930+ self .minBox .setVisible (show_custom )
931+ self .maxLabel .setVisible (show_custom )
932+ self .maxBox .setVisible (show_custom )
921933
922934 def updateMinMax (self ):
923935 cv = self .model .currentView
924936 self .minBox .setValue (cv .tallyDataMin )
925937 self .maxBox .setValue (cv .tallyDataMax )
926- self .setMinMaxEnabled ( cv . tallyDataUserMinMax )
938+ self .updateMinMaxType ( )
927939
928940 def updateTallyVisibility (self ):
929941 cv = self .model .currentView
@@ -951,7 +963,6 @@ def update(self):
951963
952964 self .alphaBox .setValue (cv .tallyDataAlpha )
953965 self .visibilityBox .setChecked (cv .tallyDataVisible )
954- self .userMinMaxBox .setChecked (cv .tallyDataUserMinMax )
955966 self .scaleBox .setChecked (cv .tallyDataLogScale )
956967
957968 self .updateMinMax ()
0 commit comments