Active Topics

 


Reply
Thread Tools
Posts: 58 | Thanked: 10 times | Joined on Dec 2009
#1
Hi,

I have some os.system commands in my app that take some time executing.

I'd like to display a progress bar over my main windows while the commands are running.
It would also be nice if i could write text to it according to execution state, like "adjusting image", "running recognition", "deleting tmp files"

How can I do this in Qt and python?
 
Posts: 726 | Thanked: 345 times | Joined on Apr 2010 @ Sweden
#2
Did you even try to do a Google search? One search later I found this:

http://zetcode.com/tutorials/pyqt4/widgets/

Jump down to the part about ProgressBar.
 
Posts: 58 | Thanked: 10 times | Joined on Dec 2009
#3
Originally Posted by Joorin View Post
Did you even try to do a Google search? One search later I found this:

http://zetcode.com/tutorials/pyqt4/widgets/

Jump down to the part about ProgressBar.
Of course I tried googleing.
The problem is I don't have timed events.
I can't know how long does it take for commands to execute.

I need a progress bar that will load "indefinitely" (from left to right, and back) until the commands are over and I have to close the progress bar manually.
 
Posts: 726 | Thanked: 345 times | Joined on Apr 2010 @ Sweden
#4
A little more Google and I find the following:

If you set minimum, maximum and value all to zero, then you will get the animation. Then call setProgress().

After this you can just change the text after the different tasks end.

And this is the documentation that describes the behaviour:

http://doc.qt.nokia.com/4.6/qprogressbar.html

Last edited by Joorin; 2010-05-04 at 15:02. Reason: Added link
 

The Following User Says Thank You to Joorin For This Useful Post:
Posts: 58 | Thanked: 10 times | Joined on Dec 2009
#5
Thanks for your help!

Do you have any idea how can I start the progress bar in center of screen, and lock focus on it.
So the user can't click anything while the progress bar is loading
 
pelago's Avatar
Posts: 2,121 | Thanked: 1,540 times | Joined on Mar 2008 @ Oxford, UK
#6
Originally Posted by zolakt View Post
Thanks for your help!

Do you have any idea how can I start the progress bar in center of screen, and lock focus on it.
So the user can't click anything while the progress bar is loading
I think the Maemo 5 way of doing things is put the progress bar widget in a dialogue box (see updating in Application Manager, moving files in File Manager, etc.)
 
Posts: 3,617 | Thanked: 2,412 times | Joined on Nov 2009 @ Cambridge, UK
#7
Originally Posted by pelago View Post
I think the Maemo 5 way of doing things is put the progress bar widget in a dialogue box (see updating in Application Manager, moving files in File Manager, etc.)
Yes, just use the standard QProgressDialog.
 

The Following User Says Thank You to Rob1n For This Useful Post:
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#8
took me ages to get something that works for me -

Code:
                progress = QtGui.QProgressDialog("Please Wait", "Cancel", 0, 100, MainWindow)
		progress.setWindowModality(QtCore.Qt.WindowModal)
		progress.setAutoReset(True)
		progress.setAutoClose(True)
		progress.setMinimum(0)
		progress.setMaximum(100)
		progress.resize(800,220)
		progress.setWindowTitle("Loading Something")
		progress.show()
                progress.setValue(0)
                <<do something>>
               progress.setValue(20)
               <<do something>>
              etc.....
              progress.setValue(100)
              progress.hide()
__________________
----------- 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? -
 

The Following 3 Users Say Thank You to noobmonkey For This Useful Post:
Posts: 58 | Thanked: 10 times | Joined on Dec 2009
#9
I tried your code, but it doesn't work for me.

I have a specific situation.
There are two windows, application and the camera app
When camera app is closed, the image goes trough processing.
That is where I need the progress dialog, because it takes some time.

The ting is that the process starts right after the camera app is closed. So I get back to the "multitask view" not the actual application. Maybe that is the problem?
 
Posts: 58 | Thanked: 10 times | Joined on Dec 2009
#10
Got it working!
Tnx!
 
Reply


 
Forum Jump


All times are GMT. The time now is 23:55.