In my tool I implement version check and auto-update functionality, so for that I need to send some GET requests to my server.
What I want to achieve is to make UI appear instantly, then check for updates in the background, and if it finds updates - present user with info box. Then if user clicks Update - run the updater window, which shows download and unzip progress, ideally without restricting user from using Maya while it happens. But it’s got to be a blocking process, so be it.
And I have a few slight issues with that.
First, what would be the best way to use threading for this matter? Or should I even bother?
So far using threads only brought instability in my scripts. I tried both QThreads and python threads, and they are not very stable, as in - sometimes maya can just crash. Even though I use try\except inside a thread process to ignore all errors, trying to ensure that if it can’t connect to the server it just ignores it. So it just makes my tools unusable for some people, unless they turn off checking for updates in the config file.
Another thing is updating PySide UI while downloading. I’m using chunked download with progress bar. Right now I managed to get it to work with simple synchronous approach with self.repain() and cmds.refresh() called on each status update. Which is fine for download, but it seems hacky to me, and ideally I’d like to avoid blocking maya while download is happening, to account for slow connections.
So, the question is - how should I approach implementing download threads and updating UI in Maya in the background?
Thanks.