Source

wd_pys60 / wd_player.PY

Full commit

import audio
m = audio.Sound.open("E:\\Sounds\\[]Silent Hill 2 There was a Hole Here OC ReMix-The Wingless.mp3")
m.set_volume(1)
print dir(m)
m.set_position(10000000L)
b=m.current_position
import appuifw
from graphics import *
import e32
from key_codes import *
import random
import time
class E(object):
    state=1
    Enum=1
    colorDic={0:0x000000,1:0x00ff00}
    boardNum=1
    def __init__(self,Enum=None,state=None):
        self.Enum=Enum or self.Enum
        self.state=state or self.state
    def pos(self):
        return ((self.Enum+1)*20,20)
    def text_pos(self):
        return ((self.Enum+1)*20-5,20+5)
    def color(self):
        return self.colorDic[self.state]
    def text_color(self):
        return self.colorDic[1-self.state]
class E_display(object):
    center=(120,160)
    Es=[]
    def __init__(self,center=None):
        self.center=center or self.center
        for i in range(1,9):
            self.Es.append(E(Enum=i))
        appuifw.app.screen='full'
        self.img=None
        self.myfont=u'Sans MT 936_S60'
        self.running=1
        self.canvas=appuifw.Canvas(
            event_callback=self._handle_event,
            redraw_callback=self._handle_redraw)
        appuifw.app.body=self.canvas
        self.img=Image.new(self.canvas.size)
        appuifw.app.body.bind(55,lambda:self.quit())
    def quit(self):
        self.running=0

    def _handle_redraw(self,rect):
        if self.img:
            self.canvas.blit(self.img)
    def _handle_event(self,event):
        pass
        #print event
        # keyboard_state={}
    def run(self,cycleTime=0):
        while self.running:
            u=b()/1e6
            self.img.text((150,150),unicode(str(u)),0x00ff00)
            """
            for _E in self.Es:
                self.img.point(_E.pos(),_E.color(),width=15)
                self.img.text(_E.text_pos(),unicode(str(_E.state)),_E.text_color())
                _E.state=random.choice([0,1])
                e32.ao_sleep(0.01)
                """
            self._handle_redraw(())
            e32.ao_yield()
if __name__=="__main__":
    #s=E_display()
    #s.run()
    m.play()
    #print s.center
    e32.ao_yield()