Re: Kupfer plugin design



2010/10/27 William Friesen <wfriesen gmail com>
>
> The file kupfer/task.py contains the class ThreadTask, which can be used to run an Action in a different thread. Basically, The Action will have
> def is_async:
>   return True
> and then Action.activate will return an object that inherits from ThreadTask, and you implement the functionality in that object.
> The file kupfer/plugin/urlactions.py (amongst others) shows an example of this.
> 2010/10/26 Michał Klich <michal michalklich com>
>>
>> Hi,
>>
>> I am writing Remember The Milk (rtm) plugin for kupfer. Problem i stumbled upon is related to network.
>> Every Action that has to connect to rtm API is blocking kupfer ui.
>> How would i process Action in background so user can use kupfer? I have tried multiprocessing but it would still block ui, obviously path i am taking is wrong.
>> Any guidance would help.
>>
>> Thanks

Prefer everything except multiprocessing (can't be used in Kupfer due
to a lot of reasons) to threads. That said, threads have uses but
their use should be minimized. I would be happier to see less threads
in Kupfer. If possible for example, kupfer.util.AsyncCommand is
preferable. If you have a callback from an external async function,
then the "new" stuff using kupfer.commandexec with async tokens etc
are optimal. (See fileactions plugin
http://git.gnome.org/browse/kupfer/tree/kupfer/plugin/fileactions.py#n195
)

Ulrik


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]