Difference between revisions of "Extensions"
Line 62: | Line 62: | ||
</pre> | </pre> | ||
Will result in the following GUI being created: | Will result in the following GUI being created: | ||
[[Image:Extensions-radiobutton_gui_example.png]] | [[Image:Extensions-radiobutton_gui_example.png]] | ||
===i18n=== | ===i18n=== | ||
To allow the .inx files to fit snugly into Inkscape's i18n infrastructure some XML elements and attributes are prefixed with an underscore (_) character to indicate that the containing text should be marked for translation. | To allow the .inx files to fit snugly into Inkscape's i18n infrastructure some XML elements and attributes are prefixed with an underscore (_) character to indicate that the containing text should be marked for translation. |
Revision as of 15:10, 18 April 2008
This page is intended as a guide for providing new extensions for Inkscape. Currently the majority of extensions are provided as python scripts.
Extension types
The following extension types exist for Inkscape:
- input
- output
- effect
- path-effect - path effects are not currently implemented as extension but there is intention to migrate those over as entensions
Extension implementation
- Internal
- C++ implementation (directly in code)
- External
- scripts - written in python, perl or as system (console) scripts
- xslt transformations
- plugins - not fully implemented yet
Parameters
Extensions can be supplied with values obtained through easily definable parameters. Inkscape provides the basic GUI for user input. The following parameters are supported:
- integer
- string
- float
- boolean
- enum
- optiongroup
- colour
For the sake of the UI there are also the following two parameters that do not provide data to the extension but alter the user input GUI.
- description
- notebook
Extension Definition File (INX)
All extensions are defined through Inkscape Extension Definition Files (.inx) which are XML files in the
http://www.inkscape.org/namespace/inkscape/extension
namespace and described by the Relax NG available [here]
Structure
Examples
RadioButton example
The following mark-up:
<?xml version="1.0" encoding="UTF-8"?> <inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> <_name>RadioButton example</_name> <id>org.inkscape.effect.radiobuttontest</id> <param name="radio1" type="optiongroup" _gui-text="Select option: "> <option value="string1">translatable string 1</option> <option value="string2">string 2</option> <option value="string3">test 3!</option> </param> <param name="radio2" type="optiongroup" _gui-text="Select second option: "> <option value="string11">string1</option> <option value="string22">string2</option> <option>test3!</option> </param> <effect> <object-type>all</object-type> <effects-menu> <submenu _name="Developer Examples"/> </effects-menu> </effect> ... </inkscape-extension>
Will result in the following GUI being created:
i18n
To allow the .inx files to fit snugly into Inkscape's i18n infrastructure some XML elements and attributes are prefixed with an underscore (_) character to indicate that the containing text should be marked for translation.