Every time i use tool or plugin in QGIS, i saw a kind of bar like this for indicating loading progress :
The different between that bar and Progress Bar is that progress bar will increase until our defined iteration (run progress), but that bar only showing up reversibly. I need to replace it with this code (statusBar) in my main script as alternate of my "please wait.." message :
self.iface.mainWindow().statusBar().showMessage("Please Wait..")
open_set.add(base_coordinate)
....
How to add that bar in my main plugin script (.py)? Is that kind of bar is similar with QProgressBar?
Answer
A good and user friendly way to do it is using the QgsMessageBar class. A first look here by the author of this class:
http://nathanw.net/2013/08/02/death-to-the-message-box-use-the-qgis-messagebar/
and then an example of a progress bar can be obtained directly from the QGIS code (Processing core plugin)
https://github.com/qgis/QGIS/blob/master/python/plugins/processing/gui/MessageBarProgress.py
No comments:
Post a Comment