Mobile timeout app
from appuifw import * from key_codes import * from graphics import Image from audio import * import e32, miso def change_duration(): global duration answer = query(u'How long?', 'time', 18000.0) if answer: duration = int(answer/60) if duration <= 200: if query(u'Change to hr:min ?', 'query'): duration *= 60 im = Image.new((60,48)) def showtime(rect=None): im.clear() im.text((5,28), u"%02d:%02d" % divmod(duration,60), font='title') c.blit(im, target=(0,0,180,144), scale=1) # triple size duration = 300 running = 0 app.body = c = Canvas(showtime) alert = Sound.open(u'Z:\\Nokia\\Sounds\\Digital\\Cuckoo.awb') showtime() def start(): global duration, running running = 1 while running: duration -= 1 showtime() if duration <= 0: alert.play(-2) # repeat play break if duration % 10 == 0: miso.reset_inactivity_time() e32.ao_sleep(1) def toggle(): global running if alert.state() == EPlaying: alert.stop() return running = 1 - running if running: start() def quit(): global running running = 0 if alert.state() == EPlaying: alert.stop() lock.signal() lock = e32.Ao_lock() c.bind(EKeySelect, toggle) # start, pause, resume app.menu = [(u'Duration', change_duration),(u'Close', quit)] app.exit_key_handler = quit lock.wait()
Remind yourself of how fast time fly with this app.
You should change the sound file to the one you like.
(I use cuckoo.awb)
The duration input abues the time input by treating input
as minutes and seconds instead of hours and minutes.
But if the duration is too short, it will ask you if you mean
hours and minutes.