Tk-multi-launchapp before_app_launch hook and QMessageBox has no effect

Calling QMessageBox.critical within a before_app_launch hook for tk-multi-launchapp doesn’t have any apparent effect. The code is called, no errors occur, but no dialog appears.

2 Likes

Are you calling it in a blocking way, I think using .exec_()?

I’m not, but I thought its possible Qt hadn’t initialized at that point, since it would be super early in the startup of the DCC being launched?

In the before_app_launch.py is called before the DCC is started, so it is running in the engine that the launch app was run from. If this is SG Desktop then the QApplication should already exist.

1 Like

Curious! I was just calling QMessageBox.critical(…)

Possibly it popped under?

1 Like

I ran into this issue as well @Rhea_Fischer. What I ended up doing was using engine.show_modal rather than manually constructing my dialogs and using the show or exec_ methods. It could have to do with the way show_modal sets the parent for the wrapper dialog that it constructs, but I didn’t have time to investigate.

1 Like

Thanks @Dan_Bradham I’ll call your suggestion the solution, though I decide to solve this a different way in my code :grinning:

Well now I want to know what you did! Lol

1 Like

Oh it was nothing special! Instead of warning the user they shouldn’t have env var set I just delete it from their env. Smashie smashie approach.

I do have a much more curious mystery for which a post is forthcoming. Its about how a second modal dialog, launched from a first, closes both when its closed. This happens only when the first was launched from a tk-shotgun engine command. Can’t be reproduced in a pytest setup, even using tk-shotgun as the engine.