Replace easymacro2 for easymacro

This commit is contained in:
Mauricio Baeza 2020-12-17 17:32:21 -06:00
parent 73c0a8e258
commit 8c659c8af9
8 changed files with 7758 additions and 70 deletions

2
.gitignore vendored
View File

@ -1,4 +1,6 @@
# ---> Python # ---> Python
*.po~
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
__pycache__/ __pycache__/
*.py[cod] *.py[cod]

View File

@ -20,7 +20,7 @@ Requirements:
#### but, don't make the mistake of many of *thinking only in gratis software* that so much damage has done to **Free Software**. #### but, don't make the mistake of many of *thinking only in gratis software* that so much damage has done to **Free Software**.
This extension have a cost of maintenance of 5 euros every year. This extension have a cost of maintenance of 1 euro every year.
BCH: `qztd3l00xle5tffdqvh2snvadkuau2ml0uqm4n875d` BCH: `qztd3l00xle5tffdqvh2snvadkuau2ml0uqm4n875d`

6616
easymacro.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
/home/mau/Projects/libre_office/zaz/source/easymacro2.py

Binary file not shown.

View File

@ -1,7 +1,7 @@
import uno import uno
import unohelper import unohelper
from com.sun.star.task import XJobExecutor from com.sun.star.task import XJobExecutor
import easymacro2 as app import easymacro as app
ID_EXTENSION = 'net.elmau.zaz.latex2svg' ID_EXTENSION = 'net.elmau.zaz.latex2svg'

56
zaz.py
View File

@ -4,6 +4,8 @@
# ~ This file is part of ZAZ. # ~ This file is part of ZAZ.
# ~ https://git.elmau.net/elmau/zaz
# ~ ZAZ is free software: you can redistribute it and/or modify # ~ ZAZ is free software: you can redistribute it and/or modify
# ~ it under the terms of the GNU General Public License as published by # ~ it under the terms of the GNU General Public License as published by
# ~ the Free Software Foundation, either version 3 of the License, or # ~ the Free Software Foundation, either version 3 of the License, or
@ -44,6 +46,10 @@ from conf import (
log) log)
EASYMACRO_TMP = 'easymacro2.py'
EASYMACRO = 'easymacro.py'
class LiboXML(object): class LiboXML(object):
CONTEXT = { CONTEXT = {
'calc': 'com.sun.star.sheet.SpreadsheetDocument', 'calc': 'com.sun.star.sheet.SpreadsheetDocument',
@ -549,7 +555,7 @@ def _update_files():
copyfile(source, target) copyfile(source, target)
if FILES['easymacro']: if FILES['easymacro']:
source = 'easymacro2.py' source = EASYMACRO
target = _join(path_source, 'pythonpath', source) target = _join(path_source, 'pythonpath', source)
copyfile(source, target) copyfile(source, target)
@ -595,7 +601,7 @@ def _update_files():
return return
def _new(): def _create():
if not _validate_new(): if not _validate_new():
return return
@ -617,7 +623,6 @@ def _get_info_path(path):
def _zip_embed(source, files): def _zip_embed(source, files):
PATH = 'Scripts/python/' PATH = 'Scripts/python/'
EASYMACRO = 'easymacro2.py'
FILE_PYC = 'easymacro.pyc' FILE_PYC = 'easymacro.pyc'
p, f, name, e = _get_info_path(source) p, f, name, e = _get_info_path(source)
@ -693,8 +698,6 @@ def _embed(args):
def _locales(args): def _locales(args):
EASYMACRO = 'easymacro2.py'
if args.files: if args.files:
files = args.files.split(',') files = args.files.split(',')
else: else:
@ -726,8 +729,39 @@ def _update():
return 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_TMP, _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): def main(args):
if args.new:
_new(args)
return
if args.update: if args.update:
_update() _update()
return return
@ -740,8 +774,8 @@ def main(args):
_embed(args) _embed(args)
return return
if args.new: if args.create:
_new() _create()
return return
if not _validate_update(): if not _validate_update():
@ -762,9 +796,13 @@ def main(args):
def _process_command_line_arguments(): def _process_command_line_arguments():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description='Make LibreOffice extensions') 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) 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) default=False, required=False)
parser.add_argument('-e', '--embed', dest='embed', action='store_true', parser.add_argument('-e', '--embed', dest='embed', action='store_true',
default=False, required=False) default=False, required=False)