Active Topics

 


Reply
Thread Tools
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#1
(Edit - sorry thread title should have probably said Hildon GTK....)

Hi everyone, could do with a little developer help please.

In my app i have an update button, when this presses i have about 5-8 seconds of updates that happen.
I have found a method that i like, but can't quite get it to work as i thought it should. Could someone please give me a few pointers?

The indicator box looks good and works well, but the user needs to click to get rid of it. I was hoping that the indicator would load up, let the code run, and then vanish when complete.

Am i doing something wrong?

Code:
        dialog = gtk.Dialog()
        dialog.set_title("Updating... please wait")
        dialog.show_all()
        hildon.hildon_gtk_window_set_progress_indicator(dialog, 1)
        dialog.run()

<<todo code >>

        hildon.hildon_gtk_window_set_progress_indicator(dialog, 0)
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 
Posts: 547 | Thanked: 1,383 times | Joined on Sep 2009 @ Stockholm, Sweden
#2
Is the problem that the dialog doesn't go away automatically? Just call dialog.destroy() at the end
__________________

Problem with fMMS? Run in x-terminal: cp /tmp/fmms.log /home/user/MyDocs/
After that you'll see fmms.log in filemanager or when you connect the device to your desktop as a mass storage device.
E-mail the log to me, if you don't have the email address, drop me a PM. Thanks!

fMMS - MMS for your N900
fAPN - GUI for adding a new GPRS APN
If you like this post, don't be shy to thank me -->
 

The Following User Says Thank You to frals For This Useful Post:
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#3
Originally Posted by frals View Post
Is the problem that the dialog doesn't go away automatically? Just call dialog.destroy() at the end
Perfect, thank you! (Will test it now!)
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#4
hmmmmm - still needs a finger press to clear it :|

The process takes 5-8 seconds to load at startup (the button just runs it again)...

Message loads up fine, but i can leave it for 20 seconds and it stays there, if i touch the window, it goes...
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#5
Is this for your Qt app? Although that function for the progress wheel is Hildon specific, what it does to display that wheel is not. I don't know Qt, so I'm asking: Does PyQt have functions for allowing you to manipulate windows' properties (http://en.wikipedia.org/wiki/X_Windo...d_properties)?

Also, if this dialog has nothing in it except for the wheel and title, why not use http://pymaemo.garage.maemo.org/pyth...ts.html#banner and the progress stuff it provides? It's asynchronous, allows you to set a timeout and you can destroy it at any time. I know it says it's not recommended anymore but it does look prettier than a dialog that has only a title and a wheel, IMHO. (Alternatively,just make the dialog you're already using async. - use dialog.show[all]() instead of dialog.run() and you can then destroy the dialog from another function when you've finished updating)

Last edited by qwerty12; 2010-02-18 at 23:05.
 

The Following User Says Thank You to qwerty12 For This Useful Post:
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#6
Originally Posted by qwerty12 View Post
Is this for your Qt app? Although that function for the progress wheel is Hildon specific, what it does to display that wheel is not. I don't know Qt, so I'm asking: Does PyQt have functions for allowing you to manipulate windows' properties (http://en.wikipedia.org/wiki/X_Windo...d_properties)?

Also, if this dialog has nothing in it except for the wheel and title, why not use http://pymaemo.garage.maemo.org/pyth...ts.html#banner and the progress stuff it provides? It's asynchronous, allows you to set a timeout and you can destroy it at any time. I know it says it's not recommended anymore but it does look prettier than a dialog that has only a title and a wheel, IMHO. (Alternatively,just make the dialog you're already using async. - use dialog.show[all]() instead of dialog.run() and you can then destroy the dialog from another function when you've finished updating)

erm i cheated - as i didnt like the QT solution

I created a GTK Dialog, and pinched the GTK_Hildon message box to do it, to my shocker the box works, just not the dissapearing bit :P (all on top of the QT solution.... meh, it works!)

Tried the banner all morning, it never worked for me :P - but yes that would also work


In the last bit you said one or the other, in my example code - i have both, ie.
Code:
dialog.show_all()
        hildon.hildon_gtk_window_set_progress_indicator(dialog, 1)
        dialog.run()
Should i just be using show_all OR .run, and not both?
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#7
Originally Posted by noobmonkey View Post
erm i cheated - as i didnt like the QT solution

I created a GTK Dialog, and pinched the GTK_Hildon message box to do it, to my shocker the box works, just not the dissapearing bit :P (all on top of the QT solution.... meh, it works!)

Tried the banner all morning, it never worked for me :P - but yes that would also work


In the last bit you said one or the other, in my example code - i have both, ie.
Code:
dialog.show_all()
        hildon.hildon_gtk_window_set_progress_indicator(dialog, 1)
        dialog.run()
Should i just be using show_all OR .run, and not both?
Comment out dialog.run() (and dialog.destroy() if you have it) and see if it works with show_all. I have a feeling it won't, however - it requires the GTK main loop to be running (dunno if Qt plays nice with it, though; so it may work). If it does work, you can call dialog.destroy() from another function

That said, creating a GTK dialog does seem a little convoluted
Why not just do what SiB does and create a progress bar in a Qt dialog?
 

The Following User Says Thank You to qwerty12 For This Useful Post:
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#8
Originally Posted by qwerty12 View Post
Comment out dialog.run() (and dialog.destroy() if you have it) and see if it works with show_all. I have a feeling it won't, however - it requires the GTK main loop to be running (dunno if Qt plays nice with it, though; so it may work). That said, creating a GTK dialog does seem a little convoluted
Why not just do what SiB does and create a progress bar in a Qt dialog?
because i didn't know how to - and i liked the look of the GTK one

Sib?

Anyway didnt work - pity, cos it does look nice
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 
Posts: 324 | Thanked: 371 times | Joined on Dec 2009 @ Vancouver, BC
#9
If I remember correctly, dialog.run() will wait until the Dialog closes (by you clicking somewhere) before continuing on with the "todo" stuff.

One thing that might work would be to create a gobject.idle_add(self.toDoFunction) where self.toDoFunction is a separate function containing your "todo" code, at the end of which you destroy the dialog.
 

The Following 2 Users Say Thank You to Slocan For This Useful Post:
Reply

Tags
code, hildon, indicator, progress, python


 
Forum Jump


All times are GMT. The time now is 06:57.