3 from zeroinstall
.injector
import handler
8 class GUIHandler(handler
.Handler
):
9 dl_callbacks
= None # Download -> [ callback ]
13 def _reset_counters(self
):
14 if not self
.monitored_downloads
:
15 self
.n_completed_downloads
= 0
16 self
.total_bytes_downloaded
= 0
19 def abort_all_downloads(self
):
20 for dl
in self
.monitored_downloads
.values():
23 def downloads_changed(self
):
24 if self
.monitored_downloads
and self
.pulse
is None:
26 self
.mainwindow
.update_download_status()
29 self
.pulse
= gobject
.timeout_add(50, pulse
)
30 elif len(self
.monitored_downloads
) == 0:
31 # Delay before resetting, in case we start a new download quickly
32 gobject
.timeout_add(500, self
._reset
_counters
)
36 gobject
.source_remove(self
.pulse
)
38 self
.mainwindow
.update_download_status()
40 def confirm_trust_keys(self
, interface
, sigs
, iface_xml
):
42 return trust_box
.confirm_trust(interface
, sigs
, iface_xml
, parent
= self
.mainwindow
.window
)
44 def report_error(self
, ex
):
45 dialog
.alert(None, str(ex
))