×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Super Contributor
    Join Date
    May 2006
    Location
    Oulu, Finland
    Posts
    622

    Lightbulb [announce] wait & progress dialog wrapper 0.2

    Hi folks,

    Today I'm giving you dialog 0.2. What is new in this second release:
    • better Wait dialog
    • new Progress dialog


    For those who downloaded the previous version, wait has been renamed Wait. Wait dialog has now the following constructor:
    Code:
    Wait(u"Your label"[, False] )
    The new parameter is False by default. By giving True or an integer greater than 0 you allow the user to cancel the dialog and the cancel key label appear for the exit softkey.

    You have now the following methods available:
    • show([string]) optional:if you give a string, it will update the dialog label
    • close() dismiss the dialog
    • set_label(label=u'') change the dialog label


    Progress is a wrapper for the native progress bar. It has the following constructor:
    Code:
    Progress(label=u'', bars=5, [time=0, global=True])
    • label: the text to be displayed
    • bars: the maximum of bars (steps) to be displayed by the dialog
    • time: (optional) the time given is in seconds. If this parameters is set the bar will be incremented automatically. If you give for example 15 bars and 5 seconds the dialog will be incremented of 3 bars per second an then be dismissed.
    • global: (optional) True by default. If True the dialog is displayed while the script can do something in background. If False, the operation will be blocking and the script will continue only when the dialog will be dismissed. Note: time=0 + global=False returns since you cannot apply method on the object.


    Progress has the following methods:
    • show(): show the dialog
    • step([int]): if no arguments given step + 1. Optional, if an integer is given it will set of the number given (ex: step(3) do bars+3). If there is an error in the parameter it step of 1
    • set_label( [string] ): set a new label for the dialog. Parameter as to be Unicode
    • goto( [int] ): go to the required step
    • bars(): return the number of bar currently display or -1 if the object has been dereferenced or not yet references
    • close(): close the dialog


    Warning! Unfortunately, this library only works 100% with 3rd edition platforms Wait works for both 2nd and 3rd edition but I'm having difficulties with Progress and 2nd edition. When the script returns it crashed Python and I get App. close with no error messages. I've been searching for hours now and I just can't find out what the problem is. Some destruction issues very certainly because the object destructor is never called.

    So if someone has the courage to look at the source or even give me a hint I'll more than great full. I'm really begging for help now, I'm just stuck!

    What is left to do?
    I wanted to have the possibility to add a callback function, method if the user cancels the dialog. It would be very nice and handy. I have tried one implementation without success. I have left the commented source in Wait. I get a KERN-EXEC 3 when trying to run (line 168):
    Code:
    TRAPD(error, rval = PyEval_CallObject( (PyObject*)func, (PyObject*)arg ));
    Once again I'm asking for help since once this is fixed for Wait, the code will be the same for progress.


    So please get your version at http://students.oamk.fi/~dlefevre/th...dex.php/dlm/36 and report me bugs and suggestions to make the module better

    Best regards

    LFD
    Last edited by lfd; 2007-03-01 at 10:07.
    Devices:
    Nokia E61 3rd Edition - pys60 1.4.0

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

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

    Re: [announce] wait & progress dialog wrapper 0.2

    Hi,

    I've seen that couple of you downloaded the extension, but I haven't had any feedback.

    I'm sorry to ask again but I'd need to know if anybody had difficulties or if it just work for all of you

    I'm still searching the error with 2nd edition platform but I have to say that it is a nasty bug

    LFD
    Devices:
    Nokia E61 3rd Edition - pys60 1.4.0

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

  3. #3
    Registered User
    Join Date
    Feb 2005
    Location
    Belgium (Europe)
    Posts
    1,352

    Re: [announce] wait & progress dialog wrapper 0.2

    Quote Originally Posted by lfd
    Hi,

    I've seen that couple of you downloaded the extension, but I haven't had any feedback.

    I'm sorry to ask again but I'd need to know if anybody had difficulties or if it just work for all of you

    I'm still searching the error with 2nd edition platform but I have to say that it is a nasty bug

    LFD
    Hey lfd

    There are so many bugs in it that I could have no time enumerating all

    Wait a little I'll come back to talk about that

    Cyke64
    pys60 1.4.5 and 2.0.0, pygame, PyS60 CE on E90 and 5800 !

    Find my pys60 extension modules on cyke64.googlepages.com

  4. #4
    Registered User
    Join Date
    Feb 2005
    Location
    Belgium (Europe)
    Posts
    1,352

    Re: [announce] wait dialog wrapper 0.2

    It's me again

    First I saw these cases :

    Wait
    default=no cancel key
    * no interruption
    * interrupt display with cancel key

    Progress
    default =non-blocking and manual
    global = 1 (non-blocking)
    time=0 or None (manual)

    * blocking and automatic
    glob=0
    time>zero
    *stops when time elapsed*
    * non-blocking and manual
    glob=1
    time=0
    *stops when bars() = max *
    * non-blocking and automatic
    glob=1
    time>zero
    *stop when bars() = max or time elapsed*
    * blocking and manual
    glob=0
    time=0
    Nothing done

    Secondly some remarks :

    * I suggest hide instead of close because you hide widget !

    * update dialog to 0.2 doesn't work
    workaround : desinstall 0.1 first then install 0.2

    * allowing choice location for installing on c: or e:
    because now it works with new Pys60 (works with N80 !)

    * bars=5000 and time=10 ==> 80 secs ! (look my example below !)

    * in Progress , global parameter doesn't exist you want say surely glob
    perhap glob name is irrelevant here replace it by something like blocking

    * in my example I find these bugs (on N93)

    - wait cancel : when I press cancel python script quit !

    - progress auto blocking : when I press cancel python script quit !

    sometimes after using some progress python quit also !

    At least my example
    Code:
    import e32, appuifw
    from dialog import Wait, Progress
    from e32 import ao_sleep as sleep
    
    appuifw.app.title= u''
    
    def info(arg):
        appuifw.app.title= u'%s'%arg
        
    def end_script():
      script_lock.signal()
    
    def wait():
      info("")
      dlg = Wait(u"Hello Wait note :)")
      dlg.show()
      info("Show")
      sleep(3)
      dlg.show()
      dlg.set_label(u'Wait! Don\'t go :\'(')
      info("Change label")
      sleep(2)
      dlg.close()
      info("Wait, that's not finished!")
      sleep(3)
      dlg.show(u'Me again ;)')
      sleep(3)
      dlg.close()
      sleep(3)
      dlg.show()
      info("Show again with the last label")
      sleep(2)
      dlg.close()
      info("that's finished !")
    
    def wait_cancel():
      info("")
      dlg = Wait(u"press cancel for exit before 5 sec :)",1 )
      dlg.show()
      info("Show")
      sleep(1)
      info("remains 4 secs")
      sleep(1)
      info("remains 3 secs")
      sleep(1)
      info("remains 2 secs")
      sleep(1)
      info("remains 1 secs")
      sleep(1)
      info("too late !")
      
    def progress80sec():
      info(u'')
      pgrs = Progress(label=u"Hello Progress :)\n It's LFD", max=5000, time=10 ,glob=1 )
      try:
        pgrs.show()
        info("Show")
        sleep(1)
        info("Bar num: %d", pgrs.bars())
        sleep(3)
        print("Bar num: %d", pgrs.bars())
        info("finished.")    
      except:
        info("finished !")    
        pgrs.close()
    
    def progress_automatic_nonblocking():
      info(u'')
      pgrs = Progress(label=u"Hello Progress :)", max=15, time=5 ,glob=1 )
      pgrs.show()
      sleep(1)
      info("Bar num: %d"%pgrs.bars())
      sleep(6)
      pgrs.close()
      
      
    def progress_automatic_blocking():
      info(u'')
      pgrs = Progress(label=u"Hello Progress :)", max=15, time=5 ,glob=0 )
      info(u'block')
      pgrs.show()
      info(u'deblock')
      pgrs.close()
      sleep(2)
    
    def progress_manual_nonblocking():
      info(u'')
      pgrs = Progress(label=u"Hello Progress :)", max=15,glob=1 )
      pgrs.show()
      sleep(1)
      info("Bar num: %d"%pgrs.bars())
      sleep(4)
      pgrs.step()
      sleep(1)
      pgrs.step(3)
      sleep(2)
      pgrs.close()
    
    
    script_lock=e32.Ao_lock()
    appuifw.app.menu=[(u'Wait ', wait),(u'Wait cancel',wait_cancel),(u'LONG progress',progress80sec),(u'Progress auto NB', progress_automatic_nonblocking),(u'Progress auto Blocking',progress_automatic_blocking ),(u'Progress manual NB',progress_manual_nonblocking ),(u'Exit', end_script)]
    appuifw.app.exit_key_handler = end_script 
    script_lock.wait()
    I hope that this can help you with the debugging

    Best regards
    Cyke64
    pys60 1.4.5 and 2.0.0, pygame, PyS60 CE on E90 and 5800 !

    Find my pys60 extension modules on cyke64.googlepages.com

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

    Re: [announce] wait dialog wrapper 0.2

    Thanks a lot cyke64

    That's what we call a good crash test

    I have more work than I thought but I'll keep on debugging

    Thanks again

    LFD
    Devices:
    Nokia E61 3rd Edition - pys60 1.4.0

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

  6. #6
    Registered User
    Join Date
    Nov 2006
    Posts
    568

    Re: [announce] wait dialog wrapper 0.2

    Hi together,

    calling pgrs.show() twice accidently crashes Python on a N70. But nevermind - the module is of great help.

    Is there a chance to see this as a core function in one of the next PyS60 releases?

    Regards

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

    Re: [announce] wait dialog wrapper 0.2

    Hi neil.young,

    Progress is badly bugged I have lots of timing and other issues. I improved Wait, you can now add a callback function that will be called if the user press cancel.

    I'll search for the source and update the distribs today.

    LFD
    Devices:
    Nokia E61 3rd Edition - pys60 1.4.0

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

  8. #8
    Registered User
    Join Date
    Nov 2006
    Posts
    568

    Re: [announce] wait dialog wrapper 0.2

    Will this functionality become an integral part of PyS60 somewhen?

    Regards

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

    Re: [announce] wait dialog wrapper 0.2

    I wish so buddy!

    But I'm not the man to answer this question

    About the version 0.3, I'm still hunting the source. It is somewhere I do am sure but I did not figured out where yet

    LFD
    Devices:
    Nokia E61 3rd Edition - pys60 1.4.0

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

  10. #10
    Regular Contributor
    Join Date
    Apr 2004
    Posts
    107

    Re: [announce] wait dialog wrapper 0.2

    I just tried dialog 0.3 on N95, but the example script shuts down python every time after

    dlg.set_label(u'Wait! Don\'t go :\'(')

    from the trydialog.py

    I also tried the progressbar in my script, but shuts down python after 1/3 of the progress.

    Is there another progressbar module to use?

    Also this simple loop crashes after a few rounds

    Code:
    import e32, appuifw
    from dialog import Wait, Progress
    
    appuifw.app.title= u'Hello dialog'
    
    
    # Progress(label=u'', bars=5, [time=5, global=[True/False]])
    pgrs = Progress(u"Hello Progress :)\n It's LFD", 5000)
    pgrs.show()
    e32.ao_sleep(1)
    for i in range(5000):
    	pgrs.step()
    print "finish"	
    e32.ao_sleep(5)
    pgrs.close()
    Last edited by carknue; 2008-03-13 at 22:23.

  11. #11
    Regular Contributor
    Join Date
    Apr 2004
    Posts
    107

    Re: [announce] wait dialog wrapper 0.2

    So, found that dialog crashes after calling pgrs.step() more than 200 times.

    The following code runs perfect the first time, but it crashes if you run it a second time. Or change bars to 250 ant let the loop run 250 it will crash in the first run. Maybe a memory leak or so. Any chance to get this fixed?

    Code:
    import e32, appuifw
    from dialog import Wait, Progress
    
    appuifw.app.title= u'Hello dialog'
    
    
    # Progress(label=u'', bars=5, [time=5, global=[True/False]])
    pgrs = Progress(u"Hello Progress :)\n It's LFD", 200)
    pgrs.show()
    e32.ao_sleep(0.1)
    for i in range(200):
    	e32.ao_sleep(0.1)
    	pgrs.step()
    print "finish"	
    e32.ao_sleep(5)
    pgrs.close()

Similar Threads

  1. App in Background and Wait Dialog
    By ianratcliffe in forum Symbian
    Replies: 1
    Last Post: 2006-02-22, 03:46
  2. Replies: 4
    Last Post: 2005-11-10, 06:13
  3. Wait Dialog that works ! But ...
    By valentin_da_itiv in forum Symbian
    Replies: 7
    Last Post: 2004-07-01, 17:44
  4. Wait dialog vs. Global note - problems...
    By bjorn.rudolfsson in forum Symbian User Interface
    Replies: 4
    Last Post: 2003-10-30, 10:48
  5. Wait dialog vs. Global note - problems...
    By bjorn.rudolfsson in forum Symbian
    Replies: 0
    Last Post: 2003-06-25, 15:40

Posting Permissions

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