Jump to content

Connect Action QT window


Philip

Recommended Posts

Hi

I have an action, that creates folders and opens them as an explorer window. This action may not always complete successfully if certain things are not set up correctly.

So I want to be able to notify the user that the action has failed.  There is a 5 sec time out on actions that presents them as failed if there isn't a reply. Unfortunately as the action can at times take longer than 5secs before it can be determined if it ran OK or not, so I had to reply before doing my stuff. `self.session.event_hub.publish_reply(event,data)`

That's all fine, but now I need to provide a further message back to the user to say "actually its not worked and here's why". I thought seeing as it doesn't seem possible to send further replies, (presumably because the webpage stops looking after its received one), I could just show a `PySide.QtGui.QMessageBox` with my message. However it seems I can't as the environment my action is running in, already has a QApplication started, and my action is running in a thread that is not the Main GUi Thread.

Are there any suggestions on how I could either use QT or in some way provide visual feedback to the user about what has happened?

One thought I had which is not Ideal, but could be work able is to Popen a separate Python thread which can launch my window and receive cmd args about msg, but the msg might cover multiple lines making that not so practical.

I did consider using a job but It just didn't feel quite right the action normally takes less than 5 secs.

Thanks

Phil

 

Link to comment
Share on other sites

I've moved this to the Actions section.

Interesting question and that you found that you could reply manually. Another common way is to offload heavy things to a separate async thread - but that only solves a part of your issue.

Perhaps running it as with pOpen is the easiest. As for long strings you could possibly base64 encode/decode it:

import base64
command_argument = base64.b64encode('this is a long string \n with new lines.')

 

Link to comment
Share on other sites

Fantastic, that's a great solution. Works well.

I didn't know you could do that in QT.

Also I'd love to say I found how to reply myself,  but I didn't, that was thanks to Björn suggesting it in a support ticket. :-)

Thanks

 

Link to comment
Share on other sites

  • 2 weeks later...

I'd like to put in a vote for support for 2 things:
 

1) Extend the time out for the action messages to longer than 5 seconds.

Sub-processing is not good enough as it gives a false impression that something worked.  In fact, all we know is that the "launch" worked (not too informative).

A configurable time-out would be nice.

2) Expose a nice mechnism for providing feedback to the user when processes take a long time.

Example:  My action kicks off a long process (e.g., creating a lot of directories), and later after directory creation, I give my artists a custom message saying "Your directories are created!"
Yes, I know I can do this via the jobs queue (but who is going to look there?).  I want something "in your face", but not where the user has to click "OK"
I'll check out the Qt solution, but really this should be supported easily in the actions.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...