Add connection for postgres and mariadb

This commit is contained in:
Mauricio Baeza 2021-06-20 23:28:38 -05:00
commit 205e08fc6e
40 changed files with 1823 additions and 308 deletions

View File

@ -1,3 +1,8 @@
v 0.16.0 [20-jun-2021]
- Add connection for postgres and mariadb
- Fix in call macro Basic
v 0.15.0 [05-jun-2021] v 0.15.0 [05-jun-2021]
- Add autostyle for Writer tables - Add autostyle for Writer tables

View File

@ -1 +1 @@
0.15.0 0.16.0

Binary file not shown.

View File

@ -3,31 +3,32 @@
# This file is distributed under the same license as the ZAZ package. # This file is distributed under the same license as the ZAZ package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2021. # FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
# #
#, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: ZAZ \n" "Project-Id-Version: ZAZ\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-02-05 22:20-0600\n" "POT-Creation-Date: 2021-02-05 22:20-0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: 2021-06-11 09:45-0500\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.0\n" "Generated-By: Babel 2.9.0\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
"X-Generator: Poedit 3.0\n"
#: ../../source/index.rst:9 #: ../../source/index.rst:9
msgid "Contents:" msgid "Contents:"
msgstr "" msgstr "Contenido:"
#: ../../source/index.rst:7 #: ../../source/index.rst:7
msgid "Welcome to ZAZ's documentation!" msgid "Welcome to ZAZ's documentation!"
msgstr "" msgstr "¡Bienvenido a la documentación de ZAZ!"
#: ../../source/index.rst:17 #: ../../source/index.rst:17
msgid "Indices and tables" msgid "Indices and tables"
msgstr "" msgstr "Índices y tablas"
#: ../../source/index.rst:19 #: ../../source/index.rst:19
msgid ":ref:`genindex`" msgid ":ref:`genindex`"
@ -40,4 +41,3 @@ msgstr ""
#: ../../source/index.rst:21 #: ../../source/index.rst:21
msgid ":ref:`search`" msgid ":ref:`search`"
msgstr "" msgstr ""

Binary file not shown.

View File

@ -0,0 +1,71 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2021, Mauricio Baeza
# This file is distributed under the same license as the ZAZ package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: ZAZ \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-06-11 12:28-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../source/main/application.rst:3
msgid "Application"
msgstr ""
#: ../../source/main/application.rst:5
msgid "Remember, always import library."
msgstr ""
#: ../../source/main/application.rst:13
msgid "Current doc"
msgstr ""
#: ../../source/main/application.rst:22
msgid "Iter docs"
msgstr ""
#: ../../source/main/application.rst:31
msgid "Count"
msgstr ""
#: ../../source/main/application.rst:40
msgid "Get by name"
msgstr ""
#: ../../source/main/application.rst:51
msgid "New"
msgstr ""
#: ../../source/main/application.rst:53
msgid "For default create new Calc document."
msgstr ""
#: ../../source/main/application.rst:61
msgid "For new Writer document."
msgstr ""
#: ../../source/main/application.rst:69 ../../source/main/application.rst:108
msgid "With arguments."
msgstr ""
#: ../../source/main/application.rst:80
msgid "Other documents."
msgstr ""
#: ../../source/main/application.rst:92
msgid "Open"
msgstr ""
#: ../../source/main/application.rst:100
msgid "While LibreOffice support format, you can open arbitrary file."
msgstr ""

View File

@ -0,0 +1,35 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2021, Mauricio Baeza
# This file is distributed under the same license as the ZAZ package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: ZAZ \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-06-11 12:28-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../source/main/calc.rst:3
msgid "Calc"
msgstr ""
#: ../../source/main/calc.rst:5
msgid "Remember, always import library."
msgstr ""
#: ../../source/main/calc.rst:13
msgid "Current doc"
msgstr ""
#: ../../source/main/calc.rst:22
msgid "Active sheet"
msgstr ""

Binary file not shown.

View File

