diff -udrN comix-4.0.4.orig/src/about.py comix-4.0.4/src/about.py
--- comix-4.0.4.orig/src/about.py	2009-02-14 14:09:21.000000000 +0300
+++ comix-4.0.4/src/about.py	2009-06-12 00:29:19.888411009 +0400
@@ -55,7 +55,7 @@
         &#039;</span></b></big></big></big></big>

&#039; +
         _(&#039;Comix is an image viewer specifically designed to handle comic books.&#039;) +
         &#039;
&#039; +
-        _(&#039;It reads ZIP, RAR and tar archives, as well as plain image files.&#039;) +
+        _(&#039;It reads ZIP, RAR, 7-zip and tar archives, as well as plain image files.&#039;) +
         &#039;

&#039; +
         _(&#039;Comix is licensed under the GNU General Public License.&#039;) +
         &#039;

&#039; +
diff -udrN comix-4.0.4.orig/src/archive.py comix-4.0.4/src/archive.py
--- comix-4.0.4.orig/src/archive.py	2009-04-03 21:11:43.000000000 +0400
+++ comix-4.0.4/src/archive.py	2009-06-12 09:44:12.149403563 +0400
@@ -11,10 +11,11 @@
 
 import process
 
-ZIP, RAR, TAR, GZIP, BZIP2 = range(5)
+ZIP, RAR, TAR, GZIP, BZIP2, P7Z = range(6)
 
 _rar_exec = None
 
+_p7z_exec = None
 
 class Extractor:
 
@@ -74,6 +75,37 @@
             self._files = [name.rstrip(os.linesep) for name in fd.readlines()]
             fd.close()
             proc.wait()
+        elif self._type == P7Z:
+            global _p7z_exec
+            print(&#039;p7z: %s
&#039; % _p7z_exec)
+            if _p7z_exec is None:
+                _p7z_exec = _get_p7z_exec()
+                if _p7z_exec is None:
+                    print &#039;! Could not find 7-zip file extractor.&#039;
+                    dialog = gtk.MessageDialog(None, 0, gtk.MESSAGE_WARNING,
+                        gtk.BUTTONS_CLOSE,
+                        _("Could not find 7-zip file extractor!"))
+                    dialog.format_secondary_markup(
+                        _("You need either the <i>7zr</i> or the <i>7z</i> or the <i>7za</i> program installed in order to read 7-zip (.cb7) files."))
+                    dialog.run()
+                    dialog.destroy()
+                    return None
+            proc = process.Process([_p7z_exec, &#039;l&#039;, &#039;-slt&#039;, src])
+            fd = proc.spawn()
+            #self._files = [name.rstrip(os.linesep).rsplit(&#039;               &#039;)[-1] for name in fd.readlines()]
+            lastPath = None
+            lastAttr = None
+            self._files = []
+            for line in fd.readlines():
+                if line.startswith(&#039;Path =&#039;):
+                    lastPath = line.replace(&#039;Path = &#039;, &#039;&#039;).rstrip(os.linesep)
+                    lastAttr = None
+                elif line.startswith(&#039;Attributes = &#039;):
+                    lastAttr = line.replace(&#039;Attributes = &#039;, &#039;&#039;).rstrip(os.linesep)
+                    if not lastAttr.startswith(&#039;D&#039;) and lastPath:
+                        self._files.append(lastPath)
+            fd.close()
+            proc.wait()
         else:
             print &#039;! Non-supported archive format:&#039;, src
             return None
@@ -179,6 +211,14 @@
                     proc.wait()
                 else:
                     print &#039;! Could not find RAR file extractor.&#039;
+            elif self._type == P7Z:
+                if _p7z_exec is not None:
+                    proc = process.Process([_p7z_exec, &#039;x&#039;, &#039;-bd&#039;, &#039;-o%s&#039; % self._dst,
+                        self._src, name])
+                    proc.spawn()
+                    proc.wait()
+                else:
+                    print &#039;! Could not find RAR file extractor.&#039;
         except Exception:
             # Better to ignore any failed extractions (e.g. from a corrupt
             # archive) than to crash here and leave the main thread in a
@@ -296,6 +336,8 @@
                 return TAR
             if magic == &#039;Rar!&#039;:
                 return RAR
+            if magic.startswith(&#039;7z&#039;):
+                return P7Z
     except Exception:
         print &#039;! Error while reading&#039;, path
     return None
@@ -307,6 +349,7 @@
             TAR:   _(&#039;Tar archive&#039;),
             GZIP:  _(&#039;Gzip compressed tar archive&#039;),
             BZIP2: _(&#039;Bzip2 compressed tar archive&#039;),
+            P7Z:   _(&#039;7-zip archive&#039;),
             RAR:   _(&#039;RAR archive&#039;)}[archive_type]
 
 
@@ -335,3 +378,12 @@
         if process.Process([command]).spawn() is not None:
             return command
     return None
+
+def _get_p7z_exec():
+    """Return the name of the 7-zip file extractor executable, or None if
+    no such executable is found.
+    """
+    for command in (&#039;7zr&#039;, &#039;7z&#039;, &#039;7za&#039;):
+        if process.Process([command]).spawn() is not None:
+            return command
+    return None
diff -udrN comix-4.0.4.orig/src/filechooser.py comix-4.0.4/src/filechooser.py
--- comix-4.0.4.orig/src/filechooser.py	2009-04-03 21:06:13.000000000 +0400
+++ comix-4.0.4/src/filechooser.py	2009-06-12 09:46:58.209902230 +0400
@@ -81,11 +81,13 @@
         self.add_filter(_(&#039;All Archives&#039;), (&#039;application/x-zip&#039;,
             &#039;application/zip&#039;, &#039;application/x-rar&#039;, &#039;application/x-tar&#039;,
             &#039;application/x-gzip&#039;, &#039;application/x-bzip2&#039;, &#039;application/x-cbz&#039;,
-            &#039;application/x-cbr&#039;, &#039;application/x-cbt&#039;))
+            &#039;application/x-cbr&#039;, &#039;application/x-cbt&#039;, &#039;application/x-7z-compressed&#039;, &#039;application/x-cb7&#039;))
         self.add_filter(_(&#039;ZIP archives&#039;),
             (&#039;application/x-zip&#039;, &#039;application/zip&#039;, &#039;application/x-cbz&#039;))
         self.add_filter(_(&#039;RAR archives&#039;),
             (&#039;application/x-rar&#039;, &#039;application/x-cbr&#039;))
+        self.add_filter(_(&#039;7-zip archives&#039;),
+            (&#039;application/x-7z-compressed&#039;, &#039;application/x-cb7&#039;))
         self.add_filter(_(&#039;Tar archives&#039;),
             (&#039;application/x-tar&#039;, &#039;application/x-gzip&#039;,
             &#039;application/x-bzip2&#039;, &#039;application/x-cbt&#039;))

Add a code snippet to your website: www.paste.org