Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/ProgressDialog.py
diff options
context:
space:
mode:
authorSayamindu Dasgupta <sayamindu@gmail.com>2009-05-12 12:34:21 (GMT)
committer Sayamindu Dasgupta <sayamindu@gmail.com>2009-05-12 12:34:21 (GMT)
commitfc6addc0cd0b79a60573c3edc3af39f38534b9c5 (patch)
tree0ae70df5f42f98d3f26f0fdcfcc100b7f998775b /ProgressDialog.py
parent216de35e964e9e5ff268fc05959bc4afe1f976f4 (diff)
Sharing: Add progressbar and cancel button.
Add a progressbar to indicate amount downloaded and a cancel button to cancel the download.
Diffstat (limited to 'ProgressDialog.py')
-rw-r--r--ProgressDialog.py26
1 files changed, 26 insertions, 0 deletions
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)
+