You Are Here:

Community: Developer Discussion Boards

#1 Old Lightbulb [announce] wait dialog wrapper - 2007-02-06, 10:07

Join Date: May 2006
Posts: 622
Location: Oulu, Finland
lfd
Offline
Super Contributor
Hi folks,

I created a module that contains a wrapper for the native wait dialog. Usage:

Code:
import e32
from dialog import wait

dlg = wait(u"Hello Wait note :)")
e32.ao_sleep(3)
dlg.close()
I'm working now on the progress dialog, so it will be added as soon as I manage to finish it

As usual, you can find the files on my share http://students.oamk.fi/~dlefevre/thesis/index.php/dlm

Any bugs reports are welcome and suggestions to make it better.

B.R

LFD


Devices:
Nokia E61 3rd Edition - pys60 1.4.0

Tips and modules:
http://www.lfdm.net/thesis
Reply With Quote

#2 Old Talking Re: [announce] wait dialog wrapper - 2007-02-06, 15:13

Join Date: Feb 2005
Posts: 1,353
Location: Belgium (Europe)
cyke64's Avatar
cyke64
Offline
Super Contributor
Quote:
Originally Posted by lfd
Hi folks,
As usual, you can find the files on my share http://students.oamk.fi/~dlefevre/thesis/index.php/dlm

Any bugs reports are welcome and suggestions to make it better.

B.R

LFD
When I saw the source file I noticed that you have forgot one file dialog.py !!! Fortunately I found it in the sisx file
Why this dialog has 30-character limitation ?
I don't find 'close' method in the wait class Could you explain where is this function ???
I think that PyS60 use Upper case for the first letter of all classes like Text , Canvas etc. so wait could be Wait ...

