Support new feed system in injector 0.17.
[zeroinstall.git] / checking.py
blob173d01cc6af290e9ee478a6fc7c01b1de9b822dd
1 import gtk, gobject
3 from dialog import Dialog
5 class CheckingBox(Dialog):
6 show_details = False
7 hint_timeout = None
9 def __init__(self, root):
10 Dialog.__init__(self)
11 self.prog_name = root.get_name()
12 self.set_title("Checking for updates")
13 self.label = gtk.Label("Checking for updates to '%s'..." % self.prog_name)
14 self.label.set_padding(10, 10)
15 self.vbox.pack_start(self.label, True, True, 0)
16 self.vbox.show_all()
18 self.progress = gtk.ProgressBar()
19 self.vbox.pack_start(self.progress, False, True, 0)
20 self.progress.show()
22 self.add_mixed_button('Details...', gtk.STOCK_ZOOM_IN, gtk.RESPONSE_OK)
23 def response(w, r):
24 if r == gtk.RESPONSE_OK:
25 self.show_details = True
26 self.destroy()
27 self.connect('response', response)
29 def show_hint():
30 hint = gtk.Label("(if you want to skip this, click on\n"
31 "Details, and then on Execute)")
32 hint.set_justify(gtk.JUSTIFY_CENTER)
33 self.vbox.pack_start(hint, False, True, 0)
34 self.vbox.show_all()
35 self.hint_timeout = None
36 return False
37 self.hint_timeout = self.hint_timeout = gobject.timeout_add(8000, show_hint)
38 def destroy(box):
39 if self.hint_timeout is not None:
40 gobject.source_remove(self.hint_timeout)
41 self.hint_timeout = None
42 self.connect('destroy', destroy)
44 def updates_done(self, changes):
45 """Close the dialog after a short delay"""
46 if changes:
47 self.label.set_text("Updates found for '%s'" % self.prog_name)
48 else:
49 self.label.set_text("No updates for '%s'" % self.prog_name)
50 self.progress.set_fraction(1)
51 self.set_response_sensitive(gtk.RESPONSE_OK, False)
52 gobject.timeout_add(1000, self.destroy)