Proper threading of UI?
#1
Question 
I've done a few applications in Android and know from there the importance of threading long task's (such as loading a web page) not to lock up the UI. Quite a few XBMC plugins/scripts have the progressive bar dialog with the option to cancel. Often pressing cancel just results in a long wait for the task to be canceled. So is this due to the XBMC UI implementation or just poor threading in scripts or?
So I'm asking you skilled python coders, what is the best practice and you got any examples/snippets of good implementations?
Pneumatic | SABnzbd | XBMC that just works - openelec
Reply
#2
It depends who handles the progress bar.

eg dir fetching cancellation by XBMC of plugins should be pretty quick as XBMC handles it.

However, if the progress bar is shown by the plugin then it may be them not checking it for cancellation at a suitable time period.

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#3
AFAIK, with plugins, you can't listen for the cancel button, you have to check it periodically. So that kind of defeats the point of launch the blocking code in separate threads from the UI so that the event handler can cancel those threads. In my NZB downloader, I update and check for cancellation at every step in initialization and after every article is decoded (they're about 500k each with a bunch of threads going on different articles, so it's fairly snappy).
Reply
#4
Aha! Great answers, thank you guys!
Pneumatic | SABnzbd | XBMC that just works - openelec
Reply

Logout Mark Read Team Forum Stats Members Help
Proper threading of UI?0