Add tools for debug

This commit is contained in:
Mauricio Baeza 2021-02-08 22:16:06 -06:00
parent aae4aaa385
commit 3f42d770fa
12 changed files with 286 additions and 29 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,12 +1,27 @@
For debug **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** **INFO_DEBUG**
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
Show info debug, show in message box. 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
@ -57,7 +72,7 @@ Show debug message in shell.
**Log info** **Log info**
^^^^^^^^^^^^^ ^^^^^^^^^^^^
Show info message in shell. Show info message in shell.
@ -71,10 +86,69 @@ Show info message in shell.
return 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** **Call MRI**
^^^^^^^^^^^^ ^^^^^^^^^^^^
`MRI`_ is the better extension for debug any object in LibreOffice. `MRI`_ is the better extension for debug any object in LibreOffice, you need
install before call it.
.. code-block:: python .. code-block:: python
@ -88,3 +162,4 @@ Show info message in shell.
.. _MRI: https://github.com/hanya/MRI .. _MRI: https://github.com/hanya/MRI
.. _open issue: https://git.cuates.net/elmau/zaz/issues

View File

@ -2,9 +2,6 @@
Library easymacro.py Library easymacro.py
==================== ====================
Tools
-----
.. include:: 00_tools.rst .. include:: 00_tools.rst

View File

@ -48,7 +48,7 @@
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference internal" href="main/easymacro.html">Library easymacro.py</a><ul> <li class="toctree-l1"><a class="reference internal" href="main/easymacro.html">Library easymacro.py</a><ul>
<li class="toctree-l2"><a class="reference internal" href="main/easymacro.html#tools">Tools</a></li> <li class="toctree-l2"><a class="reference internal" href="main/easymacro.html#tools">1) Tools</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>

View File

