When a function is called - a file is tested for existence. This checksum pushes a messageBar() object for both circumstances (True/False), yet the actual bar does not display in MapCanvas until after the subsequent exec_() is called and finished running.
def callUtherPendragonsSon(self): holyGrailFile = 'C:\ALongWayFrom\camelot.csv' if os.path.exists(holyGrailFile): self.iface.messageBar().pushMessage("Notice", "You will need many coconuts...",\ level=QgsMessageBar.INFO, duration=3) beginTheJourney = gatherProvisionsAndMen() beginTheJourney.exec_() else: self.iface.messageBar().pushMessage("Warning", "There is no grail :( ",\ level=QgsMessageBar.CRITICAL, duration=3) return
Is there a means to assure the message bar is pushed prior to calling the exec_() ?
As it turns out, a command in the external Ui gatherProvisionsAndMen()'s init is causing the trouble. It is a data-thirsty function call, and seems to supersede the messagebar (even though it is executed thereafter). The messageBar itself is intended to preliminarily notify the user of this nested 'lengthy process' - but it seems such a notice needs to take place in another manner...
Perhaps I hold a misunderstanding in the logistics of programming but,
wouldn't the call to push a QgsMessageBar() need to complete before moving forward and executing the external Ui?