Keep up the great job (I'm waiting for the progress dialog

If you want to see a dialog example look at here !

Cyke64


pys60 1.4.5,1.9.7,pygame,PyS60 CE on E90 , N810 with Python 2.5.2 and ... last PyS60 1.9.7 with touch ui on 5800 !

pys60 extension modules on http://cyke64.googlepages.com/
Last edited by cyke64 : 2007-02-06 at 15:31.
Reply With Quote

#3 Old Re: [announce] wait dialog wrapper - 2007-02-06, 15:53

Join Date: May 2006
Posts: 622
Location: Oulu, Finland
lfd
Offline
Super Contributor
Hi cycke64

Nice feedback!

Quote:
When I saw the source file I noticed that you have forgot one file dialog.py !!! Fortunately I found it in the sisx file
I put that on my notes a warn you guys when I modify the source zip. So far please use dialog.py from the emulators files.

Quote:
Why this dialog has 30-character limitation ?
I've been advice to use a TBuf<30> for the dialog. There might be some limitations, I have to check the SDK doc again. I'll try with a TBuff<40> and/or more to check the behavior a bit later.

Quote:
I don't find 'close' method in the wait class Could you explain where is this function ???
I didn't manage to invoke the class destructor from C++ side because I wanted to have the following syntax waitDialog.close(). The temporary solution was to use a small class in dialog.py
Code:
import e32

if e32.s60_version_info>=(3,0):
    import imp
    _dialog = imp.load_dynamic('_dialog', 'c:\\sys\\bin\\_dialog.pyd')
    del imp
else:
    import _dialog

del e32

class wait( object ):
    def __init__( self, aString):
        # accepts only 30 characters or user panic
        if len(aString) > 30:
            self._iDlgRef = _dialog.wait( aString[:27]+"...")
        else:
            self._iDlgRef = _dialog.wait( aString )

    # the object is closed then deleted 
    def close( self ):
        del self._iDlgRef
        del self
So you won't find the close() method if you don't have dialog.py. If I find a wait to do that from C++ I'll make the change of course.


Quote:
I think that PyS60 use Upper case for the first letter of all classes like Text , Canvas etc. so wait could be Wait ...
It's true, I completely agree. Will be changed in the next release too

Quote:
If you want to see a dialog example look at here !
That I forgot too... Thanks for reading the journal

Well done and thanks! I'll make a post for the next release

LFD


Devices:
Nokia E61 3rd Edition - pys60 1.4.0

Tips and modules:
http://www.lfdm.net/thesis
Reply With Quote

#4 Old Re: [announce] wait dialog wrapper - 2007-02-06, 17:07

Join Date: Feb 2005
Posts: 1,353
Location: Belgium (Europe)
cyke64's Avatar
cyke64
Offline
Super Contributor
hello again

Thanks for your reply

I think about other upgrades for your nice module

- You mix class and function in the same Wait I think it's better to use class instance and AFTER with another method show() displaying widget like in TopWindow class or the execute from Form class !



So the code becomes like this :
Code:
import e32
from dialog import Wait

dlg = Wait(u"Hello Wait note :)") # create object and init
dlg.show() # display wait widget on screen
e32.ao_sleep(3)
dlg.close() # hide wait widget


pys60 1.4.5,1.9.7,pygame,PyS60 CE on E90 , N810 with Python 2.5.2 and ... last PyS60 1.9.7 with touch ui on 5800 !

pys60 extension modules on http://cyke64.googlepages.com/
Reply With Quote

#5 Old Re: [announce] wait dialog wrapper - 2007-02-07, 10:00

Join Date: May 2006
Posts: 622
Location: Oulu, Finland
lfd
Offline
Super Contributor
Hi cycke64

Quote:
- You mix class and function in the same Wait I think it's better to use class instance and AFTER with another method show() displaying widget like in TopWindow class or the execute from Form class !
I've actually been questioning myself about that. Shall the class have a top window or a note behavior??? And what could be the advantage for the user to have it with a top window behavior since they would need to call one more method to see the dialog. Using a close() method would close the dialog with ProcessFinishedL but the object would still remain in the memory whereas with the actual close method, it cleans the memory when closing it.

Also I could understand the advantage of using the top window behavior that could allow the user to define at the beginning of their application all dialogs they want to use and then bring them when they want with show() and close() ...

I just arbitrary decided for now to have it with the note behavior and that's why if you read the source you see one class with only a constructor and a destructor

Making the modification would take few minutes to have a top window style.

So what shall we do? A vote? The point of view from PyS60 team would help quite much too!

Waiting for some more feedback from you

LFD


Devices:
Nokia E61 3rd Edition - pys60 1.4.0

Tips and modules:
http://www.lfdm.net/thesis
Reply With Quote

#6 Old Question wait dialog wrapper - problem - 2007-02-15, 08:10

Join Date: Nov 2006
Posts: 21
Location: Helsinki
leban
Offline
Registered User
I have a problem with wait dialog.

I tried it out in file upload/download like this:
Code:
try:
    dlg = dialog.wait(u"viestit haetaan...")
    lists = self.get_messages(params)
    dlg.close()
...
But in the case of prosess failing the dialog is stuck on screen and the only way close is to force the application to shut.

Is there some way to prevent this?

I would really like to use the progressbar when it comes out...
Reply With Quote

#7 Old Re: [announce] wait dialog wrapper - 2007-02-15, 11:00

Join Date: May 2004
Posts: 524
Location: Tampere, Finland
jethro.fn's Avatar
jethro.fn
Offline
Forum Nokia Champion
How about this?

Code:
dlg = dialog.wait(u"viestit haetaan...")
try:
    # get_messages() may fail and raise an exception.
    lists = self.get_messages(params)
finally:
    dlg.close()
Reply With Quote

#8 Old Re: [announce] wait dialog wrapper - 2007-02-15, 11:01

Join Date: May 2006
Posts: 622
Location: Oulu, Finland
lfd
Offline
Super Contributor
Hi leban,

Try this:
Code:
dlg = dialog.wait(u"viestit haetaan...")
try:
    lists = self.get_messages(params) # here you have an error
except:
    pass

dlg.close()
...
I know it is a problem for now that you can't dismiss the dialog. I'm working on the possibility to add a callback parameter if the user wants to for example cancel the operation.

LFD


Devices:
Nokia E61 3rd Edition - pys60 1.4.0

Tips and modules:
http://www.lfdm.net/thesis
Reply With Quote

#9 Old Re: [announce] wait dialog wrapper - 2007-02-15, 12:05

Join Date: Nov 2006
Posts: 21
Location: Helsinki
leban
Offline
Registered User
It worked. Kiitos.
Reply With Quote

#10 Old Re: [announce] wait dialog wrapper - 2007-02-15, 13:31

Join Date: May 2006
Posts: 622
Location: Oulu, Finland
lfd
Offline
Super Contributor
Ole hyvä

LFD


Devices:
Nokia E61 3rd Edition - pys60 1.4.0

Tips and modules:
http://www.lfdm.net/thesis
Reply With Quote

#11 Old Re: [announce] wait dialog wrapper - 2007-02-15, 14:05

Join Date: Feb 2005
Posts: 1,353
Location: Belgium (Europe)
cyke64's Avatar
cyke64
Offline
Super Contributor
Quote:
Originally Posted by lfd
Ole hyvä

LFD
Hey lfd
I think this is un forum en langue anglaise ?


pys60 1.4.5,1.9.7,pygame,PyS60 CE on E90 , N810 with Python 2.5.2 and ... last PyS60 1.9.7 with touch ui on 5800 !

pys60 extension modules on http://cyke64.googlepages.com/
Reply With Quote

#12 Old Re: [announce] wait dialog wrapper - 2007-02-15, 15:47

Join Date: Nov 2006
Posts: 21
Location: Helsinki
leban
Offline
Registered User
I have another problem with wait dialog. This time with close()

I made a dummymodule for installations without dialog-module.

Code:
class dummydialog:
    def __init(self):
        pass

    def wait(self, note):
        appuifw.app.title = note
        pass
        
    def close(self):
        pass

try:
    import dialog
except:
    dialog = dummydialog()
But python says 'NoneType' object has no attribute 'close'

Some help?

PS. Universal default language = bad english :-)
Reply With Quote