@ -5,7 +5,7 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>For debug &#8212; ZAZ documentation</title> <title>1) Tools &#8212; ZAZ documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/alabaster.css" type="text/css" /> <link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script> <script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
@ -30,12 +30,21 @@
<div class="body" role="main"> <div class="body" role="main">
<div class="section" id="for-debug"> <p><strong>easymacro.py</strong> its a library for easily develop macros en LibreOffice con
<h1>For debug<a class="headerlink" href="#for-debug" title="Permalink to this headline"></a></h1> Python. It is an abstraction layer between the extensive and complex LibreOffice
API UNO and your code.</p>
<p>Probably, your will be more happy if used it. :)</p>
<p>You can used <strong>easymacro.py</strong> with any extension or directly in your macros.</p>
<div class="section" id="tools">
<h1>1) Tools<a class="headerlink" href="#tools" title="Permalink to this headline"></a></h1>
<div class="section" id="for-debug">
<h2>1.1) For debug<a class="headerlink" href="#for-debug" title="Permalink to this headline"></a></h2>
</div> </div>
<div class="section" id="info-debug"> <div class="section" id="info-debug">
<h1><strong>INFO_DEBUG</strong><a class="headerlink" href="#info-debug" title="Permalink to this headline"></a></h1> <h2><strong>INFO_DEBUG</strong><a class="headerlink" href="#info-debug" title="Permalink to this headline"></a></h2>
<p>Show info debug, show in message box.</p> <p>Show info debug, show in message box.</p>
<p>If you have any problem in your code, you can <a class="reference external" href="https://git.cuates.net/elmau/zaz/issues">open issue</a> in this project,
always copy the information of INFO_DEBUG in your ticket.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">easymacro</span> <span class="k">as</span> <span class="nn">app</span> <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">easymacro</span> <span class="k">as</span> <span class="nn">app</span>
<span class="k">def</span> <span class="nf">info</span><span class="p">():</span> <span class="k">def</span> <span class="nf">info</span><span class="p">():</span>
@ -53,7 +62,7 @@
</div> </div>
</div> </div>
<div class="section" id="log-error"> <div class="section" id="log-error">
<h1><strong>Log error</strong><a class="headerlink" href="#log-error" title="Permalink to this headline"></a></h1> <h2><strong>Log error</strong><a class="headerlink" href="#log-error" title="Permalink to this headline"></a></h2>
<p>Show error message in shell.</p> <p>Show error message in shell.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">easymacro</span> <span class="k">as</span> <span class="nn">app</span> <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">easymacro</span> <span class="k">as</span> <span class="nn">app</span>
@ -65,7 +74,7 @@
</div> </div>
</div> </div>
<div class="section" id="log-debug"> <div class="section" id="log-debug">
<h1><strong>Log debug</strong><a class="headerlink" href="#log-debug" title="Permalink to this headline"></a></h1> <h2><strong>Log debug</strong><a class="headerlink" href="#log-debug" title="Permalink to this headline"></a></h2>
<p>Show debug message in shell.</p> <p>Show debug message in shell.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">easymacro</span> <span class="k">as</span> <span class="nn">app</span> <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">easymacro</span> <span class="k">as</span> <span class="nn">app</span>
@ -77,7 +86,7 @@
</div> </div>
</div> </div>
<div class="section" id="log-info"> <div class="section" id="log-info">
<h1><strong>Log info</strong><a class="headerlink" href="#log-info" title="Permalink to this headline"></a></h1> <h2><strong>Log info</strong><a class="headerlink" href="#log-info" title="Permalink to this headline"></a></h2>
<p>Show info message in shell.</p> <p>Show info message in shell.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">easymacro</span> <span class="k">as</span> <span class="nn">app</span> <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">easymacro</span> <span class="k">as</span> <span class="nn">app</span>
@ -88,9 +97,57 @@
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="section" id="log-to-file">
<h2><strong>Log to file</strong><a class="headerlink" href="#log-to-file" title="Permalink to this headline"></a></h2>
<p>Save log to file, automatic add date and time.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">easymacro</span> <span class="k">as</span> <span class="nn">app</span>
<span class="k">def</span> <span class="nf">log</span><span class="p">():</span>
<span class="n">app</span><span class="o">.</span><span class="n">save_log</span><span class="p">(</span><span class="s1">&#39;/home/mau/log.txt&#39;</span><span class="p">,</span> <span class="s1">&#39;PyUNO&#39;</span><span class="p">)</span>
<span class="n">app</span><span class="o">.</span><span class="n">save_log</span><span class="p">(</span><span class="s1">&#39;/home/mau/log.txt&#39;</span><span class="p">,</span> <span class="n">app</span><span class="o">.</span><span class="n">INFO_DEBUG</span><span class="p">)</span>
<span class="k">return</span>
</pre></div>
</div>
</div>
<div class="section" id="message-box">
<h2><strong>Message box</strong><a class="headerlink" href="#message-box" title="Permalink to this headline"></a></h2>
<p>Show any data in message box</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">easymacro</span> <span class="k">as</span> <span class="nn">app</span>
<span class="k">def</span> <span class="nf">message</span><span class="p">():</span>
<span class="n">msg</span> <span class="o">=</span> <span class="s1">&#39;Please, save the planet&#39;</span>
<span class="n">app</span><span class="o">.</span><span class="n">msgbox</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
<span class="n">msg</span> <span class="o">=</span> <span class="p">(</span><span class="s1">&#39;one&#39;</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="s1">&#39;three&#39;</span><span class="p">)</span>
<span class="n">app</span><span class="o">.</span><span class="n">msgbox</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
<span class="n">msg</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;Teresa&#39;</span><span class="p">}</span>
<span class="n">app</span><span class="o">.</span><span class="n">msgbox</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
<span class="n">app</span><span class="o">.</span><span class="n">msgbox</span><span class="p">(</span><span class="n">app</span><span class="p">)</span>
<span class="k">return</span>
</pre></div>
</div>
</div>
<div class="section" id="catch-exceptions">
<h2><strong>Catch exceptions</strong><a class="headerlink" href="#catch-exceptions" title="Permalink to this headline"></a></h2>
<p>Sometimes, for difficult errors, you can catch exceptions.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">easymacro</span> <span class="k">as</span> <span class="nn">app</span>
<span class="nd">@app</span><span class="o">.</span><span class="n">catch_exception</span>
<span class="k">def</span> <span class="nf">test</span><span class="p">():</span>
<span class="n">r</span> <span class="o">=</span> <span class="mi">1</span> <span class="o">/</span> <span class="mi">0</span>
<span class="k">return</span>
</pre></div>
</div>
<p>And not, not used you this function in production.</p>
</div>
<div class="section" id="call-mri"> <div class="section" id="call-mri">
<h1><strong>Call MRI</strong><a class="headerlink" href="#call-mri" title="Permalink to this headline"></a></h1> <h2><strong>Call MRI</strong><a class="headerlink" href="#call-mri" title="Permalink to this headline"></a></h2>
<p><a class="reference external" href="https://github.com/hanya/MRI">MRI</a> is the better extension for debug any object in LibreOffice.</p> <p><a class="reference external" href="https://github.com/hanya/MRI">MRI</a> is the better extension for debug any object in LibreOffice, you need
install before call it.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">easymacro</span> <span class="k">as</span> <span class="nn">app</span> <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">easymacro</span> <span class="k">as</span> <span class="nn">app</span>
<span class="k">def</span> <span class="nf">error</span><span class="p">():</span> <span class="k">def</span> <span class="nf">error</span><span class="p">():</span>
@ -99,6 +156,7 @@
<span class="k">return</span> <span class="k">return</span>
</pre></div> </pre></div>
</div> </div>
</div>
</div> </div>

View File

@ -33,14 +33,21 @@
<div class="section" id="library-easymacro-py"> <div class="section" id="library-easymacro-py">
<h1>Library easymacro.py<a class="headerlink" href="#library-easymacro-py" title="Permalink to this headline"></a></h1> <h1>Library easymacro.py<a class="headerlink" href="#library-easymacro-py" title="Permalink to this headline"></a></h1>
<p><strong>easymacro.py</strong> its 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.</p>
<p>Probably, your will be more happy if used it. :)</p>
<p>You can used <strong>easymacro.py</strong> with any extension or directly in your macros.</p>
<div class="section" id="tools"> <div class="section" id="tools">
<h2>Tools<a class="headerlink" href="#tools" title="Permalink to this headline"></a></h2> <h2>1) Tools<a class="headerlink" href="#tools" title="Permalink to this headline"></a></h2>
<div class="section" id="for-debug"> <div class="section" id="for-debug">
<h3>For debug<a class="headerlink" href="#for-debug" title="Permalink to this headline"></a></h3> <h3>1.1) For debug<a class="headerlink" href="#for-debug" title="Permalink to this headline"></a></h3>
</div> </div>
<div class="section" id="info-debug"> <div class="section" id="info-debug">
<h3><strong>INFO_DEBUG</strong><a class="headerlink" href="#info-debug" title="Permalink to this headline"></a></h3> <h3><strong>INFO_DEBUG</strong><a class="headerlink" href="#info-debug" title="Permalink to this headline"></a></h3>
<p>Show info debug, show in message box.</p> <p>Show info debug, show in message box.</p>
<p>If you have any problem in your code, you can <a class="reference external" href="https://git.cuates.net/elmau/zaz/issues">open issue</a> in this project,
always copy the information of INFO_DEBUG in your ticket.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">easymacro</span> <span class="k">as</span> <span class="nn">app</span> <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">easymacro</span> <span class="k">as</span> <span class="nn">app</span>
<span class="k">def</span> <span class="nf">info</span><span class="p">():</span> <span class="k">def</span> <span class="nf">info</span><span class="p">():</span>
@ -93,9 +100,57 @@
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="section" id="log-to-file">
<h3><strong>Log to file</strong><a class="headerlink" href="#log-to-file" title="Permalink to this headline"></a></h3>
<p>Save log to file, automatic add date and time.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">easymacro</span> <span class="k">as</span> <span class="nn">app</span>
<span class="k">def</span> <span class="nf">log</span><span class="p">():</span>
<span class="n">app</span><span class="o">.</span><span class="n">save_log</span><span class="p">(</span><span class="s1">&#39;/home/mau/log.txt&#39;</span><span class="p">,</span> <span class="s1">&#39;PyUNO&#39;</span><span class="p">)</span>
<span class="n">app</span><span class="o">.</span><span class="n">save_log</span><span class="p">(</span><span class="s1">&#39;/home/mau/log.txt&#39;</span><span class="p">,</span> <span class="n">app</span><span class="o">.</span><span class="n">INFO_DEBUG</span><span class="p">)</span>
<span class="k">return</span>
</pre></div>
</div>
</div>
<div class="section" id="message-box">
<h3><strong>Message box</strong><a class="headerlink" href="#message-box" title="Permalink to this headline"></a></h3>
<p>Show any data in message box</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">easymacro</span> <span class="k">as</span> <span class="nn">app</span>
<span class="k">def</span> <span class="nf">message</span><span class="p">():</span>
<span class="n">msg</span> <span class="o">=</span> <span class="s1">&#39;Please, save the planet&#39;</span>
<span class="n">app</span><span class="o">.</span><span class="n">msgbox</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
<span class="n">msg</span> <span class="o">=</span> <span class="p">(</span><span class="s1">&#39;one&#39;</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="s1">&#39;three&#39;</span><span class="p">)</span>
<span class="n">app</span><span class="o">.</span><span class="n">msgbox</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
<span class="n">msg</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="s1">&#39;Teresa&#39;</span><span class="p">}</span>
<span class="n">app</span><span class="o">.</span><span class="n">msgbox</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>
<span class="n">app</span><span class="o">.</span><span class="n">msgbox</span><span class="p">(</span><span class="n">app</span><span class="p">)</span>
<span class="k">return</span>
</pre></div>
</div>
</div>
<div class="section" id="catch-exceptions">
<h3><strong>Catch exceptions</strong><a class="headerlink" href="#catch-exceptions" title="Permalink to this headline"></a></h3>
<p>Sometimes, for difficult errors, you can catch exceptions.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">easymacro</span> <span class="k">as</span> <span class="nn">app</span>
<span class="nd">@app</span><span class="o">.</span><span class="n">catch_exception</span>
<span class="k">def</span> <span class="nf">test</span><span class="p">():</span>
<span class="n">r</span> <span class="o">=</span> <span class="mi">1</span> <span class="o">/</span> <span class="mi">0</span>
<span class="k">return</span>
</pre></div>
</div>
<p>And not, not used you this function in production.</p>
</div>
<div class="section" id="call-mri"> <div class="section" id="call-mri">
<h3><strong>Call MRI</strong><a class="headerlink" href="#call-mri" title="Permalink to this headline"></a></h3> <h3><strong>Call MRI</strong><a class="headerlink" href="#call-mri" title="Permalink to this headline"></a></h3>
<p><a class="reference external" href="https://github.com/hanya/MRI">MRI</a> is the better extension for debug any object in LibreOffice.</p> <p><a class="reference external" href="https://github.com/hanya/MRI">MRI</a> is the better extension for debug any object in LibreOffice, you need
install before call it.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">easymacro</span> <span class="k">as</span> <span class="nn">app</span> <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">easymacro</span> <span class="k">as</span> <span class="nn">app</span>
<span class="k">def</span> <span class="nf">error</span><span class="p">():</span> <span class="k">def</span> <span class="nf">error</span><span class="p">():</span>
@ -130,7 +185,7 @@
<li class="toctree-l1"><a class="reference internal" href="intro.html">Introduction</a></li> <li class="toctree-l1"><a class="reference internal" href="intro.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="config.html">Configuration</a></li> <li class="toctree-l1"><a class="reference internal" href="config.html">Configuration</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Library easymacro.py</a><ul> <li class="toctree-l1 current"><a class="current reference internal" href="#">Library easymacro.py</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#tools">Tools</a></li> <li class="toctree-l2"><a class="reference internal" href="#tools">1) Tools</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>

Binary file not shown.

View File

@ -1 +1 @@
Search.setIndex({docnames:["index","main/00_tools","main/config","main/easymacro","main/intro"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":3,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":2,"sphinx.domains.rst":2,"sphinx.domains.std":1,sphinx:56},filenames:["index.rst","main/00_tools.rst","main/config.rst","main/easymacro.rst","main/intro.rst"],objects:{},objnames:{},objtypes:{},terms:{"2021":4,"500":[1,3],"extensi\u00f3n":2,"final":4,"function":4,"import":[1,3],"new":[2,4],"opci\u00f3n":2,"public":2,"return":[1,3],"true":2,FOR:2,For:2,Ons:2,The:2,Used:2,With:4,absolut:2,activ:[1,3],add:[2,4],addin:[2,4],addonmenu:2,all:2,along:2,alt:2,ani:[1,2,3],app:[1,3],applic:2,apt:4,archlinux:4,argument:2,automat:2,automaticali:[],base:2,basic:4,befor:2,better:[1,3],bin:2,blank:2,bmp:2,bool:2,box:[1,3],calc:[2,4],can:[2,4],clone:4,code:2,com:[],compon:[2,4],compress:4,conf:2,configur:0,content:0,context:2,copi:[2,4],correctli:2,cours:4,creat:[2,4],ctrl:2,cuat:4,current:2,data:[1,3],def:[1,3],descript:2,detail:2,dev:4,develop:[2,4],dictionari:2,directori:4,displai:2,display_nam:2,displaynam:2,distribut:2,domain:4,don:4,done:4,download:4,draw:2,each:2,easymacro:[0,1],edit:2,either:2,elmau:[2,4],error:[],even:2,exactli:2,exampl:2,extens:[0,1,3],extensionnam:2,file:4,file_test:2,first:0,fit:2,folder:2,forget:4,format:2,foundat:2,free:2,fresh:4,from:4,gener:[2,4],git:4,gitlab:[],gnu:2,gran:2,great:2,have:2,home:2,hope:2,http:[2,4],i18n:2,idl:2,idlc:2,imag:2,impli:2,impress:2,includ:2,index:0,info:[2,4],info_debug:[],inform:[],instal:[0,2],integ:2,intern:2,introduct:0,invers:2,kei:2,keyboard:2,label:2,languag:2,later:2,lib:2,librari:0,libreoffic:[1,2,3,4],libreofric:[],license_:2,license_en:2,like:2,link:2,local:4,log:[],logo:2,look:2,macro:[2,4],make:4,manag:2,mau:2,mauriciobaeza:[],menu_main:2,merchant:2,messag:[1,3],modifi:2,modul:0,more:2,move:[2,4],msg:[1,3],msgbox:[1,3],multi:2,myfirstextens:4,myfirstextension_v0:4,mygreatextens:2,name_16:2,name_26:2,net:[2,4],nombr:2,normal:2,now:4,obj:[1,3],object:[1,3],ods:2,officemenubar:2,one:2,onli:2,open:2,option1:2,option:2,org:2,overview:0,oxt:4,pacman:4,page:[0,2],paramet:0,part:2,particular:2,pass:2,path_pygettext:2,pleas:2,png:2,possibl:2,pot:[2,4],process:[1,3],project:[2,4],properti:2,provid:4,prueba:2,publish:2,purpos:2,python3:2,python:4,rapid:4,rdb:2,receiv:2,recomend:[],recommend:[2,4],redistribut:2,regmerg:2,rel:2,remerg:2,repositori:4,requir:0,same:2,script:4,sdk:[2,4],search:0,see:2,semant:2,set:2,share:2,shell:[1,3],shift:2,shortcut:2,should:2,show:[1,2,3],soffic:2,softwar:2,sourc:4,space:2,start:[1,2,3,4],string:2,successfulli:4,sucesfulli:[],sudo:4,support:4,t_shift_mod1_mod2:2,term:2,test:4,testext:[],text:2,thi:[1,2,3,4],titl:2,too:2,tool:[0,2],toolbar:2,tupl:2,two:2,type_extens:2,ubuntu:4,under:2,uniqu:2,unopkg:[2,4],urd:2,url:2,use:2,use_local:2,used:[2,4],useful:2,user:4,usr:2,valor:2,valu:2,verifi:[1,3],vim:2,want:2,warranti:2,what:2,when:2,where:2,without:2,wizard:2,writer:2,www:2,you:[2,4],your:2,yournam:2,zaz:[2,4]},titles:["Welcome to ZAZ\u2019s documentation!","For debug","Configuration","Library easymacro.py","Introduction"],titleterms:{"default":2,"function":2,"new":[],For:[1,3],author:2,calc:[],call:[1,3],configur:2,creat:[],current:[],debug:[1,3],document:0,domain:2,easymacro:3,error:[1,3],extens:[2,4],file:2,first:4,icon:2,indic:0,info:[1,3],info_debug:[1,3],inform:2,instal:4,introduct:4,librari:3,licens:2,local:2,log:[1,3],main:2,menu:2,mri:[1,3],name:2,overview:4,paramet:2,parent:2,path:2,program:2,pygettext:2,requir:4,tabl:0,test:2,tool:3,type:2,version:2,welcom:0,zaz:0}}) Search.setIndex({docnames:["index","main/00_tools","main/config","main/easymacro","main/intro"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":3,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":2,"sphinx.domains.rst":2,"sphinx.domains.std":1,sphinx:56},filenames:["index.rst","main/00_tools.rst","main/config.rst","main/easymacro.rst","main/intro.rst"],objects:{},objnames:{},objtypes:{},terms:{"2021":4,"500":[1,3],"abstract":[1,3],"extensi\u00f3n":2,"final":4,"function":[1,3,4],"import":[1,3],"new":[2,4],"opci\u00f3n":2,"public":2,"return":[1,3],"true":2,And:[1,3],FOR:2,For:2,Ons:2,The:2,Used:2,With:4,absolut:2,activ:[1,3],add:[1,2,3,4],addin:[2,4],addonmenu:2,all:2,along:2,alt:2,alwai:[1,3],ani:[1,2,3],api:[1,3],app:[1,3],applic:2,apt:4,archlinux:4,argument:2,automat:[1,2,3],automaticali:[],base:2,basic:4,befor:[1,2,3],better:[1,3],between:[1,3],bin:2,blank:2,bmp:2,bool:2,box:[],calc:[2,4],can:[1,2,3,4],catch_except:[1,3],clone:4,code:[1,2,3],com:[],complex:[1,3],compon:[2,4],compress:4,con:[1,3],conf:2,configur:0,content:0,context:2,copi:[1,2,3,4],correctli:2,cours:4,creat:[2,4],ctrl:2,cuat:4,current:2,data:[1,3],date:[1,3],def:[1,3],descript:2,detail:2,dev:4,develop:[1,2,3,4],dictionari:2,difficult:[1,3],directli:[1,3],directori:4,displai:2,display_nam:2,displaynam:2,distribut:2,domain:4,don:4,done:4,download:4,draw:2,each:2,easili:[1,3],easymacro:[0,1],edit:2,either:2,elmau:[2,4],error:[],even:2,exactli:2,exampl:2,extens:[0,1,3],extensionnam:2,file:4,file_test:2,first:0,fit:2,folder:2,forget:4,format:2,foundat:2,free:2,fresh:4,from:4,gener:[2,4],git:4,gitlab:[],gnu:2,gran:2,great:2,happi:[1,3],have:[1,2,3],home:[1,2,3],hope:2,http:[2,4],i18n:2,idl:2,idlc:2,imag:2,impli:2,impress:2,includ:2,index:0,info:[2,4],info_debug:[],inform:[1,3],instal:[0,1,2,3],integ:2,intern:2,introduct:0,invers:2,issu:[1,3],kei:2,keyboard:2,label:2,languag:2,later:2,layer:[1,3],lib:2,librari:[0,1],libreoffic:[1,2,3,4],libreofric:[],license_:2,license_en:2,like:2,link:2,local:4,log:[],logo:2,look:2,macro:[1,2,3,4],make:4,manag:2,mau:[1,2,3],mauriciobaeza:[],menu_main:2,merchant:2,messag:[],modifi:2,modul:0,more:[1,2,3],move:[2,4],msg:[1,3],msgbox:[1,3],multi:2,myfirstextens:4,myfirstextension_v0:4,mygreatextens:2,name:[1,3],name_16:2,name_26:2,need:[1,3],net:[2,4],nombr:2,normal:2,now:4,obj:[1,3],object:[1,3],ods:2,officemenubar:2,one:[1,2,3],onli:2,open:[1,2,3],option1:2,option:2,org:2,overview:0,oxt:4,pacman:4,page:[0,2],paramet:0,part:2,particular:2,pass:2,path_pygettext:2,planet:[1,3],pleas:[1,2,3],png:2,possibl:2,pot:[2,4],probabl:[1,3],problem:[1,3],process:[1,3],product:[1,3],project:[1,2,3,4],properti:2,provid:4,prueba:2,publish:2,purpos:2,python3:2,python:[1,3,4],pyuno:[1,3],rapid:4,rdb:2,receiv:2,recomend:[],recommend:[2,4],redistribut:2,regmerg:2,rel:2,remerg:2,repositori:4,requir:0,same:2,save:[1,3],save_log:[1,3],script:4,sdk:[2,4],search:0,see:2,semant:2,set:2,share:2,shell:[1,3],shift:2,shortcut:2,should:2,show:[1,2,3],soffic:2,softwar:2,sometim:[1,3],sourc:4,space:2,start:[1,2,3,4],string:2,successfulli:4,sucesfulli:[],sudo:4,support:4,t_shift_mod1_mod2:2,teresa:[1,3],term:2,test:[1,3,4],testext:[],text:2,thi:[1,2,3,4],three:[1,3],ticket:[1,3],time:[1,3],titl:2,too:2,tool:[0,2],toolbar:2,tupl:2,two:2,txt:[1,3],type_extens:2,ubuntu:4,under:2,uniqu:2,uno:[1,3],unopkg:[2,4],urd:2,url:2,use:2,use_local:2,used:[1,2,3,4],useful:2,user:4,usr:2,valor:2,valu:2,verifi:[1,3],vim:2,want:2,warranti:2,what:2,when:2,where:2,without:2,wizard:2,writer:2,www:2,you:[1,2,3,4],your:[1,2,3],yournam:2,zaz:[2,4]},titles:["Welcome to ZAZ\u2019s documentation!","1) Tools","Configuration","Library easymacro.py","Introduction"],titleterms:{"catch":[1,3],"default":2,"function":2,"new":[],For:[1,3],author:2,box:[1,3],calc:[],call:[1,3],configur:2,creat:[],current:[],debug:[1,3],document:0,domain:2,easymacro:3,error:[1,3],except:[1,3],extens:[2,4],file:[1,2,3],first:4,icon:2,indic:0,info:[1,3],info_debug:[1,3],inform:2,instal:4,introduct:4,librari:3,licens:2,local:2,log:[1,3],main:2,menu:2,messag:[1,3],mri:[1,3],name:2,overview:4,paramet:2,parent:2,path:2,program:2,pygettext:2,requir:4,tabl:0,test:2,tool:[1,3],type:2,version:2,welcom:0,zaz:0}})

View File

@ -1,12 +1,27 @@
For debug **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** **INFO_DEBUG**
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
Show info debug, show in message box. 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
@ -57,7 +72,7 @@ Show debug message in shell.
**Log info** **Log info**
^^^^^^^^^^^^^ ^^^^^^^^^^^^
Show info message in shell. Show info message in shell.
@ -71,10 +86,69 @@ Show info message in shell.
return 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** **Call MRI**
^^^^^^^^^^^^ ^^^^^^^^^^^^
`MRI`_ is the better extension for debug any object in LibreOffice. `MRI`_ is the better extension for debug any object in LibreOffice, you need
install before call it.
.. code-block:: python .. code-block:: python
@ -88,3 +162,4 @@ Show info message in shell.
.. _MRI: https://github.com/hanya/MRI .. _MRI: https://github.com/hanya/MRI
.. _open issue: https://git.cuates.net/elmau/zaz/issues

View File

@ -2,9 +2,6 @@
Library easymacro.py Library easymacro.py
==================== ====================
Tools
-----
.. include:: 00_tools.rst .. include:: 00_tools.rst