@ -0,0 +1,431 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2021, Mauricio Baeza
# This file is distributed under the same license as the ZAZ package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: ZAZ \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-06-11 09:36-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../source/main/config.rst:3
msgid "Configuration"
msgstr ""
#: ../../source/main/config.rst:5
msgid "Create new extension:"
msgstr ""
#: ../../source/main/config.rst:7
msgid "``./zaz.py -new -t ~/projects -n MyGreatExtension``"
msgstr ""
#: ../../source/main/config.rst:10
msgid "Move to new folder:"
msgstr ""
#: ../../source/main/config.rst:12
msgid "``cd ~/projects/MyGreatExtension``"
msgstr ""
#: ../../source/main/config.rst:15
msgid "Edit file ``conf.py``"
msgstr ""
#: ../../source/main/config.rst:17
msgid "``vim conf.py``"
msgstr ""
#: ../../source/main/config.rst:21
msgid "Parameters"
msgstr ""
#: ../../source/main/config.rst:23
msgid ""
"**Configure correctly this options, before you start code your "
"extension.**"
msgstr ""
#: ../../source/main/config.rst:25
msgid "Only modify this options."
msgstr ""
#: ../../source/main/config.rst:29
msgid "Type extension"
msgstr ""
#: ../../source/main/config.rst:31
msgid "**TYPE_EXTENSION**"
msgstr ""
#: ../../source/main/config.rst:33
msgid "The type extension that you want develop."
msgstr ""
#: ../../source/main/config.rst:38
msgid "Integer"
msgstr ""
#: ../../source/main/config.rst:36
msgid "1 = Normal extension"
msgstr ""
#: ../../source/main/config.rst:37
msgid "2 = New components"
msgstr ""
#: ../../source/main/config.rst:38
msgid "3 = Calc addin"
msgstr ""
#: ../../source/main/config.rst:40 ../../source/main/config.rst:55
#: ../../source/main/config.rst:70 ../../source/main/config.rst:87
#: ../../source/main/config.rst:103 ../../source/main/config.rst:119
#: ../../source/main/config.rst:135 ../../source/main/config.rst:151
#: ../../source/main/config.rst:170 ../../source/main/config.rst:186
#: ../../source/main/config.rst:217 ../../source/main/config.rst:246
#: ../../source/main/config.rst:262 ../../source/main/config.rst:287
#: ../../source/main/config.rst:320 ../../source/main/config.rst:351
#: ../../source/main/config.rst:365 ../../source/main/config.rst:386
msgid "Example:"
msgstr ""
#: ../../source/main/config.rst:48
msgid "Version"
msgstr ""
#: ../../source/main/config.rst:50
msgid "**VERSION**"
msgstr ""
#: ../../source/main/config.rst:53 ../../source/main/config.rst:68
#: ../../source/main/config.rst:85 ../../source/main/config.rst:117
#: ../../source/main/config.rst:133 ../../source/main/config.rst:168
#: ../../source/main/config.rst:184 ../../source/main/config.rst:244
#: ../../source/main/config.rst:349 ../../source/main/config.rst:363
msgid "String"
msgstr ""
#: ../../source/main/config.rst:53
msgid "The current version of extension, look: `Semantic Versioning`_"
msgstr ""
#: ../../source/main/config.rst:63
msgid "Name"
msgstr ""
#: ../../source/main/config.rst:65
msgid "**NAME**"
msgstr ""
#: ../../source/main/config.rst:68
msgid "Your extension name, not used spaces."
msgstr ""
#: ../../source/main/config.rst:78
msgid "ID extension"
msgstr ""
#: ../../source/main/config.rst:80
msgid "The internal name for extension."
msgstr ""
#: ../../source/main/config.rst:82
msgid "**ID**"
msgstr ""
#: ../../source/main/config.rst:85
msgid "Should be unique, used URL inverse"
msgstr ""
#: ../../source/main/config.rst:95
msgid "Locales"
msgstr ""
#: ../../source/main/config.rst:97
msgid "If your extension will be multi-language (recommended)"
msgstr ""
#: ../../source/main/config.rst:99
msgid "**USE_LOCALES**"
msgstr ""
#: ../../source/main/config.rst:101
msgid "Bool"
msgstr ""
#: ../../source/main/config.rst:111
msgid "Domain for locales"
msgstr ""
#: ../../source/main/config.rst:113
msgid "The base name for generate files POT"
msgstr ""
#: ../../source/main/config.rst:115
msgid "**DOMAIN**"
msgstr ""
#: ../../source/main/config.rst:127
msgid "Path pyGetText"
msgstr ""
#: ../../source/main/config.rst:129
msgid "Absolute path for tool `pygettext.py` for generate POT."
msgstr ""
#: ../../source/main/config.rst:131
msgid "**PATH_PYGETTEXT**"
msgstr ""
#: ../../source/main/config.rst:143
msgid "Author"
msgstr ""
#: ../../source/main/config.rst:145
msgid ""
"Your information like author, one or more languages. This information is "
"displayed in the extension manager."
msgstr ""
#: ../../source/main/config.rst:147
msgid "**PUBLISHER**"
msgstr ""
#: ../../source/main/config.rst:149 ../../source/main/config.rst:215
#: ../../source/main/config.rst:260 ../../source/main/config.rst:384
msgid "Dictionary"
msgstr ""
#: ../../source/main/config.rst:162
msgid "Extension icon"
msgstr ""
#: ../../source/main/config.rst:164
msgid "Path relative or absolute to extension logo. Show in extension manager."
msgstr ""
#: ../../source/main/config.rst:166
msgid "**ICON**"
msgstr ""
#: ../../source/main/config.rst:178
msgid "License"
msgstr ""
#: ../../source/main/config.rst:180
msgid "The license for your extension, please, used free license."
msgstr ""
#: ../../source/main/config.rst:182
msgid "**LICENSE**"
msgstr ""
#: ../../source/main/config.rst:209
msgid "Information"
msgstr ""
#: ../../source/main/config.rst:211
msgid ""
"Information of extension: Display name, description and license to "
"displayed when install."
msgstr ""
#: ../../source/main/config.rst:213
msgid "**INFO**"
msgstr ""
#: ../../source/main/config.rst:236
msgid "Parent menu"
msgstr ""
#: ../../source/main/config.rst:238
msgid ""
"Only for normal extension (`TYPE_EXTENSION = 1`), where add extension "
"menu, only two possible values: **AddonMenu** or **OfficeMenuBar**"
msgstr ""
#: ../../source/main/config.rst:240
msgid "**PARENT**"
msgstr ""
#: ../../source/main/config.rst:243
msgid "**AddonMenu**: Show in menu Tools->Add-Ons"
msgstr ""
#: ../../source/main/config.rst:244
msgid "**OfficeMenuBar**: Show in LibreOffice menu"
msgstr ""
#: ../../source/main/config.rst:254
msgid "Main menu"
msgstr ""
#: ../../source/main/config.rst:256
msgid ""
"Only for normal extension (`TYPE_EXTENSION = 1`) and only if parent menu "
"is `OfficeMenuBar`. Can be multi language."
msgstr ""
#: ../../source/main/config.rst:258
msgid "**MENU_MAIN**"
msgstr ""
#: ../../source/main/config.rst:273
msgid "Menus"
msgstr ""
#: ../../source/main/config.rst:275
msgid "Each menu for show in parent menu."
msgstr ""
#: ../../source/main/config.rst:277
msgid "**MENUS**"
msgstr ""
#: ../../source/main/config.rst:285
msgid "Tuple of dictionaries"
msgstr ""
#: ../../source/main/config.rst:280
msgid "**title** = Label showed, can be multi language."
msgstr ""
#: ../../source/main/config.rst:281
msgid "**argument** = Argument to pass to extension, not use spaces."
msgstr ""
#: ../../source/main/config.rst:282
msgid "**context** = In what applications show, if is blank, show in all."
msgstr ""
#: ../../source/main/config.rst:283
msgid ""
"**icon** = Icon to add, the icon should be in format BMP. The name should"
" be NAME_16.bmp or NAME_26.bmp. Set only NAME in this property."
msgstr ""
#: ../../source/main/config.rst:284
msgid "**toolbar** = It is True, add to new toolbar too, used same icon."
msgstr ""
#: ../../source/main/config.rst:285
msgid ""
"**shortcut** = Shortcut keyboard for this menu. For `Shift+Ctrl+Alt+T` "
"used: `T_SHIFT_MOD1_MOD2`"
msgstr ""
#: ../../source/main/config.rst:304
msgid "Functions"
msgstr ""
#: ../../source/main/config.rst:306
msgid "Only for Add-in extension (`TYPE_EXTENSION = 2`). Can be multi language."
msgstr ""
#: ../../source/main/config.rst:308
msgid ""
"The key of dictionary, is the same name of your function. Used exactly "
"you used in your code."
msgstr ""
#: ../../source/main/config.rst:310
msgid "**FUNCTIONS**"
msgstr ""
#: ../../source/main/config.rst:318
msgid "Dictionary of dictionaries"
msgstr ""
#: ../../source/main/config.rst:313 ../../source/main/config.rst:317
msgid "**displayname** = Show in function wizard, multi language."
msgstr ""
#: ../../source/main/config.rst:314 ../../source/main/config.rst:318
msgid "**description** = Show in function wizard, multi language."
msgstr ""
#: ../../source/main/config.rst:318
msgid "**parameters** = Each parameters in your function."
msgstr ""
#: ../../source/main/config.rst:318
msgid "**key** = Is the exactly name for parameter in your code function."
msgstr ""
#: ../../source/main/config.rst:339
msgid "Default program"
msgstr ""
#: ../../source/main/config.rst:341 ../../source/main/config.rst:361
msgid "Optional. Open automatically when install and test."
msgstr ""
#: ../../source/main/config.rst:343
msgid "**PROGRAM**"
msgstr ""
#: ../../source/main/config.rst:346
msgid "--calc"
msgstr ""
#: ../../source/main/config.rst:347
msgid "--writer"
msgstr ""
#: ../../source/main/config.rst:348
msgid "--draw"
msgstr ""
#: ../../source/main/config.rst:349
msgid "--impress"
msgstr ""
#: ../../source/main/config.rst:359
msgid "File test"
msgstr ""
#: ../../source/main/config.rst:373
msgid "Paths"
msgstr ""
#: ../../source/main/config.rst:375
msgid ""
"Paths for install and test. `idlc`, `include` and `remerge` only used en "
"`TYPE_EXTENSION` 2 or 3. `idlc` and path `include` is installed with "
"LibreOffice SDK."
msgstr ""
#: ../../source/main/config.rst:377
msgid "**PATHS**"
msgstr ""
#: ../../source/main/config.rst:380
msgid "**idlc** for generate files urd."
msgstr ""
#: ../../source/main/config.rst:381
msgid "**include** path with files idl."
msgstr ""
#: ../../source/main/config.rst:382
msgid "**remerge** for generate files rdb."
msgstr ""
#: ../../source/main/config.rst:383
msgid "**soffice** for open LibreOffice."
msgstr ""
#: ../../source/main/config.rst:384
msgid "**install** for install extension."
msgstr ""

