widgets: Clarity whether spinner max is inclusive or exclusive
Currently the spinner uses exclusive max when wrapping from low to high and inclusive max when wrapping from high to low. Fix this by adopting *inclusive* max everywhere. The call sites are similarly confused. Fix this! Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
This commit is contained in:
parent
9314eeafbc
commit
05310a82f8
3 changed files with 5 additions and 5 deletions
|
@ -58,8 +58,8 @@ class AlarmApp():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""Initialize the application."""
|
"""Initialize the application."""
|
||||||
self.active = widgets.Checkbox(104, 200)
|
self.active = widgets.Checkbox(104, 200)
|
||||||
self.hours = widgets.Spinner(50, 60, 0, 24, 2)
|
self.hours = widgets.Spinner(50, 60, 0, 23, 2)
|
||||||
self.minutes = widgets.Spinner(130, 60, 0, 60, 2)
|
self.minutes = widgets.Spinner(130, 60, 0, 59, 2)
|
||||||
|
|
||||||
self.hours.value = 7
|
self.hours.value = 7
|
||||||
self.ringing = False
|
self.ringing = False
|
||||||
|
|
|
@ -62,7 +62,7 @@ class TimerApp():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""Initialize the application."""
|
"""Initialize the application."""
|
||||||
self.minutes = widgets.Spinner(50, 60, 0, 99, 2)
|
self.minutes = widgets.Spinner(50, 60, 0, 99, 2)
|
||||||
self.seconds = widgets.Spinner(130, 60, 0, 60, 2)
|
self.seconds = widgets.Spinner(130, 60, 0, 59, 2)
|
||||||
self.current_alarm = None
|
self.current_alarm = None
|
||||||
|
|
||||||
self.minutes.value = 10
|
self.minutes.value = 10
|
||||||
|
|
|
@ -386,7 +386,7 @@ class Spinner():
|
||||||
self.value = mn
|
self.value = mn
|
||||||
|
|
||||||
def draw(self):
|
def draw(self):
|
||||||
"""Draw the slider."""
|
"""Draw the spinner."""
|
||||||
draw = watch.drawable
|
draw = watch.drawable
|
||||||
im = self._im
|
im = self._im
|
||||||
fg = draw.lighten(wasp.system.theme('ui'), wasp.system.theme('contrast'))
|
fg = draw.lighten(wasp.system.theme('ui'), wasp.system.theme('contrast'))
|
||||||
|
@ -417,7 +417,7 @@ class Spinner():
|
||||||
else:
|
else:
|
||||||
self.value -= 1
|
self.value -= 1
|
||||||
if self.value < im[2]:
|
if self.value < im[2]:
|
||||||
self.value = im[3] - 1
|
self.value = im[3]
|
||||||
|
|
||||||
self.update()
|
self.update()
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in a new issue