@@ -46,7 +46,7 @@ def __init__(
46
46
bins_start .setStepType (QAbstractSpinBox .AdaptiveDecimalStepType )
47
47
bins_start .setRange (- 1e10 , 1e10 )
48
48
bins_start .setValue (0 )
49
- bins_start .setWrapping (True )
49
+ bins_start .setWrapping (False )
50
50
bins_start .setKeyboardTracking (False )
51
51
bins_start .setDecimals (2 )
52
52
@@ -55,6 +55,7 @@ def __init__(
55
55
bins_stop .setStepType (QAbstractSpinBox .AdaptiveDecimalStepType )
56
56
bins_stop .setRange (- 1e10 , 1e10 )
57
57
bins_stop .setValue (100 )
58
+ bins_start .setWrapping (False )
58
59
bins_stop .setKeyboardTracking (False )
59
60
bins_stop .setDecimals (2 )
60
61
@@ -165,13 +166,17 @@ def on_update_layers(self) -> None:
165
166
self .autoset_widget_bins (data = layer_data )
166
167
167
168
# Only allow integer bins for integer data
169
+ # And only allow values greater than 0 for unsigned integers
168
170
n_decimals = 0 if np .issubdtype (layer_data .dtype , np .integer ) else 2
169
- self .findChild (QDoubleSpinBox , name = "bins start" ).setDecimals (
170
- n_decimals
171
- )
172
- self .findChild (QDoubleSpinBox , name = "bins stop" ).setDecimals (
173
- n_decimals
174
- )
171
+ is_unsigned = layer_data .dtype .kind == "u"
172
+ minimum_value = 0 if is_unsigned else - 1e10
173
+
174
+ bins_start = self .findChild (QDoubleSpinBox , name = "bins start" )
175
+ bins_stop = self .findChild (QDoubleSpinBox , name = "bins stop" )
176
+ bins_start .setDecimals (n_decimals )
177
+ bins_stop .setDecimals (n_decimals )
178
+ bins_start .setMinimum (minimum_value )
179
+ bins_stop .setMinimum (minimum_value )
175
180
176
181
def draw (self ) -> None :
177
182
"""
0 commit comments