Binary file not shown.

View File

@ -0,0 +1,44 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2021, Mauricio Baeza
# This file is distributed under the same license as the ZAZ package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: ZAZ \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-06-11 09:36-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../source/main/easymacro.rst:11
msgid "Contents:"
msgstr ""
#: ../../source/main/easymacro.rst:3
msgid "Library easymacro.py"
msgstr ""
#: ../../source/main/easymacro.rst:5
msgid ""
"**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."
msgstr ""
#: ../../source/main/easymacro.rst:7
msgid "Probably, your will be more happy if used it. :)"
msgstr ""
#: ../../source/main/easymacro.rst:9
msgid ""
"You can used **easymacro.py** with any extension or directly in your "
"macros."
msgstr ""

Binary file not shown.

View File

@ -0,0 +1,31 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2021, Mauricio Baeza
# This file is distributed under the same license as the ZAZ package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: ZAZ \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-06-11 09:36-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../source/main/examples.rst:7
msgid "Contents:"
msgstr ""
#: ../../source/main/examples.rst:3
msgid "Examples"
msgstr ""
#: ../../source/main/examples.rst:5
msgid "Examples of macros used in production."
msgstr ""

Binary file not shown.

View File

@ -0,0 +1,39 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2021, Mauricio Baeza
# This file is distributed under the same license as the ZAZ package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: ZAZ \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-06-11 09:36-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../source/main/examples_app.rst:3
msgid "For Application"
msgstr ""
#: ../../source/main/examples_app.rst:6
msgid "Make custom menu"
msgstr ""
#: ../../source/main/examples_app.rst:8
msgid "Macro example in library ``mymacros``"
msgstr ""
#: ../../source/main/examples_app.rst:17
msgid "Insert custom menu in menu Tools in Calc."
msgstr ""
#: ../../source/main/examples_app.rst:40
msgid "Delete menu"
msgstr ""

