Add documentation for application
This commit is contained in:
parent
79d44763f6
commit
89966c4b04
|
@ -25,9 +25,9 @@ Requirements
|
||||||
In:
|
In:
|
||||||
|
|
||||||
* ArchLinux
|
* ArchLinux
|
||||||
* sudo pacman -S libreoffice-fresh-sdk
|
* ``sudo pacman -S libreoffice-fresh-sdk``
|
||||||
* Ubuntu 20.04+
|
* Ubuntu 20.04+
|
||||||
* sudo apt install libreoffice-script-provider-python libreoffice-dev
|
* ``sudo apt install libreoffice-script-provider-python libreoffice-dev``
|
||||||
|
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
|
|
|
@ -299,3 +299,48 @@ Json
|
||||||
|
|
||||||
app.msgbox(data)
|
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)
|
||||||
|
|
|
@ -557,10 +557,10 @@ def _struct_to_date(value):
|
||||||
|
|
||||||
def _get_url_script(args: dict):
|
def _get_url_script(args: dict):
|
||||||
library = args['library']
|
library = args['library']
|
||||||
module = '.'
|
|
||||||
name = args['name']
|
name = args['name']
|
||||||
language = args.get('language', 'Python')
|
language = args.get('language', 'Python')
|
||||||
location = args.get('location', 'user')
|
location = args.get('location', 'user')
|
||||||
|
module = args.get('module', '.')
|
||||||
|
|
||||||
if language == 'Python':
|
if language == 'Python':
|
||||||
module = '.py$'
|
module = '.py$'
|
||||||
|
@ -587,7 +587,7 @@ def _call_macro(args: dict):
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
# ~ TODO
|
|
||||||
def call_macro(args, in_thread=False):
|
def call_macro(args, in_thread=False):
|
||||||
result = None
|
result = None
|
||||||
if in_thread:
|
if in_thread:
|
||||||
|
@ -597,7 +597,7 @@ def call_macro(args, in_thread=False):
|
||||||
result = _call_macro(args)
|
result = _call_macro(args)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
# ~ TODO
|
||||||
def run(command, capture=False, split=True):
|
def run(command, capture=False, split=True):
|
||||||
if not split:
|
if not split:
|
||||||
return subprocess.check_output(command, shell=True).decode()
|
return subprocess.check_output(command, shell=True).decode()
|
||||||
|
|
Loading…
Reference in New Issue