Add example for Draw
This commit is contained in:
parent
afa0b53a1a
commit
f15cebd20e
|
@ -5,7 +5,7 @@ __pycache__/
|
||||||
conf.py
|
conf.py
|
||||||
files/
|
files/
|
||||||
|
|
||||||
docs/
|
doc/build
|
||||||
source/source/
|
source/source/
|
||||||
|
|
||||||
# Virtualenv
|
# Virtualenv
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
v 0.15.0 [-may-2021]
|
||||||
|
- Add autostyle for Writer tables
|
||||||
|
|
||||||
|
|
||||||
v 0.14.0 [13-apr-2021]
|
v 0.14.0 [13-apr-2021]
|
||||||
- Fix: Get paragraphs in Writer
|
- Fix: Get paragraphs in Writer
|
||||||
- Add support for data pilots
|
- Add support for data pilots
|
||||||
|
|
|
@ -13,6 +13,7 @@ Welcome to ZAZ's documentation!
|
||||||
main/intro
|
main/intro
|
||||||
main/config
|
main/config
|
||||||
main/easymacro
|
main/easymacro
|
||||||
|
main/examples
|
||||||
|
|
||||||
|
|
||||||
Indices and tables
|
Indices and tables
|
||||||
|
|
|
@ -1,165 +0,0 @@
|
||||||
|
|
||||||
**easymacro.py** it's a library for easily develop macros en LibreOffice con
|
|
||||||
Python. It is an abstraction layer between the extensive and complex LibreOffice
|
|
||||||
API UNO and your code.
|
|
||||||
|
|
||||||
Probably, your will be more happy if used it. :)
|
|
||||||
|
|
||||||
You can used **easymacro.py** with any extension or directly in your macros.
|
|
||||||
|
|
||||||
|
|
||||||
1) Tools
|
|
||||||
--------
|
|
||||||
|
|
||||||
1.1) For debug
|
|
||||||
^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
**INFO_DEBUG**
|
|
||||||
^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
Show info debug, show in message box.
|
|
||||||
|
|
||||||
If you have any problem in your code, you can `open issue`_ in this project,
|
|
||||||
always copy the information of INFO_DEBUG in your ticket.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
import easymacro as app
|
|
||||||
|
|
||||||
def info():
|
|
||||||
app.msgbox(INFO_DEBUG)
|
|
||||||
return
|
|
||||||
|
|
||||||
Show in shell.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
import easymacro as app
|
|
||||||
|
|
||||||
def info():
|
|
||||||
app.debug(INFO_DEBUG)
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
**Log error**
|
|
||||||
^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
Show error message in shell.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
import easymacro as app
|
|
||||||
|
|
||||||
def error():
|
|
||||||
msg = 'My error 500'
|
|
||||||
app.error(msg)
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
**Log debug**
|
|
||||||
^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
Show debug message in shell.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
import easymacro as app
|
|
||||||
|
|
||||||
def error():
|
|
||||||
msg = 'Verify this data...'
|
|
||||||
app.debug(msg)
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
**Log info**
|
|
||||||
^^^^^^^^^^^^
|
|
||||||
|
|
||||||
Show info message in shell.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
import easymacro as app
|
|
||||||
|
|
||||||
def error():
|
|
||||||
msg = 'Start process...'
|
|
||||||
app.info(msg)
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
**Log to file**
|
|
||||||
^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
Save log to file, automatic add date and time.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
import easymacro as app
|
|
||||||
|
|
||||||
def log():
|
|
||||||
app.save_log('/home/mau/log.txt', 'PyUNO')
|
|
||||||
app.save_log('/home/mau/log.txt', app.INFO_DEBUG)
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
**Message box**
|
|
||||||
^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
Show any data in message box
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
import easymacro as app
|
|
||||||
|
|
||||||
def message():
|
|
||||||
|
|
||||||
msg = 'Please, save the planet'
|
|
||||||
app.msgbox(msg)
|
|
||||||
|
|
||||||
msg = ('one', 2, 'three')
|
|
||||||
app.msgbox(msg)
|
|
||||||
|
|
||||||
msg = {'name': 'Teresa'}
|
|
||||||
app.msgbox(msg)
|
|
||||||
|
|
||||||
app.msgbox(app)
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
**Catch exceptions**
|
|
||||||
^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
Sometimes, for difficult errors, you can catch exceptions.
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
import easymacro as app
|
|
||||||
|
|
||||||
@app.catch_exception
|
|
||||||
def test():
|
|
||||||
r = 1 / 0
|
|
||||||
return
|
|
||||||
|
|
||||||
And not, not used you this function in production.
|
|
||||||
|
|
||||||
|
|
||||||
**Call MRI**
|
|
||||||
^^^^^^^^^^^^
|
|
||||||
|
|
||||||
`MRI`_ is the better extension for debug any object in LibreOffice, you need
|
|
||||||
install before call it.
|
|
||||||
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
import easymacro as app
|
|
||||||
|
|
||||||
def error():
|
|
||||||
obj = app.active
|
|
||||||
app.mri(obj)
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
.. _MRI: https://github.com/hanya/MRI
|
|
||||||
.. _open issue: https://git.cuates.net/elmau/zaz/issues
|
|
|
@ -1,200 +1,165 @@
|
||||||
|
|
||||||
1.2) Tools
|
**easymacro.py** it's a library for easily develop macros en LibreOffice con
|
||||||
^^^^^^^^^^
|
Python. It is an abstraction layer between the extensive and complex LibreOffice
|
||||||
|
API UNO and your code.
|
||||||
|
|
||||||
Remember, always import library.
|
Probably, your will be more happy if used it. :)
|
||||||
|
|
||||||
|
You can used **easymacro.py** with any extension or directly in your macros.
|
||||||
|
|
||||||
|
|
||||||
|
1) Tools
|
||||||
|
--------
|
||||||
|
|
||||||
|
1.1) For debug
|
||||||
|
^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
**INFO_DEBUG**
|
||||||
|
^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Show info debug, show in message box.
|
||||||
|
|
||||||
|
If you have any problem in your code, you can `open issue`_ in this project,
|
||||||
|
always copy the information of INFO_DEBUG in your ticket.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
import easymacro as app
|
import easymacro as app
|
||||||
|
|
||||||
|
def info():
|
||||||
|
app.msgbox(INFO_DEBUG)
|
||||||
|
return
|
||||||
|
|
||||||
**Info from PC**
|
Show in shell.
|
||||||
^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
* Operate system
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
app.msgbox(app.OS)
|
import easymacro as app
|
||||||
|
|
||||||
* Current user
|
def info():
|
||||||
|
app.debug(INFO_DEBUG)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
**Log error**
|
||||||
|
^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Show error message in shell.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
app.msgbox(app.USER)
|
import easymacro as app
|
||||||
|
|
||||||
* Name PC
|
def error():
|
||||||
|
msg = 'My error 500'
|
||||||
|
app.error(msg)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
**Log debug**
|
||||||
|
^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Show debug message in shell.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
app.msgbox(app.PC)
|
import easymacro as app
|
||||||
|
|
||||||
* Name desktop, only GNU/Linux
|
def error():
|
||||||
|
msg = 'Verify this data...'
|
||||||
|
app.debug(msg)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
**Log info**
|
||||||
|
^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Show info message in shell.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
app.msgbox(app.DESKTOP)
|
import easymacro as app
|
||||||
|
|
||||||
* Language
|
def error():
|
||||||
|
msg = 'Start process...'
|
||||||
|
app.info(msg)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
**Log to file**
|
||||||
|
^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Save log to file, automatic add date and time.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
app.msgbox(app.LANG)
|
import easymacro as app
|
||||||
|
|
||||||
* Language with variant
|
def log():
|
||||||
|
app.save_log('/home/mau/log.txt', 'PyUNO')
|
||||||
|
app.save_log('/home/mau/log.txt', app.INFO_DEBUG)
|
||||||
|
return
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
app.msgbox(app.LANGUAGE)
|
|
||||||
|
|
||||||
* Application name
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
app.msgbox(app.NAME)
|
|
||||||
|
|
||||||
* Application version
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
app.msgbox(app.VERSION)
|
|
||||||
|
|
||||||
* In Windows
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
app.msgbox(app.IS_WIN)
|
|
||||||
|
|
||||||
|
|
||||||
**Message box**
|
**Message box**
|
||||||
^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
.. code-block:: python
|
Show any data in message box
|
||||||
|
|
||||||
app.msgbox(app.IS_WIN, 'My Macro')
|
|
||||||
|
|
||||||
|
|
||||||
**Show warning**
|
|
||||||
^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
message = 'Caution, this action is dangerous'
|
import easymacro as app
|
||||||
title = 'My App'
|
|
||||||
app.warning(message, title)
|
def message():
|
||||||
|
|
||||||
|
msg = 'Please, save the planet'
|
||||||
|
app.msgbox(msg)
|
||||||
|
|
||||||
|
msg = ('one', 2, 'three')
|
||||||
|
app.msgbox(msg)
|
||||||
|
|
||||||
|
msg = {'name': 'Teresa'}
|
||||||
|
app.msgbox(msg)
|
||||||
|
|
||||||
|
app.msgbox(app)
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
**Show error box**
|
**Catch exceptions**
|
||||||
^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
message = 'ERROR: Contact technical support'
|
|
||||||
title = 'My App'
|
|
||||||
app.errorbox(message, title)
|
|
||||||
|
|
||||||
|
|
||||||
**Make question**
|
|
||||||
^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
message = 'Is easy Python?'
|
|
||||||
title = 'My App'
|
|
||||||
result = app.question(message, title)
|
|
||||||
app.msgbox(result)
|
|
||||||
|
|
||||||
|
|
||||||
**InputBox**
|
|
||||||
^^^^^^^^^^^^
|
|
||||||
|
|
||||||
* Normal data
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
message = 'Type your name'
|
|
||||||
default = ''
|
|
||||||
title = 'My App'
|
|
||||||
|
|
||||||
result = app.inputbox(message, default, title)
|
|
||||||
app.msgbox(result)
|
|
||||||
|
|
||||||
* Private data
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
message = 'Type your password'
|
|
||||||
default = ''
|
|
||||||
title = 'My App'
|
|
||||||
echochar = "*"
|
|
||||||
|
|
||||||
result = app.inputbox(message, default, title, echochar)
|
|
||||||
app.msgbox(result)
|
|
||||||
|
|
||||||
|
|
||||||
**Create instances**
|
|
||||||
^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
* Instances without context
|
Sometimes, for difficult errors, you can catch exceptions.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
toolkit = app.create_instance("com.sun.star.awt.Toolkit")
|
import easymacro as app
|
||||||
|
|
||||||
|
@app.catch_exception
|
||||||
|
def test():
|
||||||
|
r = 1 / 0
|
||||||
|
return
|
||||||
|
|
||||||
|
And not, not used you this function in production.
|
||||||
|
|
||||||
|
|
||||||
|
**Call MRI**
|
||||||
|
^^^^^^^^^^^^
|
||||||
|
|
||||||
|
`MRI`_ is the better extension for debug any object in LibreOffice, you need
|
||||||
|
install before call it.
|
||||||
|
|
||||||
* Instances with context
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
service = 'com.sun.star.awt.DialogProvider2'
|
import easymacro as app
|
||||||
dialog = app.create_instance(service, True)
|
|
||||||
|
|
||||||
|
def error():
|
||||||
**Paths and files**
|
obj = app.active
|
||||||
^^^^^^^^^^^^^^^^^^^
|
app.mri(obj)
|
||||||
|
return
|
||||||
* Get info path
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
path = '/home/mau/myfile.ods'
|
|
||||||
p = app.paths(path)
|
|
||||||
|
|
||||||
app.debug(p.path)
|
|
||||||
app.debug(p.file_name)
|
|
||||||
app.debug(p.name)
|
|
||||||
app.debug(p.ext)
|
|
||||||
app.debug(p.url)
|
|
||||||
|
|
||||||
Or get information in a tuple
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
path = '/home/mau/myfile.ods'
|
|
||||||
p = app.paths(path)
|
|
||||||
|
|
||||||
app.debug(p.info)
|
|
||||||
|
|
||||||
* Get path home
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
path = app.paths.home
|
|
||||||
app.debug(path)
|
|
||||||
|
|
||||||
* Get path documents
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
path = app.paths.documents
|
|
||||||
app.debug(path)
|
|
||||||
|
|
||||||
* Get path temp
|
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
path = app.paths.temp_dir
|
|
||||||
app.debug(path)
|
|
||||||
|
|
||||||
|
|
||||||
.. _MRI: https://github.com/hanya/MRI
|
.. _MRI: https://github.com/hanya/MRI
|
||||||
|
.. _open issue: https://git.cuates.net/elmau/zaz/issues
|
||||||
|
|
|
@ -0,0 +1,200 @@
|
||||||
|
|
||||||
|
1.2) Tools
|
||||||
|
^^^^^^^^^^
|
||||||
|
|
||||||
|
Remember, always import library.
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
import easymacro as app
|
||||||
|
|
||||||
|
|
||||||
|
**Info from PC**
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
* Operate system
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
app.msgbox(app.OS)
|
||||||
|
|
||||||
|
* Current user
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
app.msgbox(app.USER)
|
||||||
|
|
||||||
|
* Name PC
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
app.msgbox(app.PC)
|
||||||
|
|
||||||
|
* Name desktop, only GNU/Linux
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
app.msgbox(app.DESKTOP)
|
||||||
|
|
||||||
|
* Language
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
app.msgbox(app.LANG)
|
||||||
|
|
||||||
|
* Language with variant
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
app.msgbox(app.LANGUAGE)
|
||||||
|
|
||||||
|
* Application name
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
app.msgbox(app.NAME)
|
||||||
|
|
||||||
|
* Application version
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
app.msgbox(app.VERSION)
|
||||||
|
|
||||||
|
* In Windows
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
app.msgbox(app.IS_WIN)
|
||||||
|
|
||||||
|
|
||||||
|
**Message box**
|
||||||
|
^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
app.msgbox(app.IS_WIN, 'My Macro')
|
||||||
|
|
||||||
|
|
||||||
|
**Show warning**
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
message = 'Caution, this action is dangerous'
|
||||||
|
title = 'My App'
|
||||||
|
app.warning(message, title)
|
||||||
|
|
||||||
|
|
||||||
|
**Show error box**
|
||||||
|
^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
message = 'ERROR: Contact technical support'
|
||||||
|
title = 'My App'
|
||||||
|
app.errorbox(message, title)
|
||||||
|
|
||||||
|
|
||||||
|
**Make question**
|
||||||
|
^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
message = 'Is easy Python?'
|
||||||
|
title = 'My App'
|
||||||
|
result = app.question(message, title)
|
||||||
|
app.msgbox(result)
|
||||||
|
|
||||||
|
|
||||||
|
**InputBox**
|
||||||
|
^^^^^^^^^^^^
|
||||||
|
|
||||||
|
* Normal data
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
message = 'Type your name'
|
||||||
|
default = ''
|
||||||
|
title = 'My App'
|
||||||
|
|
||||||
|
result = app.inputbox(message, default, title)
|
||||||
|
app.msgbox(result)
|
||||||
|
|
||||||
|
* Private data
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
message = 'Type your password'
|
||||||
|
default = ''
|
||||||
|
title = 'My App'
|
||||||
|
echochar = "*"
|
||||||
|
|
||||||
|
result = app.inputbox(message, default, title, echochar)
|
||||||
|
app.msgbox(result)
|
||||||
|
|
||||||
|
|
||||||
|
**Create instances**
|
||||||
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
* Instances without context
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
toolkit = app.create_instance("com.sun.star.awt.Toolkit")
|
||||||
|
|
||||||
|
* Instances with context
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
service = 'com.sun.star.awt.DialogProvider2'
|
||||||
|
dialog = app.create_instance(service, True)
|
||||||
|
|
||||||
|
|
||||||
|
**Paths and files**
|
||||||
|
^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
* Get info path
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
path = '/home/mau/myfile.ods'
|
||||||
|
p = app.paths(path)
|
||||||
|
|
||||||
|
app.debug(p.path)
|
||||||
|
app.debug(p.file_name)
|
||||||
|
app.debug(p.name)
|
||||||
|
app.debug(p.ext)
|
||||||
|
app.debug(p.url)
|
||||||
|
|
||||||
|
Or get information in a tuple
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
path = '/home/mau/myfile.ods'
|
||||||
|
p = app.paths(path)
|
||||||
|
|
||||||
|
app.debug(p.info)
|
||||||
|
|
||||||
|
* Get path home
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
path = app.paths.home
|
||||||
|
app.debug(path)
|
||||||
|
|
||||||
|
* Get path documents
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
path = app.paths.documents
|
||||||
|
app.debug(path)
|
||||||
|
|
||||||
|
* Get path temp
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
path = app.paths.temp_dir
|
||||||
|
app.debug(path)
|
||||||
|
|
||||||
|
|
||||||
|
.. _MRI: https://github.com/hanya/MRI
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
Examples for Draw
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
Save image
|
||||||
|
^^^^^^^^^^
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
def save_image():
|
||||||
|
doc = app.docs.new('draw', {'Hidden': True})
|
||||||
|
image = doc.paste()
|
||||||
|
path = '/home/mau/Pictures'
|
||||||
|
image.save(path)
|
||||||
|
doc.close()
|
||||||
|
app.msgbox('Image saved')
|
||||||
|
return
|
|
@ -2,7 +2,7 @@
|
||||||
Library easymacro.py
|
Library easymacro.py
|
||||||
====================
|
====================
|
||||||
|
|
||||||
.. include:: 00_tools.rst
|
|
||||||
.. include:: 01_tools.rst
|
.. include:: 01_tools.rst
|
||||||
|
.. include:: 02_tools.rst
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
|
||||||
|
Examples
|
||||||
|
========
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 2
|
||||||
|
:caption: Contents:
|
||||||
|
|
||||||
|
examples_calc.rst
|
||||||
|
examples_writer.rst
|
||||||
|
examples_draw.rst
|
||||||
|
examples_base.rst
|
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
Examples for Base
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
First
|
||||||
|
^^^^^
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
def _():
|
||||||
|
return
|
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
Examples for Calc
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
First
|
||||||
|
^^^^^^^^^^
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
def _():
|
||||||
|
return
|
|
@ -0,0 +1,27 @@
|
||||||
|
|
||||||
|
Examples for Draw
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
Save image
|
||||||
|
^^^^^^^^^^
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
def save_image():
|
||||||
|
# Target path
|
||||||
|
path = '/home/mau/Pictures'
|
||||||
|
|
||||||
|
# Open new hidden Draw doc
|
||||||
|
doc = app.docs.new('draw', {'Hidden': True})
|
||||||
|
|
||||||
|
# Paste image from clipboard and return
|
||||||
|
image = doc.paste()
|
||||||
|
|
||||||
|
# Save image
|
||||||
|
image.save(path)
|
||||||
|
|
||||||
|
# Close document
|
||||||
|
doc.close()
|
||||||
|
|
||||||
|
app.msgbox('Image saved')
|
||||||
|
return
|
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
Examples for Writer
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
First
|
||||||
|
^^^^^
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
def _():
|
||||||
|
return
|
Loading…
Reference in New Issue