Sublime Forum

Listen for when a thread has finished processing

#1

I’m running a command using Popen in a separate thread so as not to slow the user down. I want to keep a status message displayed until the process has finished, so that the user knows it still processing. Then, when it’s done, the status message will change and go away.

I know that sublime.status_message will display a message and then go away after a couple seconds, so that works when the process has finished.

I tried setting the status message using view.set_status. The problem with that is I’m calling another class that extends threading.Thread and it says the attribute “view” doesn’t exist. I even tried extending another class that has a view (sublime_plugin.TextCommand and base class I created)… but no dice.

Is there any way to find out when the process has completed so I can erase the message and replace it with a success or error message?

0 Likes

#2

I think I got it. I don’t know if it’s the best way to do this or not, but I passed the view to the class that extends threading.Thread and it seems to work now. If anyone knows of a better way, please let me know. Thanks!

0 Likes