[Installit-dev] Download wizard problems

Jannis Pohlmann info at sten-net.de
Sat Mar 18 16:11:15 CET 2006

On Sat, 18 Mar 2006 12:40:24 +0100
Benedikt Meurer <benny at xfce.org> wrote:

> 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 Thunar.
> > 
> > 
> > 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
> http://pygtk.org/pygtk2reference/gobject-functions.html#function-gobject--idle-add
> > 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?

It was a bit more complicated. Anyway, I took the time to implement an
alternative to urlretrieve() which supports aborting the download.
Could you check it out?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
URL: <http://mail.xfce.org/pipermail/installit-dev/attachments/20060318/038ec3f3/attachment.pgp>

More information about the Installit-dev mailing list