×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    5

    Some problem of my app in emulator

    That is my code by python.I exec it in the emulator of Symbian 9.1 S60 3rd Edition.

    this is the order of my commend.

    start python shell
    run my code
    exit my code
    exit python shell

    and then the error message of "cone 8" show in the screen.

    I couldn't find any error from the code below.

    Wait for your help.

    Code:
    import appuifw
    import graphics
    import e32
    
    class MyApp(object):
        def __init__(self):
            self.app_lock=e32.Ao_lock()
            appuifw.app.exit_key_handler=self.exit_key_handler
    
            appuifw.app.title=u'Hello World'
            appuifw.app.screen='full'
            appuifw.app.menu=[(u'normal',self.itema),
                              (u'large',self.itemb),
                              (u'full',self.itemc)]
    
            self.img=None
            self.canvas=appuifw.Canvas(redraw_callback=self.redraw)
            
            appuifw.app.body=self.canvas
            self.img=graphics.Image.new(self.canvas.size)
            self.img.clear(0x00ff00)
            appuifw.app.body.blit(self.img)
    
        def loop(self):
            self.app_lock.wait()
            return
    
        def exit_key_handler(self):
            self.app_lock.signal()
            return
        def redraw(self):
            
            return
        def itema(self):
            appuifw.app.screen='normal'
            return
        def itemb(self):
            appuifw.app.screen='large'
            return
        def itemc(self):
            appuifw.app.screen='full'
    
        
    app=MyApp()
    app.loop()

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: Some problem of my app in emulator

    Quote Originally Posted by WayneHuang View Post
    start python shell
    run my code
    exit my code
    exit python shell

    and then the error message of "cone 8" show in the screen.

    Code:
        def loop(self):
            self.app_lock.wait()
            return
    ...
        def exit_key_handler(self):
            self.app_lock.signal()
            return
    ...    
    app=MyApp()
    app.loop()
    Just a wild guess: you exit during app_lock.wait(). Manual says:

    class Ao lock()

    Creates an Ao lock instance. A Symbian active object based synchronization service. This can
    be used in the main thread without blocking the handling of UI events. The application should
    not exit while a thread is waiting in Ao lock
    . If Ao lock.wait is called while another wait call
    is already in progress, an AssertionError is raised.
    Cheers,

    --jouni

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    5

    Re: Some problem of my app in emulator

    I don't agree with you.
    If the code is below,there is no error in the screen.

    Is the bug of PyS60 or my code?

    P.S. It is O.K. to run the demo of PyS60 named "ball.py"
    Code:
    import e32
    
    class MyApp(object):
        def __init__(self):
            self.app_lock=e32.Ao_lock()
            appuifw.app.exit_key_handler=self.exit_key_handler
    
            appuifw.app.title=u'Hello World'
            appuifw.app.screen='full'
            appuifw.app.menu=[(u'normal',self.itema),
                              (u'large',self.itemb),
                              (u'full',self.itemc)]
    
            self.img=None
            self.canvas=appuifw.Canvas()
            
            appuifw.app.body=self.canvas
            self.img=graphics.Image.new(self.canvas.size)
            self.img.clear(0x00ff00)
            appuifw.app.body.blit(self.img)
    
        def loop(self):
            self.app_lock.wait()
            return
    
        def exit_key_handler(self):
            self.app_lock.signal()
            return
    
        def itema(self):
            appuifw.app.screen='normal'
            return
        def itemb(self):
            appuifw.app.screen='large'
            return
        def itemc(self):
            appuifw.app.screen='full'
    
        
    app=MyApp()
    app.loop()

  4. #4
    Regular Contributor
    Join Date
    Dec 2007
    Location
    Tempe, AZ
    Posts
    411

    Re: Some problem of my app in emulator

    Hi WayneHuang,
    Welcome to forum first of all.
    See i am using emulator 8.0a/S60_2nd_FP2 with PyS60 Version 1.4.3 and your original script is working perfectly in my emulator.

    Code:
    import appuifw
    import graphics
    import e32
    
    class MyApp(object):
        def __init__(self):
            self.app_lock=e32.Ao_lock()
            appuifw.app.exit_key_handler=self.exit_key_handler
    
            appuifw.app.title=u'Hello World'
            appuifw.app.screen='full'
            appuifw.app.menu=[(u'normal',self.itema),
                              (u'large',self.itemb),
                              (u'full',self.itemc)]
    
            self.img=None
            self.canvas=appuifw.Canvas(redraw_callback=self.redraw)
            
            appuifw.app.body=self.canvas
            self.img=graphics.Image.new(self.canvas.size)
            self.img.clear(0x00ff00)
            appuifw.app.body.blit(self.img)
    
        def loop(self):
            self.app_lock.wait()
            return
    
        def exit_key_handler(self):
            self.app_lock.signal()
            return
        def redraw(self):
            
            return
        def itema(self):
            appuifw.app.screen='normal'
            return
        def itemb(self):
            appuifw.app.screen='large'
            return
        def itemc(self):
            appuifw.app.screen='full'
    
        
    app=MyApp()
    app.loop()
    Except one error i.e.

    TypeError: redraw() takes exactly 1 argument (2 given)
    IDEAS is all they need but still they think only Genius can give them that.

  5. #5
    Registered User
    Join Date
    Jun 2008
    Posts
    5

    Re: Some problem of my app in emulator

    That is my mistake.
    You could use "def redraw(self,rect)" instead of "def redraw(self)".

    But the error is showing too. Have no idea about it.

    I use Emulator of S60 3rd edition MR.
    I don't know wheather it is the problem of emulator.

    CONE 8. that is a good question. :-)

  6. #6
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: Some problem of my app in emulator

    Hmph,

    CONE 8 is resource leak, which means that python was not able to free all resource allocations at exit time. This happens occasionally, when the code is too complex. In such cases we have to help python...

    Code:
        def exit_key_handler(self):
            del self.img
            del self.canvas
            self.app_lock.signal()
            return
    Seems to work,

    --jouni

  7. #7
    Registered User
    Join Date
    Jun 2008
    Posts
    5

    Re: Some problem of my app in emulator

    Thanks,JOM. It is O.K.

    By the way, Shall we use 'del' to release all resource before we exit the PyS60?

  8. #8
    Super Contributor
    Join Date
    Mar 2003
    Location
    Espoo, Finland
    Posts
    976

    Re: Some problem of my app in emulator

    Quote Originally Posted by WayneHuang View Post
    By the way, Shall we use 'del' to release all resource before we exit the PyS60?
    Python is supposed to do that by itself, but occasionally it won't.. so just in case you might want to release, close and delete everything you have reserved, opened and created.

    Whether it's actually "del" or something else, depends on resource

    Cheers,

    --jouni

Similar Threads

  1. ChildInstaller app. closed problem
    By jlruiz in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2005-01-26, 16:58
  2. Problem With 3510i Emulator With Java Studio Mobility
    By ogucbey in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2004-12-10, 18:00
  3. 7210 emulator used heap problem
    By baegsi in forum Mobile Java General
    Replies: 3
    Last Post: 2004-01-30, 17:11
  4. Series 60 Emulator Problem HTTPPost
    By brett_boswell@hotmail.com in forum Mobile Java Tools & SDKs
    Replies: 2
    Last Post: 2003-09-09, 13:59
  5. Web services on Series 60 emulator problem
    By paulgrimwood in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2003-08-05, 10:05

Posting Permissions

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