Skip to content

config.xml File Import Extension

Daniel Flassig edited this page Sep 16, 2024 · 20 revisions

A Function extension supplies a button in the PYTHA user interface. The user can invoke the function by pressing that button.

Declaration of a function extension in the config.xml:

<extension type="function">
    <entry-point>main</entry-point>
    <caption>Text of the Button</caption>
    <description>A short description of the function goes here.</description>
    <help-file>help.html</help-file>
</extension>

The following information can be supplied:

  • entry-point - (Mandatory) Name of the lua function that is invoked when the user invokes the import.
  • caption - (Mandatory) The text that is displayed in the Import menu. This text is translatable in the .xlif file.
  • file-filter - The file type (or file types) that the extension will handle. The extension must be written with a leading asterisk, e.g. as *.txt for a file with the extension "txt".
  • help-file - The name of a help file (should be .html or .pdf or .txt). This file is opened when the user right-clicks on the button and invokes help. This name of the file is translatable in the .xlif file if separate help files are supplied for different languages.

The entry-point is invoked with a file handle as an argument

import(file)
Parameter Type Description
file file_handle Handle of the file that the user has selected for import

Version Support:

---|--- Feature | Minimum PYTHA Version File Import Extension | V26

See also:

config.xml, Edit Extension, Attribute Extension, Anatomy of a Lua Api Plugin, Localization and Translation

Clone this wiki locally