Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/ProgressDialog.py
blob: c1a8f7061cac9828c3fb36c1b988281c8582d0eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from gi.repository import Gtk
from gi.repository import GObject
from gettext import gettext as _


class ProgressDialog(Gtk.Dialog):

    def __init__(self, parent):
        Gtk.Dialog.__init__(self, _('Downloading...'), parent, \
                Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, \
                (Gtk.STOCK_CANCEL, Gtk.ResponseType.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.ResponseType.REJECT:
            self._activity.close()
        else:
            pass

    def set_fraction(self, fraction):
        self._pb.set_fraction(fraction)