Пример #1
0
    def _create_progress(self):
        self.dialog = gtk.MessageDialog(self.parent, \
                0, 0, gtk.BUTTONS_CANCEL, self.subtitle or self.title)
        self.dialog.set_modal(True)
        self.dialog.connect('delete-event', self._on_delete_event)
        self.dialog.set_title(self.title)
        self.dialog.set_deletable(self.cancellable)

        # Avoid selectable text (requires PyGTK >= 2.22)
        if hasattr(self.dialog, 'get_message_area'):
            for label in self.dialog.get_message_area():
                if isinstance(label, gtk.Label):
                    label.set_selectable(False)

        self.dialog.set_response_sensitive(gtk.RESPONSE_CANCEL, \
                self.cancellable)

        self.progressbar = gtk.ProgressBar()
        self.progressbar.set_ellipsize(pango.ELLIPSIZE_END)

        # If the window is shown after the first update, set the progress
        # info so that when the window appears, data is there already
        if self._initial_progress is not None:
            self.progressbar.set_fraction(self._initial_progress)
        if self._initial_message is not None:
            self.progressbar.set_text(self._initial_message)

        self.dialog.vbox.add(self.progressbar)
        self.indicator = SpinningProgressIndicator()
        self.dialog.set_image(self.indicator)
        self.dialog.show_all()

        gobject.source_remove(self.source_id)
        self.source_id = gobject.timeout_add(self.INTERVAL, self._update_gui)
        return False
Пример #2
0
    def _create_progress(self):
        if gpodder.ui.fremantle:
            self.dialog = gtk.Dialog(self.title, self.parent, 0, \
                    (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
            import hildon
            hildon.hildon_gtk_window_set_progress_indicator(self.dialog, True)
        else:
            self.dialog = gtk.MessageDialog(self.parent, \
                    0, 0, gtk.BUTTONS_CANCEL, self.subtitle or self.title)
            self.dialog.label.set_selectable(False)
        self.dialog.connect('delete-event', self._on_delete_event)
        self.dialog.set_title(self.title)
        self.dialog.set_deletable(self.cancellable)

        self.dialog.set_response_sensitive(gtk.RESPONSE_CANCEL, \
                self.cancellable)

        self.progressbar = gtk.ProgressBar()
        self.progressbar.set_ellipsize(pango.ELLIPSIZE_END)

        # If the window is shown after the first update, set the progress
        # info so that when the window appears, data is there already
        if self._initial_progress is not None:
            self.progressbar.set_fraction(self._initial_progress)
        if self._initial_message is not None:
            self.progressbar.set_text(self._initial_message)

        self.dialog.vbox.add(self.progressbar)
        if not gpodder.ui.fremantle:
            self.indicator = SpinningProgressIndicator()
            self.dialog.set_image(self.indicator)
        self.dialog.show_all()

        gobject.source_remove(self.source_id)
        self.source_id = gobject.timeout_add(self.INTERVAL, self._update_gui)
        return False