Results 1 to 10 of 106

Thread: HOWTO: Thumbnails for OpenOffice.org 2 files

Threaded View

  1. #1
    Join Date
    Nov 2004
    Location
    Prague, Czech Republic
    Beans
    68

    HOWTO: Thumbnails for OpenOffice.org 2 files

    This also works for OOo1 files created or altered with OOo2. Beacuse OOo2 saves thumbnail of document into created file all what is needed is to extract the image a save it with right name
    So first create file named ooo2-thumbnailer in /usr/bin
    Code:
    sudo gedit /usr/bin/ooo2-thumbnailer
    and put in it following code
    Code:
    #!/usr/bin/python
    # released into the public domain http://creativecommons.org/licenses/publicdomain
    import zipfile
    import sys
    import gnomevfs
    
    inURL=gnomevfs.get_local_path_from_uri(sys.argv[1])
    outURL=sys.argv[2]
    
    zip=zipfile.ZipFile(inURL,mode="r")
    picture=zip.read("Thumbnails/thumbnail.png")
    thumbnail=open(outURL,"w")
    thumbnail.write(picture)
    thumbnail.write("/n")
    zip.close()
    thumbnail.close()
    and save the file.
    Now we need to make it executable
    Code:
    sudo chmod +x /usr/bin/ooo2-thumbnailer
    The next step is to tell Gnome how to use this thumbnailer. So create file ooo2.schemas in /usr/share/gconf/schemas
    Code:
    sudo gedit /usr/share/gconf/schemas/ooo2.schemas
    and paste in it following code
    Code:
    <gconfschemafile>
        <schemalist>
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.text/enable</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.text/enable</applyto>
                <owner>ooo2-thumb</owner>
                <type>bool</type>
                <default>true</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.text/command</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.text/command</applyto>
                <owner>ooo2-thumb</owner>
                <type>string</type>
                <default>/usr/bin/ooo2-thumbnailer %u %o</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
         
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.spreadsheet/enable</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.spreadsheet/enable</applyto>
                <owner>ooo2-thumb</owner>
                <type>bool</type>
                <default>true</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.spreadsheet/command</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.spreadsheet/command</applyto>
                <owner>ooo2-thumb</owner>
                <type>string</type>
                <default>/usr/bin/ooo2-thumbnailer %u %o</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    	<schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.graphics/enable</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.graphics/enable</applyto>
                <owner>ooo2-thumb</owner>
                <type>bool</type>
                <default>true</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.graphics/command</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.graphics/command</applyto>
                <owner>ooo2-thumb</owner>
                <type>string</type>
                <default>/usr/bin/ooo2-thumbnailer %u %o</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    	<schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.formula/enable</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.formula/enable</applyto>
                <owner>ooo2-thumb</owner>
                <type>bool</type>
                <default>true</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.formula/command</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.formula/command</applyto>
                <owner>ooo2-thumb</owner>
                <type>string</type>
                <default>/usr/bin/ooo2-thumbnailer %u %o</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.presentation/enable</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.presentation/enable</applyto>
                <owner>ooo2-thumb</owner>
                <type>bool</type>
                <default>true</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.presentation/command</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.oasis.opendocument.presentation/command</applyto>
                <owner>ooo2-thumb</owner>
                <type>string</type>
                <default>/usr/bin/ooo2-thumbnailer %u %o</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
    <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.writer/enable</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.writer/enable</applyto>
                <owner>ooo2-thumb</owner>
                <type>bool</type>
                <default>true</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.writer/command</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.writer/command</applyto>
                <owner>ooo2-thumb</owner>
                <type>string</type>
                <default>/usr/bin/ooo2-thumbnailer %u %o</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
         
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.calc/enable</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.calc/enable</applyto>
                <owner>ooo2-thumb</owner>
                <type>bool</type>
                <default>true</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.calc/command</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.calc/command</applyto>
                <owner>ooo2-thumb</owner>
                <type>string</type>
                <default>/usr/bin/ooo2-thumbnailer %u %o</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.draw/enable</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.draw/enable</applyto>
                <owner>ooo2-thumb</owner>
                <type>bool</type>
                <default>true</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.draw/command</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.draw/command</applyto>
                <owner>ooo2-thumb</owner>
                <type>string</type>
                <default>/usr/bin/ooo2-thumbnailer %u %o</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    	
    	<schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.math/enable</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.math/enable</applyto>
                <owner>ooo2-thumb</owner>
                <type>bool</type>
                <default>true</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.math/command</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.math/command</applyto>
                <owner>ooo2-thumb</owner>
                <type>string</type>
                <default>/usr/bin/ooo2-thumbnailer %u %o</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    	<schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.impress/enable</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.impress/enable</applyto>
                <owner>ooo2-thumb</owner>
                <type>bool</type>
                <default>true</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
    
            <schema>
                <key>/schemas/desktop/gnome/thumbnailers/application@vnd.sun.xml.impress/command</key>
                <applyto>/desktop/gnome/thumbnailers/application@vnd.sun.xml.impress/command</applyto>
                <owner>ooo2-thumb</owner>
                <type>string</type>
                <default>/usr/bin/ooo2-thumbnailer %u %o</default>
                <locale name="C">
                    <short></short>
                    <long></long>
                </locale>
            </schema>
    
        </schemalist>
    </gconfschemafile>
    and save it.
    Now there are two ways to start gnome to use this thumbnailer
    1) reboot
    2) tell gnome to read this file:
    Code:
    gconftool-2 --install-schema-file /usr/share/gconf/schemas/ooo2.schemas
    and restart nautilus
    Code:
    killall -9 nautilus
    Last edited by minio; March 19th, 2009 at 09:15 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •