From 92db3be048e6751446f5304fce679c7c63fd4766 Mon Sep 17 00:00:00 2001 From: Sai Vineet Date: Fri, 22 Nov 2013 17:20:51 +0000 Subject: Add more formats to Read 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 --- 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: -- cgit v0.9.1