

pythonįrom import XJobExecutorĬlass TestButton ( unohelper.Base, XJobExecutor ):ĭesktop = ( ".Desktop", self.ctx ) print comments go to stdout (the command line terminal, usually).

To retest, you’ll need to close up oocalc and relaunch. Src/Interface.py : Also noteworthy is the interface definition code half-way down the script, and also the ‘ main’ code that allows one to test the extension quickly (in this case, it loads up a test workbook, and presses the button in the python file for inspection). :mdda_fns.oxt|src|Interface.py $Something?language =Python& location =user:uno_packages

Note that the menu is defined to work for spreadsheets (search for ‘Context’), so that it won’t appear if one is loading up a wordprocessing document. Much better to use the service: type, and create the named interface (note how .mdda_fn.TestButton is defined in the. But it gets very awkward to address these from the UI elements. Package/ : This directory houses stuff related to the overall package : see ‘description.xml’ Īddons.xcu : Here, I’ve commented out the toolbar and image stuff : I just want to put a top menubar entry.Īlso, see the : entry? That’s what’s required if you want to preprocess this as a script file (of the sort one would put in ~/.libreoffice/3/user/Scripts/python/. Arbitrary filename (listed in ‘manifest.xml’) Src/Interface.py : This is a Python file, which I’ve put in the interface code. The filename for this file is FIXED Īddons.xcu : Contains an XML description of how the extension is wired into the actual LibreOffice GUI : As a menu-item, ToolButton on a Toolbar etc Arbitrary filename (listed in ‘manifest.xml’)

Along with each file, the filetype identifies how it will be treated when the system loads it in. META-INF/manifest.xml : Contains a file listing of the extension package (which is rolled up into the zip/oxt. The essential files for anything to work are :ĭescription.xml : Contains overall information about the extension : names, descriptions, licensing, help information, upgrading, etc. Here’s the makefile, which is in the root of the package development tree : make Working backwards, I’ve called the extension mdda_fns.oxt. Here’s a pretty minimal setup for building an extension for LibreOffice in Python.