Binary file not shown.

View File

@ -0,0 +1,47 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2021, Mauricio Baeza
# This file is distributed under the same license as the ZAZ package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: ZAZ \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-06-11 09:36-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../source/main/examples_base.rst:3
msgid "For Base"
msgstr ""
#: ../../source/main/examples_base.rst:5
msgid "You need install ``peewee``"
msgstr ""
#: ../../source/main/examples_base.rst:7
msgid "``pip install -U peewee``"
msgstr ""
#: ../../source/main/examples_base.rst:10
msgid "Create table"
msgstr ""
#: ../../source/main/examples_base.rst:44
msgid "Insert data"
msgstr ""
#: ../../source/main/examples_base.rst:67
msgid "Select data"
msgstr ""
#: ../../source/main/examples_base.rst:87
msgid "You can get tuples or dict::"
msgstr ""

Binary file not shown.

View File

@ -0,0 +1,31 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2021, Mauricio Baeza
# This file is distributed under the same license as the ZAZ package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: ZAZ \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-06-11 09:36-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../source/main/examples_calc.rst:3
msgid "For Calc"
msgstr ""
#: ../../source/main/examples_calc.rst:6
msgid "Data to cell"
msgstr ""
#: ../../source/main/examples_calc.rst:8
msgid "Automatic calculate size range."
msgstr ""

Binary file not shown.

View File

@ -0,0 +1,27 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2021, Mauricio Baeza
# This file is distributed under the same license as the ZAZ package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: ZAZ \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-06-11 09:36-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../source/main/examples_draw.rst:3
msgid "For Draw"
msgstr ""
#: ../../source/main/examples_draw.rst:6
msgid "Save image from clipboard"
msgstr ""

View File

@ -0,0 +1,27 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2021, Mauricio Baeza
# This file is distributed under the same license as the ZAZ package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: ZAZ \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-06-11 09:36-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../source/main/examples_writer.rst:3
msgid "For Writer"
msgstr ""
#: ../../source/main/examples_writer.rst:6
msgid "Set autostyle in table"
msgstr ""

Binary file not shown.

View File

@ -8,14 +8,14 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: ZAZ \n" "Project-Id-Version: ZAZ \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-02-05 22:20-0600\n" "POT-Creation-Date: 2021-06-11 09:36-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.0\n" "Generated-By: Babel 2.9.1\n"
#: ../../source/main/intro.rst:3 #: ../../source/main/intro.rst:3
msgid "Introduction" msgid "Introduction"
@ -63,59 +63,82 @@ msgstr ""
msgid "LibreOffice SDK, for new components and Add-In" msgid "LibreOffice SDK, for new components and Add-In"
msgstr "" msgstr ""
#: ../../source/main/intro.rst:27 #: ../../source/main/intro.rst:25
msgid "Installation" msgid "In:"
msgstr "" msgstr ""
#: ../../source/main/intro.rst:29 #: ../../source/main/intro.rst:27
msgid "Clone this repository (recomended) or download it." msgid "ArchLinux"
msgstr ""
#: ../../source/main/intro.rst:28
msgid "sudo pacman -S libreoffice-fresh-sdk"
msgstr "" msgstr ""
#: ../../source/main/intro.rst:31 #: ../../source/main/intro.rst:31
msgid "Ubuntu 20.04+"
msgstr ""
#: ../../source/main/intro.rst:30
msgid "sudo apt install libreoffice-script-provider-python libreoffice-dev"
msgstr ""
#: ../../source/main/intro.rst:34
msgid "Installation"
msgstr ""
#: ../../source/main/intro.rst:36
msgid "Clone this repository (recommended) or download it."
msgstr ""
#: ../../source/main/intro.rst:38
msgid "``git clone https://git.cuates.net/elmau/zaz.git``" msgid "``git clone https://git.cuates.net/elmau/zaz.git``"
msgstr "" msgstr ""
#: ../../source/main/intro.rst:33 #: ../../source/main/intro.rst:40
msgid "Move to." msgid "Move to."
msgstr "" msgstr ""
#: ../../source/main/intro.rst:35 #: ../../source/main/intro.rst:42
msgid "``cd zaz/source``" msgid "``cd zaz/source``"
msgstr "" msgstr ""
#: ../../source/main/intro.rst:37 #: ../../source/main/intro.rst:44
msgid "Start new extension." msgid "Start new extension."
msgstr "" msgstr ""
#: ../../source/main/intro.rst:39 #: ../../source/main/intro.rst:46
msgid "``./zaz.py -new -t ~/projects -n MyFirstExtension``" msgid "``./zaz.py -new -t ~/projects -n MyFirstExtension``"
msgstr "" msgstr ""
#: ../../source/main/intro.rst:43 #: ../../source/main/intro.rst:50
msgid "My first extension" msgid "My first extension"
msgstr "" msgstr ""
#: ../../source/main/intro.rst:45 #: ../../source/main/intro.rst:52
msgid "Move to:" msgid "Move to:"
msgstr "" msgstr ""
#: ../../source/main/intro.rst:47 #: ../../source/main/intro.rst:54
msgid "``cd ~/projects/MyFirstExtension``" msgid "``cd ~/projects/MyFirstExtension``"
msgstr "" msgstr ""
#: ../../source/main/intro.rst:49 #: ../../source/main/intro.rst:56
msgid "Create:" msgid "Create:"
msgstr "" msgstr ""
#: ../../source/main/intro.rst:51 #: ../../source/main/intro.rst:58
msgid "``python zaz.py -c``::" msgid "``python zaz.py -c``::"
msgstr "" msgstr ""
#: ../../source/main/intro.rst:60 #: ../../source/main/intro.rst:67
msgid "Install and test:" msgid "Install and test:"
msgstr "" msgstr ""
#: ../../source/main/intro.rst:62 #: ../../source/main/intro.rst:69
msgid "``python zaz.py -i``::" msgid "``python zaz.py -i``::"
msgstr "" msgstr ""
#~ msgid "Clone this repository (recomended) or download it."
#~ msgstr ""

