Lodahl's blog: [UPDATED]OpenClipart - Part II

11 February 2013

[UPDATED]OpenClipart - Part II

Some time ago I wrote about our plans to intergrate OpenClipart.org API in LibreOffice. You can read that post here: http://lodahl.blogspot.dk/2013/01/libreoffice-and-openclipartorg.html .

And thanks for all the good advice on the comments list. All input will be read and taken seriously.

Now I want to tell you how far we are...

First of all we decided to go with LibreOffice 4.0 because the embedded Python runtime environment has been upgraded. We didn't want to go with yesterdays technology.

We developed a Python routine that draws the dialog and searches through the API. We get the result back and present titel and thumb nail image in the dialog. When clicking on a thumbnail image the SVG-file will be inserted into the document at the cursor position. Some meta data from OpenClipart.org is added to the inserted image.

It actually works :-)

You can find a very unofficial extension here. Do NOT try to install this extension in other thann LibreOffice 4.0.

The core insert of the image is actually done by a Basic macro as this is the most easy way to do that. We decided to use the dispatcher for it.

Well we still have a lot of work to do. First of all error handling and we must find some way to disable the dialog while we get data over the internet. Otherwise we get an error from Python even if we just touch the dialog - because the dialog is not ready yet.

We also need to be able to control the size of the inserted image. So far we just use 100% page width witch is probably not what we should do. We are still working on that.

Next is to put the dialog into the task panel as I mentioned in my earlier post. Perhaps we should just try to make dockable window instead but we will see to that. Does any of you guys know how to?

We tried to create an extension so that you guys can try it out but that failed. Something is wrong and it seems that LibreOffice 4.0.0.3 is a little buggy. In the daily built it actually installs but it doesn't run. It claims that Python is not a supported scripting language. (reported as a bug already as https://bugs.freedesktop.org/show_bug.cgi?id=60694 ). You can pick up the extension from there if you like. It doesn't work but it can be installed manually (Python and Basic ...copy and paste you know). As soon as we know whats going on I'll be back. I want to get it out to you as soon as possible so you can try it out.

Here is a short video for demonstration:



By the way we discovered another but (as reported here: https://bugs.freedesktop.org/show_bug.cgi?id=60692 ). It seems that LibreOffice 4.0 extension manager doesn't recognize its own version number. Its simply not possible to install an extension that depends on 4.0. But thats another bug.

4 comments:

Anonymous said...

Nice! The implementation seems already better than the Inkscape one :-)

...but one question: why is the dialog box so tall, and not wider?

Leif Lodahl said...

Hi,
First of all we still have some design work to do. But if you read my previous post http://lodahl.blogspot.dk/2013/01/libreoffice-and-openclipartorg.html you will see that there is a reason. We plan to embed the dialog in the Task Panel.

Anonymous said...

Hi, I tried the extension from the added link on LO4.0 on OSX and got this exception upon launching it from the Insert -> Picture -> Pictures from OpenClipart.org (IMHO, that could be shortened into From OpenClipart.org, as the menus Insert and Picture describe what is going on), hope this helps you debugging the extension, keep up the good work:
com.sun.star.uno.RuntimeExceptionError during invoking function createDialog in module file:///Users/XY/Library/Application%20Support/LibreOffice/4/user/uno_packages/cache/uno_packages/lumitw10.tmp_/OCAL-0.1.3.oxt/python/OpenClipartDialog.py (: createDialog() missing 1 required positional argument: 'Event'
/Applications/LibreOffice.app/Contents/program/pythonscript.py:830 in function invoke() [ret = self.func( *args )]
)

Leif Lodahl said...

New version here: http://dl.dropbox.com/u/9348527/OCAL.oxt fixes the runtime error.