1 from gpg
import BadSignature
2 from policy
import Policy
10 class GUIPolicy(Policy
):
15 def __init__(self
, interface
, prog
, prog_args
):
16 Policy
.__init
__(self
, interface
)
22 self
.window
= mainwindow
.MainWindow(prog
, prog_args
)
23 self
.window
.browser
.set_root(policy
.get_interface(policy
.root
))
25 def monitor_download(self
, dl
):
26 error_stream
= dl
.start()
27 def error_ready(src
, cond
):
29 got
= os
.read(src
.fileno(), 100)
33 if self
.n_downloads
== 0:
34 self
.window
.progress
.hide()
35 gtk
.timeout_remove(self
.pulse
)
37 data
= dl
.error_stream_closed()
39 self
.check_signed_data(dl
, data
)
40 except BadSignature
, ex
:
41 print >>sys
.stderr
, ex
43 print "Errors: '%s'" % got
44 print "(from %s)" % dl
.url
47 gtk
.input_add(error_stream
, gtk
.gdk
.INPUT_READ
, error_ready
)
50 if self
.pulse
is None:
51 progress
= self
.window
.progress
52 self
.pulse
= gtk
.timeout_add(50, lambda: progress
.pulse() or True)