Page 1 of 11 123 ... LastLast
Results 1 to 10 of 106

Thread: HOWTO: Thumbnails for OpenOffice.org 2 files

  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.

  2. #2
    Join Date
    Mar 2005
    Location
    Portland, Oregon
    Beans
    433
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: HOWTO: Thumbnails for OpenOffice.org 2 files

    Awesome howto, works perfectly! Anyone know if there's a quick/easy way to add a small icon or watermark over the thumbnail?

  3. #3
    Join Date
    Aug 2005
    Beans
    123

    Re: HOWTO: Thumbnails for OpenOffice.org 2 files

    Could someone provide a screenshot to show the finished product?

  4. #4
    Join Date
    Feb 2005
    Location
    Chile
    Beans
    103

    Re: HOWTO: Thumbnails for OpenOffice.org 2 files

    Quote Originally Posted by OttoDestruct
    Could someone provide a screenshot to show the finished product?
    Here's a shot of my homework, two Writer files: one with images, and the other one with formulas.

    If you decide to try out the thumbnails and don't like the results afterwards, you can roll back by deleting the two files:
    Code:
    sudo rm /usr/bin/ooo2-thumbnailer
    sudo rm /usr/share/gconf/schemas/ooo2.schemas
    And then restart Gnome (or nautilus, following minio's instructions).

    Btw, thank you minio for the how-to . The only downside I notice is that Ooo2 generates thumbnails with transparent backgrounds, so they don't look that good if you have set a background in nautilus.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Screenshot-Lab 3.png 
Views:	1938 
Size:	154.2 KB 
ID:	2934  
    Last edited by NeTo; October 16th, 2005 at 06:59 AM.

  5. #5
    Join Date
    Apr 2005
    Location
    France
    Beans
    9
    Distro
    The Feisty Fawn Testing

    Re: HOWTO: Thumbnails for OpenOffice.org 2 files

    Excellent
    Thanks.

  6. #6
    Join Date
    Jul 2005
    Location
    Grimstad, Norway
    Beans
    80
    Distro
    Ubuntu 6.10 Edgy

    Re: HOWTO: Thumbnails for OpenOffice.org 2 files

    I have followed the instructions perfectly, and I still can't get this to work. Every file is in the right place with the right owner and permissions. Does anyone have a hint?

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

    Re: HOWTO: Thumbnails for OpenOffice.org 2 files

    One of following steps should help
    1) open gconf-editor and go to desktop->gnome->thumbnailers check if there ar e folders like "application@vnd.oasis.opendocument.graphics","app lication@vnd.sun.xml.impress" and similar. then check if key "command" in these folders contains correct path to thumbnailer (it should be /usr/bin/ooo2-thumbnailer %u %o) and if is enable checked.

    2)try to delete entire ~/.thumbnails/fail directory and restart nautilus

    3)check if those files you want to be thumbnailed were created with OOo2.

    4)open one file with file-roller and look if there is Thumbnails directory some older betas of OOo2 used Thumbnail directory instead

  8. #8
    Join Date
    Jul 2005
    Location
    Grimstad, Norway
    Beans
    80
    Distro
    Ubuntu 6.10 Edgy

    Re: HOWTO: Thumbnails for OpenOffice.org 2 files

    found the mistake. I executed this command:

    Code:
    gconftool-2 --install-schema-file /usr/share/gconf/schemas/ooo2.schemas
    as root, not my usual user.

  9. #9
    Join Date
    May 2005
    Location
    Marlborough, UK
    Beans
    469
    Distro
    Ubuntu Karmic Koala (testing)

    Re: HOWTO: Thumbnails for OpenOffice.org 2 files

    SCHWEET! Works great - any chance this can be incorporated into dapper with an option to turn it off sumwhere? Its definatly an improvement and I can't see how a load of open office file logos are any better in any way except maybe that they tell you what file format it is in. Maybe if you could get a little overlay on each if it is possible (I doubt its easy if I understand how you are doing it correctly)

    Brilliant anyway...
    Regards,
    Haegin
    If all else fails curl up in bed with a good book.
    "<mc44> rob: every time you don’t read the topic, god kills a lolcat"

  10. #10
    Join Date
    Aug 2005
    Location
    Oslo, Norway
    Beans
    225

    Re: HOWTO: Thumbnails for OpenOffice.org 2 files

    Nice one!

    I am very picky, but try this:

    Using the GNOME Templates system in Nautilus, put an empty OpenOffice document (a template) in the /home/user/Templates folder, right-click on your desktop and look inside your "Create Document" menu. The icon for the document will now reflect the empty document, resulting in the icon of a "blank sheet".



    I suppose it can be fixed in some way.

Page 1 of 11 123 ... LastLast

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
  •