diff --git a/mcomix/about_dialog.py b/mcomix/about_dialog.py index 9f956d5..10ff0be 100644 --- a/mcomix/about_dialog.py +++ b/mcomix/about_dialog.py @@ -27,7 +27,7 @@ class _AboutDialog(gtk.AboutDialog): comment = \ _('%s is an image viewer specifically designed to handle comic books.') % \ constants.APPNAME + u' ' + \ - _('It reads ZIP, RAR and tar archives, as well as plain image files.') + _('It reads ZIP and tar archives, as well as plain image files.') self.set_comments(comment) license = \ diff --git a/mcomix/archive_extractor.py b/mcomix/archive_extractor.py index afed5c7..bc969bf 100644 --- a/mcomix/archive_extractor.py +++ b/mcomix/archive_extractor.py @@ -12,8 +12,8 @@ class Extractor: """Extractor is a threaded class for extracting different archive formats. - The Extractor can be loaded with paths to archives (currently ZIP, tar, - or RAR archives) and a path to a destination directory. Once an archive + The Extractor can be loaded with paths to archives (currently ZIP or tar + archives) and a path to a destination directory. Once an archive has been set it is possible to filter out the files to be extracted and set the order in which they should be extracted. The extraction can then be started in a new thread in which files are extracted one by one, diff --git a/mcomix/archive_tools.py b/mcomix/archive_tools.py index 66c3f14..151a904 100644 --- a/mcomix/archive_tools.py +++ b/mcomix/archive_tools.py @@ -8,7 +8,6 @@ import tarfile from mcomix import constants from mcomix import log from mcomix.archive import zip -from mcomix.archive import rar from mcomix.archive import tar from mcomix.archive import sevenzip from mcomix.archive import lha @@ -16,9 +15,6 @@ from mcomix.archive import lha def szip_available(): return sevenzip.SevenZipArchive.is_available() -def rar_available(): - return rar.RarArchive.is_available() or szip_available() - def lha_available(): return lha.LhaArchive.is_available() or szip_available() @@ -31,9 +27,6 @@ def get_supported_archive_regex(): if szip_available(): formats.extend(constants.SZIP_FORMATS[1]) - if rar_available(): - formats.extend(constants.RAR_FORMATS[1]) - if lha_available(): formats.extend(constants.LHA_FORMATS[1]) @@ -71,10 +64,7 @@ def archive_mime_type(path): else: return constants.TAR - if magic == 'Rar!': - return constants.RAR - - elif magic == '7z\xBC\xAF': + if magic == '7z\xBC\xAF': return constants.SEVENZIP elif magic[2:] == '-l': @@ -124,11 +114,6 @@ def get_archive_handler(path): return zip.ZipArchive(path) elif mime in (constants.TAR, constants.GZIP, constants.BZIP2): return tar.TarArchive(path) - elif mime == constants.RAR and rar.RarArchive.is_available(): - return rar.RarArchive(path) - elif mime == constants.RAR and sevenzip.SevenZipArchive.is_available(): - log.info('Using Sevenzip for RAR archives.') - return sevenzip.SevenZipArchive(path) elif mime == constants.SEVENZIP and sevenzip.SevenZipArchive.is_available(): return sevenzip.SevenZipArchive(path) elif mime == constants.LHA and lha.LhaArchive.is_available(): diff --git a/mcomix/constants.py b/mcomix/constants.py index fad3b78..3c225c5 100644 --- a/mcomix/constants.py +++ b/mcomix/constants.py @@ -28,7 +28,7 @@ FILEINFO_PICKLE_PATH = os.path.join(DATA_DIR, 'file.pickle') PREFERENCE_PICKLE_PATH = os.path.join(CONFIG_DIR, 'preferences.pickle') ZOOM_MODE_BEST, ZOOM_MODE_WIDTH, ZOOM_MODE_HEIGHT, ZOOM_MODE_MANUAL, ZOOM_MODE_SIZE = range(5) -ZIP, RAR, TAR, GZIP, BZIP2, PDF, SEVENZIP, LHA = range(8) +ZIP, TAR, GZIP, BZIP2, PDF, SEVENZIP, LHA = range(7) NORMAL_CURSOR, GRAB_CURSOR, WAIT_CURSOR, NO_CURSOR = range(4) LIBRARY_DRAG_EXTERNAL_ID, LIBRARY_DRAG_BOOK_ID, LIBRARY_DRAG_COLLECTION_ID = range(3) AUTOROTATE_NEVER, AUTOROTATE_WIDTH_90, AUTOROTATE_WIDTH_270, \ @@ -57,9 +57,6 @@ SUPPORTED_IMAGE_REGEX = re.compile(r'\.(jpg|jpeg|png|gif|tif|tiff|bmp|ppm|pgm|pb ZIP_FORMATS = ( ('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/x-cbz'), ('*.zip', '*.cbz')) -RAR_FORMATS = ( - ('application/x-rar', 'application/x-cbr'), - ('*.rar', '*.cbr')) TAR_FORMATS = ( ('application/x-tar', 'application/x-gzip', 'application/x-bzip2', 'application/x-cbt'), ('*.tar', '*.gz', '*.bz2', '*.bzip2', '*.cbt')) diff --git a/mcomix/file_chooser_base_dialog.py b/mcomix/file_chooser_base_dialog.py index 4d2a34e..c518842 100644 --- a/mcomix/file_chooser_base_dialog.py +++ b/mcomix/file_chooser_base_dialog.py @@ -88,9 +88,6 @@ class _BaseFileChooserDialog(gtk.Dialog): # extractor availability. mimetypes = constants.ZIP_FORMATS[0] + constants.TAR_FORMATS[0] patterns = constants.ZIP_FORMATS[1] + constants.TAR_FORMATS[1] - if archive_tools.rar_available(): - mimetypes += constants.RAR_FORMATS[0] - patterns += constants.RAR_FORMATS[1] if archive_tools.szip_available(): mimetypes += constants.SZIP_FORMATS[0] patterns += constants.SZIP_FORMATS[1] @@ -107,10 +104,6 @@ class _BaseFileChooserDialog(gtk.Dialog): self.add_filter(_('Tar archives'), *constants.TAR_FORMATS) - if archive_tools.rar_available(): - self.add_filter(_('RAR archives'), - *constants.RAR_FORMATS) - if archive_tools.szip_available(): self.add_filter(_('7z archives'), *constants.SZIP_FORMATS) diff --git a/mcomix/messages/mcomix.pot b/mcomix/messages/mcomix.pot index 54ece85..482c051 100644 --- a/mcomix/messages/mcomix.pot +++ b/mcomix/messages/mcomix.pot @@ -24,7 +24,7 @@ msgid "%s is an image viewer specifically designed to handle comic books." msgstr "" #: mcomix/about_dialog.py:30 -msgid "It reads ZIP, RAR and tar archives, as well as plain image files." +msgid "It reads ZIP and tar archives, as well as plain image files." msgstr "" #: mcomix/about_dialog.py:34 @@ -241,10 +241,6 @@ msgstr "" msgid "Tar archives" msgstr "" -#: mcomix/file_chooser_base_dialog.py:111 -msgid "RAR archives" -msgstr "" - #: mcomix/file_chooser_base_dialog.py:115 msgid "7z archives" msgstr "" @@ -1345,10 +1341,6 @@ msgstr "" msgid "Bzip2 compressed tar archive" msgstr "" -#: mcomix/strings.py:13 -msgid "RAR archive" -msgstr "" - #: mcomix/strings.py:14 msgid "7z archive" msgstr "" diff --git a/mcomix/process.py b/mcomix/process.py index 4ba60c6..c37699d 100644 --- a/mcomix/process.py +++ b/mcomix/process.py @@ -10,10 +10,7 @@ from mcomix import i18n class Process: """The subprocess and popen2 modules in Python are broken (see issue - #1336). The problem (i.e. complete crash) they can cause happen fairly - often (once is too often) in MComix when calling "rar" or "unrar" to - extract specific files from archives. We roll our own very simple - process spawning module here instead. + #1336). We roll our own very simple process spawning module here instead. """ # TODO: I can no longer reproduce the issue. Check if this version of # process.py still solves it. diff --git a/mcomix/recent.py b/mcomix/recent.py index 3d4613d..3f5c511 100644 --- a/mcomix/recent.py +++ b/mcomix/recent.py @@ -30,8 +30,7 @@ class RecentFilesMenu(gtk.RecentChooserMenu): rfilter.add_pixbuf_formats() mimetypes, patterns = itertools.izip(constants.ZIP_FORMATS, - constants.RAR_FORMATS, constants.TAR_FORMATS, - constants.SZIP_FORMATS) + constants.TAR_FORMATS, constants.SZIP_FORMATS) for mimetype in itertools.chain.from_iterable(mimetypes): rfilter.add_mime_type(mimetype) diff --git a/mcomix/strings.py b/mcomix/strings.py index c5ca21f..cc69236 100644 --- a/mcomix/strings.py +++ b/mcomix/strings.py @@ -3,14 +3,13 @@ This file should only be imported after gettext has been correctly initialized and installed in the global namespace. """ -from mcomix.constants import ZIP, TAR, GZIP, BZIP2, RAR, SEVENZIP, LHA +from mcomix.constants import ZIP, TAR, GZIP, BZIP2, SEVENZIP, LHA ARCHIVE_DESCRIPTIONS = { ZIP: _('ZIP archive'), TAR: _('Tar archive'), GZIP: _('Gzip compressed tar archive'), BZIP2: _('Bzip2 compressed tar archive'), - RAR: _('RAR archive'), SEVENZIP: _('7z archive'), LHA: _('LHA archive') } diff --git a/mcomix.egg-info/SOURCES.txt b/mcomix.egg-info/SOURCES.txt index 62de3ad..85a65df 100644 --- a/mcomix.egg-info/SOURCES.txt +++ b/mcomix.egg-info/SOURCES.txt @@ -77,8 +77,6 @@ mcomix.egg-info/top_level.txt mcomix/archive/__init__.py mcomix/archive/archive_base.py mcomix/archive/lha.py -mcomix/archive/rar.py -mcomix/archive/rarfile.py mcomix/archive/sevenzip.py mcomix/archive/tar.py mcomix/archive/zip.py @@ -183,18 +181,13 @@ mime/comicthumb.1.gz mime/mcomix.desktop mime/mcomix.thumbnailer mime/mcomix.xml -mime/icons/16x16/application-x-cbr.png mime/icons/16x16/application-x-cbt.png mime/icons/16x16/application-x-cbz.png -mime/icons/22x22/application-x-cbr.png mime/icons/22x22/application-x-cbt.png mime/icons/22x22/application-x-cbz.png -mime/icons/24x24/application-x-cbr.png mime/icons/24x24/application-x-cbt.png mime/icons/24x24/application-x-cbz.png -mime/icons/32x32/application-x-cbr.png mime/icons/32x32/application-x-cbt.png mime/icons/32x32/application-x-cbz.png -mime/icons/48x48/application-x-cbr.png mime/icons/48x48/application-x-cbt.png -mime/icons/48x48/application-x-cbz.png \ No newline at end of file +mime/icons/48x48/application-x-cbz.png diff --git a/mime/comicbook.schemas b/mime/comicbook.schemas index cdc4a4a..21b6214 100644 --- a/mime/comicbook.schemas +++ b/mime/comicbook.schemas @@ -1,28 +1,6 @@ - /schemas/desktop/gnome/thumbnailers/application@x-cbr/enable - /desktop/gnome/thumbnailers/application@x-cbr/enable - comicthumb - bool - true - - - - - - - /schemas/desktop/gnome/thumbnailers/application@x-cbr/command - /desktop/gnome/thumbnailers/application@x-cbr/command - comicthumb - string - comicthumb %i %o %s - - - - - - /schemas/desktop/gnome/thumbnailers/application@x-cbz/enable /desktop/gnome/thumbnailers/application@x-cbz/enable comicthumb diff --git a/mime/comicthumb b/mime/comicthumb index 5728e2a..d77a4a1 100755 --- a/mime/comicthumb +++ b/mime/comicthumb @@ -7,7 +7,7 @@ comicthumb is dependent on the Python Imaging Library (PIL). comicthumb was originally written by Christoph Wolk, this version was re-written from scratch for Comix 4 by Pontus Ekberg. -Supported formats: ZIP, RAR and tar (.cbz, .cbr, .cbt) +Supported formats: ZIP and tar (.cbz, .cbt) Usage: comicthumb INFILE OUTFILE [SIZE] """ @@ -28,16 +28,13 @@ except ImportError: print __doc__ sys.exit(1) -ZIP, RAR, TAR, GZIP, BZIP2 = range(5) +ZIP, TAR, GZIP, BZIP2 = range(5) class Process: """The subprocess and popen2 modules in Python are broken (see issue - #1336). The problem (i.e. complete crash) they can cause happen fairly - often (once is too often) in Comix when calling "rar" or "unrar" to - extract specific files from archives. We roll our own very simple - process spawning module here instead. + #1336). We roll our own very simple process spawning module here instead. """ # TODO: I can no longer reproduce the issue. Check if this version of # process.py still solves it. @@ -94,19 +91,6 @@ class Extractor: elif self._type in [TAR, GZIP, BZIP2]: self._tfile = tarfile.open(src, 'r') self._files = self._tfile.getnames() - elif self._type == RAR: - self._rar = None - for command in ('unrar', 'rar'): - if Process([command]).spawn() is not None: - self._rar = command - if self._rar == None: - print '! Could not find the "rar" or "unrar" executable.' - sys.exit(1) - proc = Process([self._rar, 'vb', src]) - fobj = proc.spawn() - self._files = fobj.readlines() - proc.wait() - self._files = [name.rstrip('\n') for name in self._files] def get_files(self): """Return a list of the files in the archive.""" @@ -121,11 +105,6 @@ class Extractor: return cStringIO.StringIO(self._zfile.read(chosen)) elif self._type in [TAR, GZIP, BZIP2]: return cStringIO.StringIO(self._tfile.extractfile(chosen).read()) - elif self._type == RAR: - proc = Process([self._rar, 'p', '-inul', '-p-', '--', - self._src, chosen]) - fobj = proc.spawn() - return cStringIO.StringIO(fobj.read()) def archive_mime_type(path): @@ -145,8 +124,6 @@ def archive_mime_type(path): if magic.startswith('\037\213'): return GZIP return TAR - if magic == 'Rar!': - return RAR except Exception: print '! Error while reading', path return None diff --git a/mime/mcomix.desktop b/mime/mcomix.desktop index ee6d8b9..19ec7cd 100644 --- a/mime/mcomix.desktop +++ b/mime/mcomix.desktop @@ -19,4 +19,4 @@ Terminal=false Type=Application StartupNotify=true Categories=Graphics;Viewer; -MimeType=application/x-cbz;application/x-cbr;application/x-cbt;image/jpeg;image/png;image/gif;image/tiff;image/bmp;image/x-icon;image/x-xpixmap;image/x-xbitmap;application/x-zip;application/zip;application/x-rar;application/x-tar;application/x-gzip;application/x-bzip2;image/svg+xml;image/svg;image/svg-xml;image/vnd.adobe.svg+xml;text/xml-svg;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-pcx;image/x-cmu-raster;image/x-sun-raster;image/x-tga;application/x-7z-compressed;application/x-cb7;application/x-lzh;application/x-lha;application/x-lzh-compressed; +MimeType=application/x-cbz;application/x-cbt;image/jpeg;image/png;image/gif;image/tiff;image/bmp;image/x-icon;image/x-xpixmap;image/x-xbitmap;application/x-zip;application/zip;application/x-tar;application/x-gzip;application/x-bzip2;image/svg+xml;image/svg;image/svg-xml;image/vnd.adobe.svg+xml;text/xml-svg;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-pcx;image/x-cmu-raster;image/x-sun-raster;image/x-tga;application/x-7z-compressed;application/x-cb7;application/x-lzh;application/x-lha;application/x-lzh-compressed; diff --git a/mime/mcomix.thumbnailer b/mime/mcomix.thumbnailer index 4dcfc67..667dc8b 100644 --- a/mime/mcomix.thumbnailer +++ b/mime/mcomix.thumbnailer @@ -1,4 +1,4 @@ [Thumbnailer Entry] TryExec=comicthumb Exec=comicthumb %u %o %s -MimeType=application/x-cbr;application/x-cbz;application/x-cbt; +MimeType=application/x-cbz;application/x-cbt; diff --git a/mime/mcomix.xml b/mime/mcomix.xml index 765c254..b13e2da 100644 --- a/mime/mcomix.xml +++ b/mime/mcomix.xml @@ -5,11 +5,6 @@ Comic Book Archive (Zip compressed) - - - Comic Book Archive (RAR compressed) - - diff --git a/setup.py b/setup.py index 9eb7782..9979111 100755 --- a/setup.py +++ b/setup.py @@ -78,23 +78,18 @@ setuptools.setup( ('share/icons/hicolor/48x48/apps', ['mcomix/images/48x48/mcomix.png']), ('share/icons/hicolor/16x16/mimetypes', ['mime/icons/16x16/application-x-cbz.png', - 'mime/icons/16x16/application-x-cbr.png', 'mime/icons/16x16/application-x-cbt.png']), ('share/icons/hicolor/22x22/mimetypes', ['mime/icons/22x22/application-x-cbz.png', - 'mime/icons/22x22/application-x-cbr.png', 'mime/icons/22x22/application-x-cbt.png']), ('share/icons/hicolor/24x24/mimetypes', ['mime/icons/24x24/application-x-cbz.png', - 'mime/icons/24x24/application-x-cbr.png', 'mime/icons/24x24/application-x-cbt.png']), ('share/icons/hicolor/32x32/mimetypes', ['mime/icons/32x32/application-x-cbz.png', - 'mime/icons/32x32/application-x-cbr.png', 'mime/icons/32x32/application-x-cbt.png']), ('share/icons/hicolor/48x48/mimetypes', ['mime/icons/48x48/application-x-cbz.png', - 'mime/icons/48x48/application-x-cbr.png', 'mime/icons/48x48/application-x-cbt.png'])], # Package metadata