apps.homescreen: brighten the display after swipe
This commit is contained in:
parent
bd514c4732
commit
d13006ebbe
|
@ -5,24 +5,19 @@ from trezor.utils import unimport
|
||||||
async def swipe_to_rotate():
|
async def swipe_to_rotate():
|
||||||
from trezor.ui.swipe import Swipe
|
from trezor.ui.swipe import Swipe
|
||||||
|
|
||||||
while True:
|
degrees = await Swipe(absolute=True)
|
||||||
degrees = await Swipe(absolute=True)
|
ui.display.orientation(degrees)
|
||||||
ui.display.orientation(degrees)
|
|
||||||
display_homescreen()
|
|
||||||
|
|
||||||
|
|
||||||
async def dim_screen():
|
async def dim_screen():
|
||||||
current = ui.display.backlight()
|
original = ui.display.backlight()
|
||||||
|
|
||||||
await loop.Sleep(5 * 1000000)
|
|
||||||
await ui.backlight_slide(ui.BACKLIGHT_DIM)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
await loop.Sleep(5 * 1000000)
|
||||||
|
await ui.backlight_slide(ui.BACKLIGHT_DIM)
|
||||||
while True:
|
while True:
|
||||||
await loop.Sleep(1000000)
|
await loop.Sleep(1000000)
|
||||||
finally:
|
finally:
|
||||||
# Return back to original brightness
|
ui.display.backlight(original)
|
||||||
ui.display.backlight(current)
|
|
||||||
|
|
||||||
|
|
||||||
def display_homescreen():
|
def display_homescreen():
|
||||||
|
@ -39,6 +34,8 @@ def display_homescreen():
|
||||||
|
|
||||||
@unimport
|
@unimport
|
||||||
async def layout_homescreen():
|
async def layout_homescreen():
|
||||||
display_homescreen()
|
|
||||||
ui.display.backlight(ui.BACKLIGHT_NORMAL)
|
ui.display.backlight(ui.BACKLIGHT_NORMAL)
|
||||||
await loop.Wait([swipe_to_rotate(), dim_screen()])
|
|
||||||
|
while True:
|
||||||
|
display_homescreen()
|
||||||
|
await loop.Wait([swipe_to_rotate(), dim_screen()])
|
||||||
|
|
Loading…
Reference in New Issue