Binary file not shown.

View File

@ -0,0 +1,131 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2021, Mauricio Baeza
# This file is distributed under the same license as the ZAZ package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: ZAZ \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-06-11 09:36-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../source/main/tools.rst:3
msgid "Tools"
msgstr ""
#: ../../source/main/tools.rst:5
msgid "Remember, always import library."
msgstr ""
#: ../../source/main/tools.rst:13
msgid "**Info from PC**"
msgstr ""
#: ../../source/main/tools.rst:15
msgid "Operate system"
msgstr ""
#: ../../source/main/tools.rst:21
msgid "Current user"
msgstr ""
#: ../../source/main/tools.rst:27
msgid "Name PC"
msgstr ""
#: ../../source/main/tools.rst:33
msgid "Name desktop, only GNU/Linux"
msgstr ""
#: ../../source/main/tools.rst:39
msgid "Language"
msgstr ""
#: ../../source/main/tools.rst:45
msgid "Language with variant"
msgstr ""
#: ../../source/main/tools.rst:51
msgid "Application name"
msgstr ""
#: ../../source/main/tools.rst:57
msgid "Application version"
msgstr ""
#: ../../source/main/tools.rst:63
msgid "In Windows"
msgstr ""
#: ../../source/main/tools.rst:71
msgid "**Message box**"
msgstr ""
#: ../../source/main/tools.rst:79
msgid "**Show warning**"
msgstr ""
#: ../../source/main/tools.rst:89
msgid "**Show error box**"
msgstr ""
#: ../../source/main/tools.rst:99
msgid "**Make question**"
msgstr ""
#: ../../source/main/tools.rst:110
msgid "**InputBox**"
msgstr ""
#: ../../source/main/tools.rst:112
msgid "Normal data"
msgstr ""
#: ../../source/main/tools.rst:123
msgid "Private data"
msgstr ""
#: ../../source/main/tools.rst:137
msgid "**Create instances**"
msgstr ""
#: ../../source/main/tools.rst:139
msgid "Instances without context"
msgstr ""
#: ../../source/main/tools.rst:145
msgid "Instances with context"
msgstr ""
#: ../../source/main/tools.rst:154
msgid "**Paths and files**"
msgstr ""
#: ../../source/main/tools.rst:156
msgid "Get info path"
msgstr ""
#: ../../source/main/tools.rst:169
msgid "Or get information in a tuple"
msgstr ""
#: ../../source/main/tools.rst:178
msgid "Get path home"
msgstr ""
#: ../../source/main/tools.rst:185
msgid "Get path documents"
msgstr ""
#: ../../source/main/tools.rst:192
msgid "Get path temp"
msgstr ""

View File

