[Installit-dev] Download wizard problems

Jannis Pohlmann info at sten-net.de
Sat Mar 18 12:10:22 CET 2006


Hey,

On Fri, 17 Mar 2006 22:57:13 +0100
Benedikt Meurer <benedikt.meurer at unix-ag.uni-siegen.de> wrote:

> Jannis Pohlmann wrote:
> > Hey Benny,
> > 
> > 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

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.

Regards,
Jannis
-------------- 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/33e3d4ed/attachment.pgp>


More information about the Installit-dev mailing list