×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    77

    script working in emulator doesn't work as standalone application

    Being a hobbyist OPL programmer on Psion Series 5 and Nokia Communicator I'm now doing my 'first steps' with Python. Thanks to this forum with first working results ;-).
    I successfully created some small scripts which I up to now executed in the Python environment (1.4.0) on my mobile phone (6120 classic) and in the S60 emulator. Now I wanted to create a standalone application with ensymble (0.23). Creating a SIS file and installing it on the phone (internal memory) worked flawless. An icon appears, I can start the application and the program functionality works as expected. With one exception: closing the standalone application doesn't work. Neither via the right softkey nor via the menu the application can be closed. When I execute the script from inside the Python program both ways to close/exit the script work.

    The stripped down 'framework' resulting in the described behaviour:
    Code:
    import appuifw
    import e32
    
    def calculate():
    	appuifw.note(u"calculate",'info')
    	
    def about():
    	appuifw.note(u"about",'info')
    
    def exit_key_handler():
    	app_lock.signal()
    
    appuifw.app.screen = 'normal'
    appuifw.app.title = u"CalGCS"
    
    appuifw.app.menu = [(u"Calculate",calculate),(u"About",about),(u"Exit",exit_key_handler)]
    	
    app_lock = e32.Ao_lock()
    
    appuifw.app.exit_key_handler = exit_key_handler
    app_lock.wait()
    Ensymble command used to create the standalone application:
    Code:
    ensymble.py py2sis Test.py --lang=GE
    Any help would be appreciated, thanks Martin.

  2. #2
    Regular Contributor
    Join Date
    Sep 2005
    Location
    Finland, Helsinki
    Posts
    323

    Re: script working in emulator doesn't work as standalone application

    Quote Originally Posted by dehlerm View Post
    - - closing the standalone application doesn't work.
    Code:
    app_lock = e32.Ao_lock()
    appuifw.app.exit_key_handler = exit_key_handler
    app_lock.wait()
    Try to append this to the end of your code:
    Code:
    appuifw.app.set_exit()

  3. #3
    Registered User
    Join Date
    Sep 2003
    Posts
    77

    Re: script working in emulator doesn't work as standalone application

    Thanks for this hint! It solved my reported problem :-).

    The only drawback I noticed is, that the script shell is closed then also. To prevent this while testing in the emulator I now use:

    Code:
    if not e32.in_emulator():
    	appuifw.app.set_exit()
    Hopefully it isn't harmful in a standalone application?

  4. #4
    Super Contributor
    Join Date
    May 2006
    Location
    Oulu, Finland
    Posts
    622

    Re: script working in emulator doesn't work as standalone application

    Hi dehlerm,

    You can check if your application is running as a standalone (i.e not from the script shell) like this:
    Code:
    # detect if the app run as a standalone application or throught the shell
    if appuifw.app.full_name()[-10:].lower() == u"python.app" and e32.s60_version_info[0] < 3:
        is_standalone=False
    elif appuifw.app.full_name()[-10:].lower() == u"python.exe" and e32.s60_version_info[0] >= 3:
        is_standalone=False
    else:
        is_standalone=True
    Then to exit properly
    Code:
    def exit_key_handler():
        app_lock.signal()
        if is_standalone:   
            appuifw.app.set_exit()
    It is nice to still be able to check the traces on the Python script shell for debuggin on the phone. That way you can do it.

    LFD
    Devices:
    Nokia E61 3rd Edition - pys60 1.4.0

    Tips and modules:
    http://www.lfdm.net/thesis

Similar Threads

  1. Standalone application with ensymble
    By andrea_ap in forum Symbian
    Replies: 11
    Last Post: 2007-06-29, 06:25
  2. Replies: 2
    Last Post: 2007-06-19, 18:31
  3. Sample application with PC Connectivity SDK not working
    By bijugk in forum PC Suite API and PC Connectivity SDK
    Replies: 0
    Last Post: 2007-05-04, 05:01
  4. SMSEmail C++ Application NOT WORKING .... HELP !!!
    By stephenwhire68 in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2002-07-25, 05:00

Posting Permissions

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