@ -0,0 +1,103 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2021, Mauricio Baeza
# This file is distributed under the same license as the ZAZ package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: ZAZ \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-06-11 09:36-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../source/main/tools_for_debug.rst:3
msgid "Tools for debug"
msgstr ""
#: ../../source/main/tools_for_debug.rst:6
msgid "**INFO_DEBUG**"
msgstr ""
#: ../../source/main/tools_for_debug.rst:8
msgid "Show info debug, show in message box."
msgstr ""
#: ../../source/main/tools_for_debug.rst:10
msgid ""
"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."
msgstr ""
#: ../../source/main/tools_for_debug.rst:21
msgid "Show in shell."
msgstr ""
#: ../../source/main/tools_for_debug.rst:33
msgid "**Log error**"
msgstr ""
#: ../../source/main/tools_for_debug.rst:35
msgid "Show error message in shell."
msgstr ""
#: ../../source/main/tools_for_debug.rst:48
msgid "**Log debug**"
msgstr ""
#: ../../source/main/tools_for_debug.rst:50
msgid "Show debug message in shell."
msgstr ""
#: ../../source/main/tools_for_debug.rst:63
msgid "**Log info**"
msgstr ""
#: ../../source/main/tools_for_debug.rst:65
msgid "Show info message in shell."
msgstr ""
#: ../../source/main/tools_for_debug.rst:78
msgid "**Log to file**"
msgstr ""
#: ../../source/main/tools_for_debug.rst:80
msgid "Save log to file, automatic add date and time."
msgstr ""
#: ../../source/main/tools_for_debug.rst:94
msgid "**Message box**"
msgstr ""
#: ../../source/main/tools_for_debug.rst:96
msgid "Show any data in message box"
msgstr ""
#: ../../source/main/tools_for_debug.rst:119
msgid "**Catch exceptions**"
msgstr ""
#: ../../source/main/tools_for_debug.rst:121
msgid "Sometimes, for difficult errors, you can catch exceptions."
msgstr ""
#: ../../source/main/tools_for_debug.rst:132
msgid "And not, not used you this function in production."
msgstr ""
#: ../../source/main/tools_for_debug.rst:136
msgid "**Call MRI**"
msgstr ""
#: ../../source/main/tools_for_debug.rst:138
msgid ""
"`MRI`_ is the better extension for debug any object in LibreOffice, you "
"need install before call it."
msgstr ""

View File

@ -0,0 +1,31 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2021, Mauricio Baeza
# This file is distributed under the same license as the ZAZ package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: ZAZ \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-06-11 12:28-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: ../../source/main/writer.rst:3
msgid "Writer"
msgstr ""
#: ../../source/main/writer.rst:5
msgid "Remember, always import library."
msgstr ""
#: ../../source/main/writer.rst:13
msgid "Current doc"
msgstr ""

View File

@ -1,200 +0,0 @@
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

View File

@ -0,0 +1,158 @@
Application
-----------
Remember, always import library.
.. code-block:: python
import easymacro as app
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)
* Get desktop
.. code-block:: python
desktop1 = app.create_instance('com.sun.star.frame.Desktop', True)
# ~ or
desktop2 = app.get_desktop()
app.msgbox(desktop1 == desktop2)
Current doc
^^^^^^^^^^^
.. code-block:: python
doc = app.active
app.msgbox(doc.title)
Iter docs
^^^^^^^^^
.. code-block:: python
for doc in app.docs:
app.msgbox(doc.title)
Count
^^^^^
.. code-block:: python
count = len(app.docs)
app.msgbox(count)
Get by name
^^^^^^^^^^^
.. code-block:: python
name = 'MyDoc.ods'
if name in app.docs:
doc = app.docs[name]
app.msgbox(doc.title)
New
^^^
For default create new Calc document.
.. code-block:: python
doc = app.docs.new()
app.msgbox(doc.type)
For new Writer document.
.. code-block:: python
doc = app.docs.new('writer')
app.msgbox(doc.type)
With arguments.
.. code-block:: python
args= {'Hidden': True}
doc = app.docs.new('writer', args)
msg = f'{doc.type} - {doc.title}'
app.msgbox(msg)
doc.visible = True
Other documents.
.. code-block:: python
doc = app.docs.new('draw')
app.msgbox(doc.type)
doc = app.docs.new('impress')
app.msgbox(doc.type)
Open
^^^^
.. code-block:: python
path = '/home/mau/MyDoc.ods'
doc = app.docs.open(path)
While LibreOffice support format, you can open arbitrary file.
.. code-block:: python
path = '/home/mau/example.xlsx'
doc = app.docs.open(path)
With arguments.
.. code-block:: python
path = '/home/mau/example.odt'
args = {'Password': 'letmein'}
doc = app.docs.open(path, args)
Call dispatch
^^^^^^^^^^^^^
You can call any `dispatch command`_ used only if property or method no exists in original object or in `easymacro.py`
.. code-block:: python
doc = app.active
command = '.uno:Gallery'
app.call_dispatch(doc, command)
.. _dispatch command: https://wiki.documentfoundation.org/Development/DispatchCommands

20
doc/source/main/base.rst Normal file
View File

@ -0,0 +1,20 @@
Base
----
Remember, always import library.
.. code-block:: python
import easymacro as app
New database
^^^^^^^^^^^^
.. code-block:: python
path = '/home/mau/db.odb'
db = app.doc.connect(path)
app.msgbox(db.type)

27
doc/source/main/calc.rst Normal file
View File

@ -0,0 +1,27 @@
Calc
----
Remember, always import library.
.. code-block:: python
import easymacro as app
Current doc
^^^^^^^^^^^
.. code-block:: python
doc = app.active
app.msgbox(doc.type)
Active sheet
^^^^^^^^^^^^
.. code-block:: python
sheet = app.active_sheet
app.msgbox(sheet.name)

View File

