[Installit-dev] Download wizard problems

Benedikt Meurer benny at xfce.org
Sat Mar 18 12:40:24 CET 2006

Jannis Pohlmann wrote:
>>>I tried to improve the responsiveness of the download wizard today.
>>>During this, I noticed something very annoying: It is impossible to
>>>cancel downloads. This hasn't been introduced with any version, it's
>>>always been there!
>>>The 'urllib' module allows for hooking into the download process.
>>>However, it's a non-async transfer which makes it hard to avoid a
>>>blocked user interface. 
>>>Do you have any ideas on how this could be solved perhaps? I don't
>>>know much about threaded programming, subprocesses and
>>>glib/gobject/gtk main loops, but perhaps you do.
>>You could simply run the download in a separate thread and "send"
>>updates about the progress via GLib idle sources to the GUI. The
>>cancellation check could be done through a volatile variable (i.e.
>>check the cancel variable every now and then in the download threads,
>>via urllib hooks or whatever... setting it from the main thread when
>>the user hits Cancel). This is the way asynchronous jobs are done in
> At least checking a volatile variable in the progress callback won't be
> a problem. Concerning the threading and GLib idle sources - I don't
> have a clue about how to do it. Below are some links to related
> functions. Perhaps you can find out which ones I need (PyGTK seems to
> be very close to the C API):
> http://pygtk.org/pygtk2reference/gobject-functions.html
> http://pygtk.org/pygtk2reference/class-gobjectmaincontext.html
> http://pygtk.org/pygtk2reference/class-gobjectmainloop.html
> http://pygtk.org/pygtk2reference/gdk-functions.html


> Another thing is: The urllib.urlretrieve() method I am using to
> download the files allows no termination. Destroying the dialog should
> terminate it anyway, I think, but right then we would have this jumping
> boxes again.

Why is it terminated when the dialog is destroyed? Can't you decouple it 
from the dialog's lifecycle?

> Regards,
> Jannis


Xfce  --  small, stable, fast  --  http://www.xfce.org/

    / |    ||
   *  /\---/\
      ~~   ~~
...."Have you mooed today?"...

More information about the Installit-dev mailing list