@@ -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,10 +859,9 @@ def __init__(self, model, main_window, field, colormaps=None):
861859 max_connector = partial (main_window .editTallyDataMax )
862860 self .maxBox .valueChanged .connect (max_connector )
863861
864- # Auto rescale check box
865- self .autoRescaleBox = QCheckBox ()
866- auto_rescale_connector = partial (main_window .toggleTallyAutoRescale )
867- self .autoRescaleBox .stateChanged .connect (auto_rescale_connector )
862+ # Labels for min/max (so we can show/hide them)
863+ self .minLabel = QLabel ("Min: " )
864+ self .maxLabel = QLabel ("Max: " )
868865
869866 # Linear/Log scaling check box
870867 self .scaleBox = QCheckBox ()
@@ -899,10 +896,9 @@ def __init__(self, model, main_window, field, colormaps=None):
899896 self .layout .addRow ("Colormap: " , self .colormapBox )
900897 self .layout .addRow ("Reverse colormap: " , self .reverseCmapBox )
901898 self .layout .addRow ("Data Indicator: " , self .dataIndicatorCheckBox )
902- self .layout .addRow ("Custom Min/Max: " , self .userMinMaxBox )
903- self .layout .addRow ("Min: " , self .minBox )
904- self .layout .addRow ("Max: " , self .maxBox )
905- self .layout .addRow ("Auto rescale: " , self .autoRescaleBox )
899+ self .layout .addRow ("Min/max: " , self .minMaxTypeBox )
900+ self .layout .addRow (self .minLabel , self .minBox )
901+ self .layout .addRow (self .maxLabel , self .maxBox )
906902 self .layout .addRow ("Log Scale: " , self .scaleBox )
907903 self .layout .addRow ("Clip Data: " , self .clipDataBox )
908904 self .layout .addRow ("Mask Zeros: " , self .maskZeroBox )
@@ -920,22 +916,26 @@ def updateDataIndicator(self):
920916 cv = self .model .currentView
921917 self .dataIndicatorCheckBox .setChecked (cv .tallyDataIndicator )
922918
923- def updateAutoRescale (self ):
919+ def updateMinMaxType (self ):
920+ """Update the min/max type dropdown and show/hide min/max inputs."""
924921 cv = self .model .currentView
925- self .autoRescaleBox .setChecked (cv .tallyDataAutoRescale )
926- self .autoRescaleBox .setEnabled (not cv .tallyDataUserMinMax )
927-
928- def setMinMaxEnabled (self , enable ):
929- enable = bool (enable )
930- self .minBox .setEnabled (enable )
931- self .maxBox .setEnabled (enable )
932- self .autoRescaleBox .setEnabled (not enable )
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 )
933933
934934 def updateMinMax (self ):
935935 cv = self .model .currentView
936936 self .minBox .setValue (cv .tallyDataMin )
937937 self .maxBox .setValue (cv .tallyDataMax )
938- self .setMinMaxEnabled ( cv . tallyDataUserMinMax )
938+ self .updateMinMaxType ( )
939939
940940 def updateTallyVisibility (self ):
941941 cv = self .model .currentView
@@ -963,13 +963,11 @@ def update(self):
963963
964964 self .alphaBox .setValue (cv .tallyDataAlpha )
965965 self .visibilityBox .setChecked (cv .tallyDataVisible )
966- self .userMinMaxBox .setChecked (cv .tallyDataUserMinMax )
967966 self .scaleBox .setChecked (cv .tallyDataLogScale )
968967
969968 self .updateMinMax ()
970969 self .updateMaskZeros ()
971970 self .updateVolumeNorm ()
972971 self .updateDataClip ()
973- self .updateAutoRescale ()
974972 self .updateDataIndicator ()
975973 self .updateTallyContours ()
0 commit comments