@ -2,7 +2,31 @@
Library easymacro.py Library easymacro.py
==================== ====================
.. include:: 01_tools.rst **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.
.. include:: 02_tools.rst
Probably, your will be more happy if used it. :)
You can used **easymacro.py** with any extension or directly in your macros.
**IMPORTANT**: Majority objects are custom objects, you can always get original UNO object with property `obj`
.. code-block:: python
doc = app.active
app.msgbox(doc)
app.msgbox(doc.obj)
.. toctree::
:maxdepth: 2
:caption: Contents:
tools_for_debug.rst
tools.rst
application.rst
calc.rst
writer.rst
base.rst

View File

@ -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

346
doc/source/main/tools.rst Normal file
View File

@ -0,0 +1,346 @@
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)
* In Mac
.. code-block:: python
app.msgbox(app.IS_MAC)
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)
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)
Date and times
^^^^^^^^^^^^^^
* Get today
.. code-block:: python
app.msgbox(app.today())
* Get now
.. code-block:: python
app.msgbox(app.now())
* Get now only time
.. code-block:: python
app.msgbox(app.now(True))
Thread
^^^^^^
You can execute any macro in thread
* Normal execution
.. code-block:: python
def show_time(seconds):
app.sleep(seconds)
app.msgbox(app.NAME)
return
def main(args=None):
show_time(5)
app.msgbox('Finish...')
return
* Run in thread
.. code-block:: python
@app.run_in_thread
def show_time(seconds):
app.sleep(seconds)
app.msgbox(app.NAME)
return
def main(args=None):
show_time(5)
app.msgbox('Finish...')
return
Dictionary <-> properties
^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: python
args = {
'Hidden': True,
'Password': 'letmein',
}
properties = app.dict_to_property(args)
app.msgbox(properties)
data = app.data_to_dict(properties)
app.msgbox(data)
Tuples or lists to dictionary
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: python
tuple_of_tuples = (
('Hidden', True),
('Password', 'letmein'),
)
data = app.data_to_dict(tuple_of_tuples)
app.msgbox(data)
list_of_lists = [
['Hidden', True],
['Password', 'letmein'],
]
data = app.data_to_dict(list_of_lists)
app.msgbox(data)
Json
^^^^
.. code-block:: python
data = {
'Hidden': True,
'Password': 'letmein',
}
json = app.json_dumps(data)
app.msgbox(json)
data = app.json_loads(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

@ -1,21 +1,9 @@
**easymacro.py** it's a library for easily develop macros en LibreOffice con Tools for debug
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. :) INFO_DEBUG
^^^^^^^^^^
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. Show info debug, show in message box.
@ -41,8 +29,8 @@ Show in shell.
return return
**Log error** Log error
^^^^^^^^^^^^^ ^^^^^^^^^
Show error message in shell. Show error message in shell.
@ -56,8 +44,8 @@ Show error message in shell.
return return
**Log debug** Log debug
^^^^^^^^^^^^^ ^^^^^^^^^
Show debug message in shell. Show debug message in shell.
@ -71,8 +59,8 @@ Show debug message in shell.
return return
**Log info** Log info
^^^^^^^^^^^^ ^^^^^^^^
Show info message in shell. Show info message in shell.
@ -86,8 +74,8 @@ Show info message in shell.
return return
**Log to file** Log to file
^^^^^^^^^^^^^^^ ^^^^^^^^^^^
Save log to file, automatic add date and time. Save log to file, automatic add date and time.
@ -102,8 +90,8 @@ Save log to file, automatic add date and time.
**Message box** Message box
^^^^^^^^^^^^^^^ ^^^^^^^^^^^
Show any data in message box Show any data in message box
@ -127,8 +115,8 @@ Show any data in message box
return return
**Catch exceptions** Catch exceptions
^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
Sometimes, for difficult errors, you can catch exceptions. Sometimes, for difficult errors, you can catch exceptions.
@ -144,8 +132,8 @@ Sometimes, for difficult errors, you can catch exceptions.
And not, not used you this function in production. And not, not used you this function in production.
**Call MRI** Call MRI
^^^^^^^^^^^^ ^^^^^^^^
`MRI`_ is the better extension for debug any object in LibreOffice, you need `MRI`_ is the better extension for debug any object in LibreOffice, you need
install before call it. install before call it.

View File

@ -0,0 +1,19 @@
Writer
------
Remember, always import library.
.. code-block:: python
import easymacro as app
Current doc
^^^^^^^^^^^
.. code-block:: python
doc = app.active
app.msgbox(doc.type)

View File

