From fc6addc0cd0b79a60573c3edc3af39f38534b9c5 Mon Sep 17 00:00:00 2001 From: Sayamindu Dasgupta Date: Tue, 12 May 2009 12:34:21 +0000 Subject: Sharing: Add progressbar and cancel button. Add a progressbar to indicate amount downloaded and a cancel button to cancel the download. --- (limited to 'ProgressDialog.py') diff --git a/ProgressDialog.py b/ProgressDialog.py new file mode 100644 index 0000000..bf92502 --- /dev/null +++ b/ProgressDialog.py @@ -0,0 +1,26 @@ +import gtk +from gettext import gettext as _ + +class ProgressDialog(gtk.Dialog): + def __init__(self, parent): + gtk.Dialog.__init__(self, _('Downloading...'), parent, \ + gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, \ + (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)) + + self._activity = parent + + self.connect('response', self._response_cb) + + self._pb = gtk.ProgressBar() + self._pb.set_text(_('Retrieving shared image, please wait...')) + self.vbox.add(self._pb) + + def _response_cb(self, dialog, response_id): + if response_id == gtk.RESPONSE_REJECT: + self._activity.close() + else: + pass + + def set_fraction(self, fraction): + self._pb.set_fraction(fraction) + -- cgit v0.9.1