Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am really amazed what huge steps the QGIS development has taken in the last months. The new iconset, the improved Print composer and many more changes to be seen in QGIS 2.0 are really awesome!

Among many other cool improvements there is also this nifty blue task-bar, which I find very appealing. Text says: Save completed: Export to vector file finished

Is it possible to address this bar in python for scripts and plugins (for instance to show a small message after finished computations)? I am asking this question here, because i believe that many QGIS developers also visit this Q&A site.

PS: The bar is only visible in QGIS dev and only for some operations.

share|improve this question
add comment

1 Answer

up vote 9 down vote accepted

It sure is:

iface.messageBar().pushMessage("Header","MessageBody", QgsMessageBar.WARNING, 2)

the last arg is a timeout in seconds, if it's not supplied then it will stay until the user closes it.

You can even add you own control to the messagebar:

widget = iface.messageBar().createMessage("Test","Testing")
combo = QComboBox()
widget.layout().addWidget(combo)
iface.messageBar().pushWidget(widget, QgsMessageBar.WARNING)
combo.addItems("ASD")

enter image description here

http://www.qgis.org/api/classQgsMessageBar.html#a0b305c7215d75243b4237c299f0f7723

share|improve this answer
    
Yeah, works like a charm. Thanks :) –  Curlew Apr 3 '13 at 20:10
    
@Nathan i'm using QProgressBar instead of QComboBox. i'm unable to align the progressbar label in the right side, currently its showing in middle of the progressbar with % symbol. –  venkat May 8 '13 at 4:30
    
@venkat that is the style of the progress bar. Have a look at Qt stylesheets on how to change that, or there might be a label property. –  Nathan W May 8 '13 at 7:56
    
@Nathan i already raised the question regarding this but i didnt get any answer so far. kindly check this link.there i explained with screenshot and source code. stackoverflow.com/questions/16434215/… –  venkat May 9 '13 at 4:05
    
@venkat answered over there for you –  Nathan W May 9 '13 at 7:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.