@ -491,10 +491,10 @@ def json_loads(data):
def data_to_dict(data): def data_to_dict(data):
if isinstance(data, tuple) and isinstance(data[0], tuple): if isinstance(data, (tuple, list)) and isinstance(data[0], (tuple, list)):
return _array_to_dict(data) return _array_to_dict(data)
if isinstance(data, tuple) and isinstance(data[0], (PropertyValue, NamedValue)): if isinstance(data, (tuple, list)) and isinstance(data[0], (PropertyValue, NamedValue)):
return _property_to_dict(data) return _property_to_dict(data)
return {} return {}
@ -507,6 +507,8 @@ def _get_dispatch() -> Any:
# ~ Used only if not exists in API # ~ Used only if not exists in API
def call_dispatch(frame: Any, url: str, args: dict={}) -> None: def call_dispatch(frame: Any, url: str, args: dict={}) -> None:
dispatch = _get_dispatch() dispatch = _get_dispatch()
if hasattr(frame, 'frame'):
frame = frame.frame
opt = dict_to_property(args) opt = dict_to_property(args)
dispatch.executeDispatch(frame, url, '', 0, opt) dispatch.executeDispatch(frame, url, '', 0, opt)
return return
@ -555,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$'
@ -595,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()
@ -2881,6 +2883,23 @@ class LOCalcRange(object):
self.obj.fillAuto(0, source) self.obj.fillAuto(0, source)
return return
def _cast(self, t, v):
if not t:
return v
if t == datetime.date:
nv = datetime.date.fromordinal(int(v) + DATE_OFFSET)
else:
nv = t(v)
return nv
def get_data(self, types):
values = [
[self._cast(types[i], v) for i, v in enumerate(row)]
for row in self.data
]
return values
class LOWriterStyles(object): class LOWriterStyles(object):
@ -3944,6 +3963,7 @@ class LODocs(object):
return doc return doc
def __len__(self): def __len__(self):
# ~ len(self._desktop.Components)
for i, _ in enumerate(self._desktop.Components): for i, _ in enumerate(self._desktop.Components):
pass pass
return i + 1 return i + 1
@ -3985,7 +4005,8 @@ class LODocs(object):
return _get_class_doc(doc) return _get_class_doc(doc)
def connect(self, path): def connect(self, path):
return LOBase(None, {'path': path}) db = LOBase(None, {'path': path})
return db
def _add_listeners(events, control, name=''): def _add_listeners(events, control, name=''):
@ -4713,6 +4734,13 @@ class UnoText(UnoBaseObject):
def value(self, value): def value(self, value):
self.model.Text = value self.model.Text = value
@property
def echochar(self):
return chr(self.model.EchoChar)
@echochar.setter
def echochar(self, value):
self.model.EchoChar = ord(value[0])
def validate(self): def validate(self):
return return
@ -5553,6 +5581,11 @@ class LODialog(object):
self.obj.dispose() self.obj.dispose()
return value return value
def set_values(self, data):
for k, v in data.items():
self._controls[k].value = v
return
class LOSheets(object): class LOSheets(object):
@ -6039,6 +6072,70 @@ class LOWindow(object):
return return
class LODBServer(object):
DRIVERS = {
'mysql': 'mysqlc',
'mariadb': 'mysqlc',
'postgres': 'postgresql:postgresql',
}
PORTS = {
'mysql': 3306,
'mariadb': 3306,
'postgres': 5432,
}
def __init__(self):
self._conn = None
self._error = ''
self._type = ''
def __str__(self):
return f'DB type {self._type}'
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, traceback):
self.disconnet()
@property
def is_connected(self):
return not bool(self._error)
@property
def error(self):
return self._error
def disconnet(self):
if not self._conn is None:
if not self._conn.isClosed():
self._conn.close()
self._conn.dispose()
def connect(self, args):
self._error = ''
self._type = args.get('type', 'postgres')
driver = self.DRIVERS[self._type]
server = args.get('server', 'localhost')
port = args.get('port', self.PORTS[self._type])
dbname = args.get('dbname', '')
user = args['user']
password = args['password']
data = {'user': user, 'password': password}
url = f'sdbc:{driver}://{server}:{port}/{dbname}'
args = dict_to_property(data)
manager = create_instance('com.sun.star.sdbc.DriverManager')
try:
self._conn = manager.getConnectionWithInfo(url, args)
except Exception as e:
error(e)
self._error = str(e)
return self
def create_window(args): def create_window(args):
return LOWindow(args) return LOWindow(args)
@ -6547,6 +6644,8 @@ def __getattr__(name):
return Paths return Paths
if name == 'docs': if name == 'docs':
return LODocs() return LODocs()
if name == 'db':
return LODBServer()
if name == 'sheets': if name == 'sheets':
return LOSheets() return LOSheets()
if name == 'cells': if name == 'cells':
@ -6645,48 +6744,6 @@ def get_fonts():
return device.FontDescriptors return device.FontDescriptors
# ~ From request
# ~ https://github.com/psf/requests/blob/master/requests/structures.py#L15
class CaseInsensitiveDict(MutableMapping):
def __init__(self, data=None, **kwargs):
self._store = OrderedDict()
if data is None:
data = {}
self.update(data, **kwargs)
def __setitem__(self, key, value):
# Use the lowercased key for lookups, but store the actual
# key alongside the value.
self._store[key.lower()] = (key, value)
def __getitem__(self, key):
return self._store[key.lower()][1]
def __delitem__(self, key):
del self._store[key.lower()]
def __iter__(self):
return (casedkey for casedkey, mappedvalue in self._store.values())
def __len__(self):
return len(self._store)
def lower_items(self):
"""Like iteritems(), but with all lowercase keys."""
values = (
(lowerkey, keyval[1]) for (lowerkey, keyval) in self._store.items()
)
return values
# Copy is required
def copy(self):
return CaseInsensitiveDict(self._store.values())
def __repr__(self):
return str(dict(self.items()))
# ~ https://en.wikipedia.org/wiki/Web_colors # ~ https://en.wikipedia.org/wiki/Web_colors
def get_color(value): def get_color(value):
COLORS = { COLORS = {