×
Namespaces

Variants
Actions

Archived:A simple timeout application using PySymbian

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngAquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.

All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.

Article Metadata
Article
Created: cyke64 (19 Mar 2007)
Last edited: hamishwillee (31 May 2013)

Remind yourself of how fast time fly with this application. You should change the sound file to the one you like.

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()
This page was last modified on 31 May 2013, at 04:06.
53 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×