Home Download Buy Blog Forum Support

Listen for when a thread has finished processing

Listen for when a thread has finished processing

Postby jtwebb on Wed Jul 24, 2013 3:06 am

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?
jtwebb
 
Posts: 14
Joined: Sat Jul 20, 2013 5:19 am

Re: Listen for when a thread has finished processing

Postby jtwebb on Wed Jul 24, 2013 3:17 am

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!
jtwebb
 
Posts: 14
Joined: Sat Jul 20, 2013 5:19 am


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 4 guests

cron