Make new extension

This commit is contained in:
Mauricio Baeza 2020-11-07 20:40:17 -06:00
parent d1dfdbf1a0
commit 08592083e7
2 changed files with 14 additions and 15 deletions

View File

@ -25,14 +25,15 @@ import logging
# ~ 3 = Calc addin
TYPE_EXTENSION = 1
# ~ Your great extension name, not used spaces
NAME = 'MyFirstExtension'
# ~ https://semver.org/
VERSION = '0.1.0'
# ~ Your great extension name, not used spaces
NAME = 'TestMacro'
# ~ Should be unique, used URL inverse
ID = 'org.myextension.test'
ID = 'org.myfirstextension'
# ~ If you extension will be multilanguage set: True
# ~ This feature used gettext, set pythonpath and easymacro in True
@ -42,6 +43,7 @@ USE_LOCALES = True
DOMAIN = 'base'
PATH_LOCALES = 'locales'
PATH_PYGETTEXT = '/usr/lib/python3.8/Tools/i18n/pygettext.py'
# ~ You can use PoEdit for update locales too
PATH_MSGMERGE = 'msgmerge'
@ -56,9 +58,6 @@ ICON = 'images/logo.png'
# ~ Name inside extensions
ICON_EXT = f'{NAME.lower()}.png'
# ~ For example
# ~ DEPENDENCIES_MINIMAL = '6.0'
DEPENDENCIES_MINIMAL = ''
# ~ Change for you favorite license
LICENSE_EN = f"""This file is part of {NAME}.
@ -80,12 +79,12 @@ LICENSE_ES = LICENSE_EN
INFO = {
'en': {
'display_name': 'Test Macro',
'display_name': 'My first extension',
'description': 'My great extension',
'license': LICENSE_EN,
},
'es': {
'display_name': 'Macro de Prueba',
'display_name': 'Mi primer extensión',
'description': 'Mi gran extensión',
'license': LICENSE_ES,
},

View File

@ -44,7 +44,8 @@ from conf import (
log)
EASYMACRO = 'easymacro2.py'
EASYMACRO_TMP = 'easymacro2.py'
EASYMACRO = 'easymacro.py'
class LiboXML(object):
@ -552,7 +553,7 @@ def _update_files():
copyfile(source, target)
if FILES['easymacro']:
source = 'easymacro.py'
source = EASYMACRO
target = _join(path_source, 'pythonpath', source)
copyfile(source, target)
@ -620,7 +621,6 @@ def _get_info_path(path):
def _zip_embed(source, files):
PATH = 'Scripts/python/'
EASYMACRO = 'easymacro2.py'
FILE_PYC = 'easymacro.pyc'
p, f, name, e = _get_info_path(source)
@ -696,8 +696,6 @@ def _embed(args):
def _locales(args):
EASYMACRO = 'easymacro.py'
if args.files:
files = args.files.split(',')
else:
@ -747,10 +745,12 @@ def _new(args):
path_logo = 'images/pymacros.png'
copyfile(path_logo, _join(path, 'images/logo.png'))
copyfile('zaz.py', _join(path, 'zaz.py'))
copyfile(EASYMACRO, _join(path, 'easymacro.py'))
copyfile(EASYMACRO_TMP, _join(path, 'easymacro.py'))
copyfile('conf.py.example', _join(path, 'conf.py'))
msg = 'Folders and files copy successfully for new extension'
msg = 'Folders and files copy successfully for new extension.'
log.info(msg)
msg = f'Change to folder: {path}'
log.info(msg)
return