diff options
author | Sai Vineet <saivineet89@gmail.com> | 2013-11-22 17:20:51 (GMT) |
---|---|---|
committer | Sai Vineet <saivineet89@gmail.com> | 2013-11-22 17:20:51 (GMT) |
commit | 92db3be048e6751446f5304fce679c7c63fd4766 (patch) | |
tree | 30e9e8deb00c80d51e484aca5a61fe9b2e45cc4d | |
parent | bb124a07e19758363f2df2042c3a381ba0e9421f (diff) |
Problem: Read currently does not open .cbz, .cbr(Comic book Archives - See
http://en.wikipedia.org/wiki/Comic_book_archive). Evince, the underlying document
displayer, supports .cbr and .cbz files, but needs some dependencies.
Support for .cbz/.cbr should be present.
Solution: Add dependencies/ import them if already existent and add support for
cbr/cbz formats. Unfortunately, cbr support requires rarfile which in turn
requires unrar or rar command line program to work. These dependencies can be
added later and Read should work properly with cbr files.
Fixes #3858
-rw-r--r-- | activity/activity.info | 2 | ||||
-rw-r--r-- | evinceadapter.py | 14 |
2 files changed, 14 insertions, 2 deletions
diff --git a/activity/activity.info b/activity/activity.info index fda38cb..babc03d 100644 --- a/activity/activity.info +++ b/activity/activity.info @@ -5,6 +5,6 @@ icon = activity-read exec = sugar-activity readactivity.ReadActivity show_launcher = no activity_version = 111 -mime_types = application/pdf;image/vnd.djvu;image/x.djvu;image/tiff;application/epub+zip;text/plain;application/zip +mime_types = application/pdf;image/vnd.djvu;image/x.djvu;image/tiff;application/epub+zip;text/plain;application/zip;application/x-rar-compressed;application/x-cbr license = GPLv2+ summary = Use this activity when you are ready to read! Remember to flip your computer around to feel like you are really holding a book! diff --git a/evinceadapter.py b/evinceadapter.py index 5e648da..fb40640 100644 --- a/evinceadapter.py +++ b/evinceadapter.py @@ -2,6 +2,13 @@ from gettext import gettext as _ import os import logging import time +import zipfile + +try: + import rarfile +except ImportError: + pass + from gi.repository import GObject from gi.repository import Gtk @@ -271,7 +278,12 @@ class EvinceViewer(): if self._validate_min_version(3, 5, 92): # check version because does not work and crash with older evince doc = self._model.get_document() - if not doc.has_document_links(): + try: + has_links = doc.has_document_links() + except AttributeError: + has_links = False + + if not has_links: logging.error('The pdf file does not have a index') return False else: |