Add documentation for application

This commit is contained in:
Mauricio Baeza 2021-06-19 22:47:36 -05:00
parent 79d44763f6
commit 89966c4b04
3 changed files with 50 additions and 5 deletions

View File

@ -25,9 +25,9 @@ Requirements
In:
* ArchLinux
* sudo pacman -S libreoffice-fresh-sdk
* ``sudo pacman -S libreoffice-fresh-sdk``
* Ubuntu 20.04+
* sudo apt install libreoffice-script-provider-python libreoffice-dev
* ``sudo apt install libreoffice-script-provider-python libreoffice-dev``
Installation

View File

@ -299,3 +299,48 @@ Json
app.msgbox(data)
Call Macros
^^^^^^^^^^^
You can any macro, for default call macros Python.
.. code-block:: python
def show_message():
app.msgbox(app.INFO_DEBUG)
return
def main(args=None):
args = {
'library': 'test',
'name': 'show_message',
}
app.call_macro(args)
return
Of course is better call directly if both macros are the same languaje, but, you can call macro in Basic too.
.. code-block:: vbnet
Sub show_message()
MsgBox "Basic from Python"
End Sub
Call from Python with.
.. code-block:: python
args = {
'language': 'Basic',
'library': 'Standard',
'module': 'Module1',
'name': 'show_message',
}
app.call_macro(args)
Execute macro in other thread
.. code-block:: python
app.call_macro(args, True)

View File

@ -557,10 +557,10 @@ def _struct_to_date(value):
def _get_url_script(args: dict):
library = args['library']
module = '.'
name = args['name']
language = args.get('language', 'Python')
location = args.get('location', 'user')
module = args.get('module', '.')
if language == 'Python':
module = '.py$'
@ -587,7 +587,7 @@ def _call_macro(args: dict):
return result
# ~ TODO
def call_macro(args, in_thread=False):
result = None
if in_thread:
@ -597,7 +597,7 @@ def call_macro(args, in_thread=False):
result = _call_macro(args)
return result
# ~ TODO
def run(command, capture=False, split=True):
if not split:
return subprocess.check_output(command, shell=True).decode()