diff options
author | Manuel Kaufmann <humitos@gmail.com> | 2013-02-26 18:25:46 (GMT) |
---|---|---|
committer | Manuel QuiƱones <manuq@laptop.org> | 2013-04-10 13:00:16 (GMT) |
commit | 5234aee5bae44f0ca81084f0d33a26f24d6ac63a (patch) | |
tree | d7a57e05f01e82d75d78837a7f3577e5ab5f8358 /pdfviewer.py | |
parent | 673332382799ea8e9c3f18914b9757583e4833a0 (diff) |
Download progress bar SL #4385
This patch is a workaround for a WebKit's bug[1] regarding the
'notify::progress' signal that is not emitted when it should be. So,
we use 'notify::current-size' signal instead and compare the
'current-size' with the 'total-size' to get the proper progress.
[1] https://bugs.webkit.org/show_bug.cgi?id=107308
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
Acked-by: Manuel QuiƱones <manuq@laptop.org>
Diffstat (limited to 'pdfviewer.py')
-rw-r--r-- | pdfviewer.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/pdfviewer.py b/pdfviewer.py index 7557594..f30dbc0 100644 --- a/pdfviewer.py +++ b/pdfviewer.py @@ -503,12 +503,22 @@ class PDFTabPage(Gtk.HBox): self._download = WebKit.Download.new(network_request) self._download.set_destination_uri('file://' + dest_path) - self._download.connect('notify::progress', self.__download_progress_cb) + # FIXME: workaround for SL #4385 + # self._download.connect('notify::progress', self.__download_progress_cb) + self._download.connect('notify::current-size', + self.__current_size_changed_cb) self._download.connect('notify::status', self.__download_status_cb) self._download.connect('error', self.__download_error_cb) self._download.start() + def __current_size_changed_cb(self, download, something): + current_size = download.get_current_size() + total_size = download.get_total_size() + progress = current_size / float(total_size) + self._browser.props.progress = progress + self._message_box.progress_icon.update(progress) + def __download_progress_cb(self, download, data): progress = download.get_progress() self._browser.props.progress = progress |