#13 Old Re: [announce] wait dialog wrapper - 2007-02-15, 19:29

Join Date: May 2004
Posts: 524
Location: Tampere, Finland
jethro.fn's Avatar
jethro.fn
Offline
Forum Nokia Champion
Quote:
Originally Posted by leban
But python says 'NoneType' object has no attribute 'close'
The original dialog returns a wait object with dialog.wait(...). You implicitly return "None". This "None" is then later used in the program to call a close() method, giving you the error. Change your dummy class like this:

Code:
class dummydialog:
    def __init(self):
        pass

    def wait(self, note):
        appuifw.app.title = note
        return self   # This line changed.
        
    def close(self):
        pass
This should work (not tested).
Reply With Quote

#14 Old Re: [announce] wait dialog wrapper - 2007-02-15, 21:09

Join Date: May 2006
Posts: 622
Location: Oulu, Finland
lfd
Offline
Super Contributor
I would use 2 classes for that because you could do
Code:
from dialog import wait
Here is a suggestion:
Code:
class wait:
    def __init__(self, aNote):
        # here you put the note you want
        appuifw.app.title = note(aNote, 'info', 1)

    def close(self):
        # do what you want for closing, probably nothing
        pass


class dummydialog:
    def __init__(self):
        pass

    def wait(self, aNote):
        return wait(aNote)   # This line changed.
Assuming the the 2 classes are in the same file or previously imported, it would work with:

Code:
try:
    import dialog
except:
    dialog = dummydialog()

waitDlg = dialog.wait(u'Hello dummy dialog :)')
waitDlg.close()
or

Code:
try:
    from dialog import wait
except:
    pass

waitDlg = wait(u'Hello dummy dialog :)')
waitDlg.close()
LFD


Devices:
Nokia E61 3rd Edition - pys60 1.4.0

Tips and modules:
http://www.lfdm.net/thesis
Reply With Quote

#15 Old Re: [announce] wait dialog wrapper - 2007-02-16, 10:09

Join Date: Nov 2006
Posts: 21
Location: Helsinki
leban
Offline
Registered User
I fixed it using the suggestion that required the least changes to my code.

Thanks again.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
App in Background and Wait Dialog ianratcliffe General Symbian C++ 1 2006-02-22 04:46
How can i dynamic switch text of global wait not or wait dialog Chris.Li_Nokia General Symbian C++ 4 2005-11-10 07:13
Wait Dialog that works ! But ... valentin_da_itiv General Symbian C++ 7 2004-07-01 18:44
Wait dialog vs. Global note - problems... bjorn.rudolfsson Symbian User Interface 4 2003-10-30 11:48
Wait dialog vs. Global note - problems... bjorn.rudolfsson General Symbian C++ 0 2003-06-25 16:40

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d81449X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZpythonQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZuserE5ftagQSxpythonX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