Update zaz

This commit is contained in:
Mauricio Baeza 2020-12-24 21:07:33 -06:00
parent b3d8674a9e
commit 35d356a698
2 changed files with 53 additions and 19 deletions

17
conf.py
View File

@ -25,23 +25,24 @@ import logging
# ~ 3 = Calc addin
TYPE_EXTENSION = 1
# ~ https://semver.org/
VERSION = '0.7.0'
# ~ Your great extension name, not used spaces
NAME = 'ZAZBarCode'
# ~ https://semver.org/
VERSION = '0.7.0'
# ~ Should be unique, used URL inverse
ID = 'net.elmau.zaz.BarCode'
# ~ If you extension will be multilanguage set: True
# ~ This feature used gettext, set pythonpath and easymacro in True
# ~ Yu can used PoEdit for edit PO files and generate MO files.
# ~ You can used PoEdit for edit PO files and generate MO files.
# ~ https://poedit.net/
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 +57,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}.
@ -290,9 +288,8 @@ FILES = {
# ~ URLs for update for example
# ~ URL_XML_UPDATE = 'https://gitlab.com/USER/PROYECT/raw/BRANCH/FOLDERs/FILE_NAME'
URL_BASE = 'https://gitlab.com/mauriciobaeza/zaz-barcode/raw/master/files/'
URL_XML_UPDATE = URL_BASE + FILES['update']
URL_OXT = URL_BASE + FILES['oxt']
URL_XML_UPDATE = ''
URL_OXT = ''
# ~ Default program for test: --calc, --writer, --draw

55
zaz.py Normal file → Executable file
View File

@ -4,6 +4,8 @@
# ~ This file is part of ZAZ.
# ~ https://git.elmau.net/elmau/zaz
# ~ ZAZ 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
@ -44,6 +46,9 @@ from conf import (
log)
EASYMACRO = 'easymacro.py'
class LiboXML(object):
CONTEXT = {
'calc': 'com.sun.star.sheet.SpreadsheetDocument',
@ -549,7 +554,7 @@ def _update_files():
copyfile(source, target)
if FILES['easymacro']:
source = 'easymacro.py'
source = EASYMACRO
target = _join(path_source, 'pythonpath', source)
copyfile(source, target)
@ -595,7 +600,7 @@ def _update_files():
return
def _new():
def _create():
if not _validate_new():
return
@ -617,7 +622,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)
@ -693,8 +697,6 @@ def _embed(args):
def _locales(args):
EASYMACRO = 'easymacro.py'
if args.files:
files = args.files.split(',')
else:
@ -726,8 +728,39 @@ def _update():
return
def _new(args):
if not args.target:
msg = 'Add argument target: -t PATH_TARGET'
log.error(msg)
return
if not args.name:
msg = 'Add argument name: -n name-new-extension'
log.error(msg)
return
path = _join(args.target, args.name)
_mkdir(path)
_mkdir(_join(path, 'files'))
_mkdir(_join(path, 'images'))
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('conf.py.example', _join(path, 'conf.py'))
msg = 'Folders and files copy successfully for new extension.'
log.info(msg)
msg = f'Change to folder: {path}'
log.info(msg)
return
def main(args):
if args.new:
_new(args)
return
if args.update:
_update()
return
@ -740,8 +773,8 @@ def main(args):
_embed(args)
return
if args.new:
_new()
if args.create:
_create()
return
if not _validate_update():
@ -762,9 +795,13 @@ def main(args):
def _process_command_line_arguments():
parser = argparse.ArgumentParser(
description='Make LibreOffice extensions')
parser.add_argument('-i', '--install', dest='install', action='store_true',
parser.add_argument('-new', '--new', dest='new', action='store_true',
default=False, required=False)
parser.add_argument('-n', '--new', dest='new', action='store_true',
parser.add_argument('-t', '--target', dest='target', default='')
parser.add_argument('-n', '--name', dest='name', default='', required=False)
parser.add_argument('-c', '--create', dest='create', action='store_true',
default=False, required=False)
parser.add_argument('-i', '--install', dest='install', action='store_true',
default=False, required=False)
parser.add_argument('-e', '--embed', dest='embed', action='store_true',
default=False, required=False)