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.
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.
Answer
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")
http://www.qgis.org/api/classQgsMessageBar.html#a0b305c7215d75243b4237c299f0f7723
No comments:
Post a Comment