|
|
|
@ -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,10 @@ from conf import (
|
|
|
|
|
log)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EASYMACRO_TMP = 'easymacro2.py'
|
|
|
|
|
EASYMACRO = 'easymacro.py'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LiboXML(object):
|
|
|
|
|
CONTEXT = {
|
|
|
|
|
'calc': 'com.sun.star.sheet.SpreadsheetDocument',
|
|
|
|
@ -549,7 +555,7 @@ def _update_files():
|
|
|
|
|
copyfile(source, target)
|
|
|
|
|
|
|
|
|
|
if FILES['easymacro']:
|
|
|
|
|
source = 'easymacro2.py'
|
|
|
|
|
source = EASYMACRO
|
|
|
|
|
target = _join(path_source, 'pythonpath', source)
|
|
|
|
|
copyfile(source, target)
|
|
|
|
|
|
|
|
|
@ -595,7 +601,7 @@ def _update_files():
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _new():
|
|
|
|
|
def _create():
|
|
|
|
|
if not _validate_new():
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
@ -617,7 +623,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 +698,6 @@ def _embed(args):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _locales(args):
|
|
|
|
|
EASYMACRO = 'easymacro2.py'
|
|
|
|
|
|
|
|
|
|
if args.files:
|
|
|
|
|
files = args.files.split(',')
|
|
|
|
|
else:
|
|
|
|
@ -726,8 +729,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_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):
|
|
|
|
|
if args.new:
|
|
|
|
|
_new(args)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
if args.update:
|
|
|
|
|
_update()
|
|
|
|
|
return
|
|
|
|
@ -740,8 +774,8 @@ def main(args):
|
|
|
|
|
_embed(args)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
if args.new:
|
|
|
|
|
_new()
|
|
|
|
|
if args.create:
|
|
|
|
|
_create()
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
if not _validate_update():
|
|
|
|
@ -762,9 +796,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)
|
|
|
|
|