I’m trying to add a simple message box
that will warn the user they have clicked an app to be launched in the launcher
and that it dismisses as soon as all the bootstrap is completed and the app_launch
is finally executed.
I’ve tried adding this to before_app_launch
hook at the beginning of the execute
method:
# create and show the QMessageBox
msg_box = QtGui.QMessageBox()
msg_box.setText(f"Launching app \n{software_entity['code']}\n Please be patient.")
msg_box.setStandardButtons(QtGui.QMessageBox.NoButton)
msg_box.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
msg_box.show()
# allow the main application event loop to continue running
# while the QMessageBox is displayed
QtGui.QApplication.processEvents()
This will show the message box but it dismisses it as soon as it is created.
Adding a nasty sleep(2)
delays the hole execution but at least shows the message box for 2 seconds.
The thing is that the first time you select a project and launch an app, the message box will never show, from the second time on launching any app, it will.
What am I doing wrong?