Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Ubuntu 9.10 is out!!!

When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu.

The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely.

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old October 15th, 2005   #1
minio
Just Give Me the Beans!
 
Join Date: Nov 2004
Location: Prague, Czech Republic
Beans: 69
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 04:15 PM..
minio is offline   Reply With Quote
Old October 15th, 2005   #2
sethmahoney
Dipped in Ubuntu
 
Join Date: Mar 2005
Location: Portland, Oregon
Beans: 474
Ubuntu 7.04 Feisty Fawn
Send a message via AIM to sethmahoney
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?
sethmahoney is offline   Reply With Quote
Old October 15th, 2005   #3
OttoDestruct
A Carafe of Ubuntu
 
Join Date: Aug 2005
Beans: 132
Re: HOWTO: Thumbnails for OpenOffice.org 2 files

Could someone provide a screenshot to show the finished product?
OttoDestruct is offline   Reply With Quote
Old October 16th, 2005   #4
NeTo
A Carafe of Ubuntu
 
NeTo's Avatar
 
Join Date: Feb 2005
Location: Chile
Beans: 104
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 Images
File Type: png Screenshot-Lab 3.png (154.2 KB, 1508 views)

Last edited by NeTo; October 16th, 2005 at 01:59 AM..
NeTo is offline   Reply With Quote
Old October 30th, 2005   #5
jd_
Spilled the Beans
 
Join Date: Apr 2005
Location: France
Beans: 9
The Feisty Fawn Testing
Re: HOWTO: Thumbnails for OpenOffice.org 2 files

Excellent
Thanks.
jd_ is offline   Reply With Quote
Old October 31st, 2005   #6
Muffe
A Carafe of Ubuntu
 
Join Date: Jul 2005
Location: Grimstad, Norway
Beans: 74
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?
Muffe is offline   Reply With Quote
Old October 31st, 2005   #7
minio
Just Give Me the Beans!
 
Join Date: Nov 2004
Location: Prague, Czech Republic
Beans: 69
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
minio is offline   Reply With Quote
Old October 31st, 2005   #8
Muffe
A Carafe of Ubuntu
 
Join Date: Jul 2005
Location: Grimstad, Norway
Beans: 74
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.
Muffe is offline   Reply With Quote
Old November 2nd, 2005   #9
Haegin
Quad Shot of Ubuntu
 
Haegin's Avatar
 
Join Date: May 2005
Location: Marlborough, UK
Beans: 483
Ubuntu Karmic Koala (testing)
Send a message via MSN to Haegin Send a message via Skype™ to Haegin
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"
Haegin is offline   Reply With Quote
Old November 3rd, 2005   #10
magnusbb
Way Too Much Ubuntu
 
Join Date: Aug 2005
Location: Oslo, Norway
Beans: 225
Send a message via MSN to magnusbb
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.
magnusbb is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:21 AM.


vBulletin ©2000 - 2009, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry