3 from dialog
import Dialog
4 from zeroinstall
.support
import tasks
6 class CheckingBox(Dialog
):
9 def __init__(self
, root
):
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)
18 self
.progress
= gtk
.ProgressBar()
19 self
.vbox
.pack_start(self
.progress
, False, True, 0)
22 self
.show_details_clicked
= tasks
.Blocker("click Show Details")
23 self
.cancelled
= tasks
.Blocker("cancel checking box")
25 self
.add_mixed_button('Details...', gtk
.STOCK_ZOOM_IN
, gtk
.RESPONSE_OK
)
27 if r
== gtk
.RESPONSE_OK
:
28 self
.show_details_clicked
.trigger()
30 self
.cancelled
.trigger()
31 self
.connect('response', response
)
34 hint
= gtk
.Label("(if you want to skip this, click on\n"
35 "Details, and then on Run)")
36 hint
.set_justify(gtk
.JUSTIFY_CENTER
)
37 self
.vbox
.pack_start(hint
, False, True, 0)
39 self
.hint_timeout
= None
41 self
.hint_timeout
= self
.hint_timeout
= gobject
.timeout_add(8000, show_hint
)
43 if self
.hint_timeout
is not None:
44 gobject
.source_remove(self
.hint_timeout
)
45 self
.hint_timeout
= None
46 self
.connect('destroy', destroy
)
48 def updates_done(self
, changes
):
49 """Close the dialog after a short delay"""
51 self
.label
.set_text("Updates found for '%s'" % self
.prog_name
)
53 self
.label
.set_text("No updates for '%s'" % self
.prog_name
)
54 self
.progress
.set_fraction(1)
55 self
.set_response_sensitive(gtk
.RESPONSE_OK
, False)