apps: settings: Adopt the slider... it looks more interesting
This commit is contained in:
parent
de647b324c
commit
4c7e92d964
1 changed files with 8 additions and 7 deletions
|
@ -12,22 +12,22 @@ class SettingsApp():
|
||||||
NAME = 'Settings'
|
NAME = 'Settings'
|
||||||
ICON = icons.settings
|
ICON = icons.settings
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self._slider = wasp.widgets.Slider(3, 10, 90)
|
||||||
|
|
||||||
def foreground(self):
|
def foreground(self):
|
||||||
self._draw()
|
self._draw()
|
||||||
wasp.system.request_event(wasp.EventMask.TOUCH)
|
wasp.system.request_event(wasp.EventMask.TOUCH)
|
||||||
|
|
||||||
def touch(self, event):
|
def touch(self, event):
|
||||||
brightness = wasp.system.brightness + 1
|
self._slider.touch(event)
|
||||||
if brightness > 3:
|
wasp.system.brightness = self._slider.value + 1
|
||||||
brightness = 1
|
|
||||||
wasp.system.brightness = brightness
|
|
||||||
self._update()
|
self._update()
|
||||||
|
|
||||||
def _draw(self):
|
def _draw(self):
|
||||||
"""Redraw the display from scratch."""
|
"""Redraw the display from scratch."""
|
||||||
wasp.watch.drawable.fill()
|
wasp.watch.drawable.fill()
|
||||||
wasp.watch.drawable.string('Settings', 0, 6, width=240)
|
wasp.watch.drawable.string('Brightness', 0, 6, width=240)
|
||||||
wasp.watch.drawable.string('Brightness', 0, 120 - 3 - 24, width=240)
|
|
||||||
self._update()
|
self._update()
|
||||||
|
|
||||||
def _update(self):
|
def _update(self):
|
||||||
|
@ -37,4 +37,5 @@ class SettingsApp():
|
||||||
say = "Mid"
|
say = "Mid"
|
||||||
else:
|
else:
|
||||||
say = "Low"
|
say = "Low"
|
||||||
wasp.watch.drawable.string(say, 0, 120 + 3, width=240)
|
wasp.watch.drawable.string(say, 0, 150, width=240)
|
||||||
|
self._slider.update()
|
||||||
|
|
Loading…
Reference in a new issue