×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Nov 2008
    Location
    Austria
    Posts
    3

    InfoPopup called from class not working

    Hello all,

    merry christmas - hope you got some nice presents :-)

    I'm just playing around with the InfoPopup class since I would like to use it for my OpenGPX project, but for whatever reason it doesn't work if it's called out of a class. Here's an example:

    Code:
    #!/usr/bin/python
    
    import appuifw
    import e32
    
    def open_ip():
        pop3 = appuifw.InfoPopup()
        pop3.show(u'Not shown (function)')
    
    class TIP:
        
        def __init__(self):
            pass
    
        def show_ip(self):
            pop2 = appuifw.InfoPopup()
            pop2.show(u'Not shown (internal)')
            
        def show_ext(self):
            open_ip()
    
    def handle_exit():
        lock.signal()
    
    def quit():
        app_lock.signal()
    
    appuifw.app.title = u'InfoPopUp Test'
    appuifw.app.body = appuifw.Text()
    
    menu_exit = (u'Exit', handle_exit)
    
    appuifw.app.exit_key_handler = quit
    app_lock = e32.Ao_lock()
    
    pop=appuifw.InfoPopup()
    pop.show(u'Just a InfoPopup')
    
    tip_test = TIP()
    tip_test.show_ip()
    tip_test.show_ext()
    
    app_lock.wait()
    so both InfoPopups, which should be shown in the TIP class are not being shown on my Nokia 6110 Nav. with PyS60 1.4.5 There is some different behaviour if I use just one InfoPopup instance, but that's not working properly as well.

    any ideas ?

    greetings,

    Martin

  2. #2
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: InfoPopup called from class not working

    Hi,

    I think there are 2 problems with your code.

    The first one is that the popups are all displayed in the same place so you can only see the last one. That can be fixed by setting different coordinates for each popup.

    The second one is a bit harder to catch: the two functions (open_ip and show_ip) return immediately and thus the popups they call go out of scope immediately. This can be fixed by declaring the popups global.

    Here is a working code in which the popups in the functions are global and coordinates for them have been specified:
    Code:
    #!/usr/bin/python
    
    import appuifw
    import e32
    
    def open_ip():
        global pop3
        pop3 = appuifw.InfoPopup()
        pop3.show(u'Not shown (function)', (30,30))
    
    class TIP:
        
        def __init__(self):
            pass
    
        def show_ip(self):
            global pop2
            pop2 = appuifw.InfoPopup()
            pop2.show(u'Not shown (internal)', (60,60))
            
        def show_ext(self):
            open_ip()
    
    def handle_exit():
        lock.signal()
    
    def quit():
        app_lock.signal()
    
    appuifw.app.title = u'InfoPopUp Test'
    appuifw.app.body = appuifw.Text()
    
    menu_exit = (u'Exit', handle_exit)
    
    appuifw.app.exit_key_handler = quit
    app_lock = e32.Ao_lock()
    
    pop=appuifw.InfoPopup()
    pop.show(u'Just a InfoPopup')
    
    tip_test = TIP()
    tip_test.show_ip()
    tip_test.show_ext()
    
    app_lock.wait()
    Merry Christmas

  3. #3
    Registered User
    Join Date
    Nov 2008
    Location
    Austria
    Posts
    3

    Re: InfoPopup called from class not working

    ah thanks a lot ... I thought .show() would open a dialog / modal popup window and that code execution would stop there my stupid mistake ... so thanks again :-)

    Martin

Similar Threads

  1. Singleton class implementation
    By MehulPatel in forum Symbian
    Replies: 5
    Last Post: 2008-04-11, 11:46
  2. Replies: 3
    Last Post: 2007-08-24, 21:39
  3. Replies: 6
    Last Post: 2005-10-03, 05:51
  4. Exceptions while loading application
    By avinash_rs in forum Mobile Java General
    Replies: 0
    Last Post: 2003-06-09, 10:53
  5. CAknForm derived class does not display via navi pane
    By andyesquire in forum Symbian User Interface
    Replies: 1
    Last Post: 2003-03-01, 19:07

Posting Permissions

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