21 conf.py
Mauricio Baeza edited this page 2020-11-07 21:08:22 -06:00

Locales

If your extension will be multi-language (recommended)

USE_LOCALES

  • Bool

Example:

USE_LOCALES = True

Domain for locales

The base name for generate files POT

DOMAIN

  • String

Example:

DOMAIN = 'base'

Path pyGetText

Absolute path for tool pygettext.py for generate POT.

PATH_PYGETTEXT

  • String

Example:

PATH_PYGETTEXT = '/usr/lib/python3.7/Tools/i18n/pygettext.py'

Author

Your information like author, one or more languages. This information it's show in the Extension manager.

PUBLISHER

  • Dictionary

Example:

PUBLISHER = {
    'en': {'text': 'Your name', 'link': 'https://your.page'},
    'es': {'text': 'Tu nombre', 'link': 'https://elmau.net'},
}

Extension icon

Path relative or absolute to original logo. Show in extension manager.

ICON

  • String

Example:

ICON=images/logo.png

License

The license for your extension, please, used free license.

LICENSE

  • String

Example:

LICENSE_EN = f"""This file is part of {NAME}.

    {NAME} is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    {NAME} is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with {NAME}.  If not, see <https://www.gnu.org/licenses/>.
"""
LICENSE_ES = LICENSE_EN

Information

Information of extension: Display name, description an license to show in installer.

INFO

  • Dictionary

Example:

INFO = {
    'en': {
        'display_name': 'Test Macro',
        'description': 'My great extension',
        'license': LICENSE_EN,
    },
    'es': {
        'display_name': 'Macro de Prueba',
        'description': 'Mi gran extensión',
        'license': LICENSE_ES,
    },
}

Parent menu

  • Where add extension menu, only two possible values: AddonMenu or OfficeMenuBar

AddonMenu: Show in menu Tools->Add-Ons OfficeMenuBar: Show in LibreOffice menu

PARENT

  • String

Example:

PARENT = 'OfficeMenuBar'

Main menu

Only for normal extension (TYPE_EXTENSION=1) and only if parent menu is OfficeMenuBar. Can be multi language.

MENU_MAIN

  • Dictionary

Example:

MENU_MAIN = {
    'en': 'My Extension',
    'es': 'Mi Extensión',
}

Menus

  • Each menu for show in parent menu.
    • title = Label showed, can be multi language.
    • argument = Argument to pass to extension.
    • context = In what applications show, if is blank, show in all.
    • icon = Icon to add, the icon should be in format BMP. The name should be NAME_16.bmp or NAME_26.bmp. Set only NAME in this property.
    • toolbar = It is True, add to new toolbar too, used same icon.
    • shortcut = Shortcut keyboard for this menu.

MENUS

  • Tuple of dictionaries

Example:

MENUS = (
    {
        'title': {'en': 'Option 1', 'es': 'Opción 1'},
        'argument': 'option1',
        'context': 'calc,writer',
        'icon': 'icon',
        'toolbar': True,
        'shortcut': 'T_SHIFT_MOD1_MOD2',
    },
)

Functions

Only for Add-in extension (TYPE_EXTENSION=2). Can be multi language.

  • The key of dictionary, is the same name of your function. Used exactly you used in your code.
    • displayname = Show in function wizard
    • description = Show in function wizard
    • parameters = Each parameters in your function.
      • key = Is the exactly name for parameter in your code function.
        • displayname = Show in function wizard
        • description = Show in function wizard

FUNCTIONS

  • Dictionary of dictionaries

Example:

FUNCTIONS = {
    'test': {
        'displayname': {'en': 'test', 'es': 'prueba'},
        'description': {'en': 'My test', 'es': 'Mi prueba'},
        'parameters': {
            'value': {
                'displayname': {'en': 'value', 'es': 'valor'},
                'description': {'en': 'The value', 'es': 'El valor'},
            },
        },
    },
}

PATHS

Paths for install and test.

idlc, include and remerge only used en TYPE_EXTENSION 2 or 3. idlc and path include is installed with LibreOffice SDK.

  • idlc for generate files urd
  • include path with files idl
  • remerge for generate files rdb

PATHS

  • Dictionary

Example:

# ~ Default program for test: --calc, --writer, --draw
PROGRAM = '--calc'
# ~ Path to file for test
FILE_TEST = ''

PATHS = {
    'idlc': '/usr/lib/libreoffice/sdk/bin/idlc',
    'include': '/usr/share/idl/libreoffice',
    'regmerge': '/usr/lib/libreoffice/program/regmerge',
    'soffice': ('soffice', PROGRAM, FILE_TEST),
    'install': ('unopkg', 'add', '-v', '-f', '-s'),
}