The default for messages generated with
self.iface.messageBar().pushCritical() is to remain on screen for a set duration. I would like them to keep being displayed as long as the user has not closed them by clicking on "x", but I don't know how to do that.
I also tried using
pushCritical(), as it allows you to specify a duration and thus could make the message "permanent" if I specified a very long duration, but I can't get it to work. The instruction
self.iface.messageBar().pushMessage(u'Error : ', u' My error message.', level=QgsMessageBar.CRITICAL, duration=999)
gets me the following error in the console :
NameError: global name 'QgsMessageBar' is not defined.
I don't understand what the problem is, I used
from PyQt4.QtGui import * at the beginning of my script...