×

Discussion Board

Results 1 to 6 of 6

Threaded View

  1. #1
    Registered User
    Join Date
    May 2007
    Posts
    6

    Question .sis file not opening on N70

    Hello everyone.,

    This is the sourcecode for my project..

    # Copyright (c) 2006 Jurgen Scheible
    # this script lets you create a simple application menu

    # NOTE:
    # press the options key in order to open the applicaion menu
    # when running the script!


    from appuifw import *
    from graphics import *
    import camera
    import e32
    import audio
    from key_codes import *
    from ftplib import FTP
    global picselection
    global picselection1
    global picselection2
    global running



    def exit_key_handler():
    app_lock.signal()



    def item0():
    class Keyboard(object):
    def __init__(self,onevent=lambda:None):
    self._keyboard_state={}
    self._downs={}
    self._onevent=onevent
    def handle_event(self,event):
    if event['type'] == appuifw.EEventKeyDown:
    code=event['scancode']
    if not self.is_down(code):
    self._downs[code]=self._downs.get(code,0)+1
    self._keyboard_state[code]=1
    elif event['type'] == appuifw.EEventKeyUp:
    self._keyboard_state[event['scancode']]=0
    self._onevent()
    def is_down(self,scancode):
    return self._keyboard_state.get(scancode,0)
    def pressed(self,scancode):
    if self._downs.get(scancode,0):
    self._downs[scancode]-=1
    return True
    return False
    keyboard=Keyboard()
    running=1
    switch = 1
    appuifw.app.screen='normal'
    img=Image.new((176,208))


    def quit():
    running=0
    appuifw.app.set_exit()


    def handle_redraw(rect):
    canvas.blit(img)


    canvas=appuifw.Canvas(event_callback=keyboard.handle_event, redraw_callback=handle_redraw)
    appuifw.app.body=canvas

    app.exit_key_handler=quit

    screen_picture = camera.take_photo(size = (160,120))



    while running:

    if switch == 1:
    screen_picture = camera.take_photo(size = (160,120))

    img.blit(screen_picture,target=(8,10,168,130),scale=1)

    handle_redraw(())
    e32.ao_yield()

    if keyboard.pressed(EScancodeLeftSoftkey):
    switch = 1

    if keyboard.pressed(EScancodeSelect):
    switch = 2
    e32.ao_yield()
    image = camera.take_photo(size = (640,480))
    filename=u'c:\\picture.jpg'
    image.save(filename)
    screen_picture =Image.open(u'c:\\picture.jpg')
    e32.ao_yield()





    def item1():
    filename = 'c:\\boo.wav'

    # define the recording part:
    def recording():
    global S
    # open the sound file to be ready for recording and set an instance (S) of it
    S=audio.Sound.open(filename)
    # do the recording (has to be stopped by closing() function below)
    S.record()
    print "Recording on! To end it, select stop from menu!"
    # define the playing part:
    def playing():
    global S
    try:
    # open the sound file to be ready for playing by setting an instance (S) of it
    S=audio.Sound.open(filename)
    # play the sound file
    S.play()
    print "Playing"
    except:
    print "Record first a sound!"

    # stopping of recording / playing and closing of the sound file
    def closing():
    global S
    S.stop()
    S.close()
    print "Stopped"


    def exit_key_handler():
    script_lock.signal()
    appuifw.app.set_exit()

    script_lock = e32.Ao_lock()

    appuifw.app.title = u"Sound recorder"

    # define the application menu
    appuifw.app.menu = [(u"play", playing),
    (u"record", recording),
    (u"stop", closing),
    (u"Upload", item3)]

    appuifw.app.exit_key_handler = exit_key_handler
    script_lock.wait()



    def item2():
    def __exit__():
    APP_LOCK.signal()

    def doSave():
    try:
    f = open( 'c:\\yourFile.txt', 'wb' )
    yourText = appuifw.app.body.get()
    f.write( yourText.encode("utf-8") )
    f.close
    appuifw.note( u'Saved ', 'conf' )

    except IOError, e:
    appuifw.note( u'Wrong file path!', 'error' )

    except UnicodeError, e:
    appuifw.note( unicode( e ), 'error' )


    if __name__ == "__main__":
    APP_LOCK = e32.Ao_lock()
    appuifw.app.title = u'Text to file'
    appuifw.app.exit_key_handler = __exit__
    appuifw.app.body = appuifw.Text()
    appuifw.app.menu = [( u'Save', doSave ),
    ( u'Exit', __exit__ )]
    APP_LOCK.wait()







    def item3():
    picselection = 'c:\\fboo.wav' # name of file to be uploaded (path on phones hard drive)
    picselection1 = 'c:\\picture.jpg' # name of file to be uploaded (path on phones hard drive)
    picselection2 = 'c:\\yourFile.txt' # name of file to be uploaded (path on phones hard drive)


    def fireupfile():
    ftp = FTP('www.palplanet.net') # give servername
    ftp.set_pasv('true')
    ftp.login('xxx','xxxxxx') # give login anonymous
    ftp.cwd('public_html/wavfiles') # give correct folder where to store the image
    F=open(picselection,'r')
    F1=open(picselection1,'r')
    F1=open(picselection1,'r')
    F2=open(picselection2,'r')
    ftp.storbinary('STOR fboo.wav',F,1024) # give name of image to be stored as URL
    ftp.storbinary('STOR picture.jpg',F1,1024) # give name of image to be stored as URL
    ftp.storbinary('STOR shata.txt',F2,1024) # give name of image to be stored as URL
    ftp.quit()
    F.close()

    if appuifw.query(u"fire up stuff?","query") == True:
    fireupfile()



    def item4():
    appuifw.note(u"Created By Mani", "info")


    app_lock = e32.Ao_lock()
    appuifw.app.menu = [(u"Camera", item0),
    (u"Audio", item1),
    (u"Text", item2),
    (u"Fire", item3),
    (u"About", item4)]

    appuifw.app.exit_key_handler = exit_key_handler
    app_lock.wait()

    The filename is proj.py
    I'm using py2sis to create a sis file as
    c:\>py2sis proj.py proj.sis --uid=0x0FF11111 --appname=project

    After i push the sis file and install it the app opens and exits with a blank screen.. please suggest..
    Last edited by asteroidm; 2007-05-04 at 10:46.

Similar Threads

  1. Create .sis File Failed Help Me Please!!!!
    By tkd82 in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2006-08-31, 12:23
  2. S60 theme questions
    By Nokian_Spb in forum Symbian Media (Closed)
    Replies: 3
    Last Post: 2006-08-17, 06:11
  3. Replies: 2
    Last Post: 2004-01-03, 09:38
  4. Opening WAP browser on local file
    By nawkboy in forum Symbian
    Replies: 4
    Last Post: 2003-09-10, 22:18

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×