How to add external modules for python and autocompletition
-
Hellow
I m trying to learn macro programig in python for LibreOffice and I will like to use notepad++.
But I dont found the way to add the special modules for autocompletition.
How can I do to do that
The modules are uno, pyuno etc.
Thanks for reading. -
-
@peterjones
Thanks and I will try it.
After that if I win I tell you. -
Could generate the autocomplete file with gen_python_3_api.py. Requires Python 3 obviously.
- Download gen_python_3_api.py from this repository.
- Copy gen_python_3_api.py to an empty directory for the operation.
- Run this command from the directory containing gen_python_3_api.py:
"%ProgramFiles%\LibreOffice\program\python.exe" "gen_python_3_api.py"
Notice the command will run Python built into LibreOffice, not the Python that you may have installed separately. If you want autocomplete from the Python installed separately, then run the script with that Python instead.
Multiple files will be created. The files that are not xml are for SciTE. The main file for the Notepad++ autocomplete is python3.xml.
Recommend to read the docstring at the top of gen_python_3_api.py which has some instructions and other useful information. A couple of different ways to setup into Notepad++.
You could replace the original autoCompletion\python.xml with the content of python3.xml which replaces Python 2 with Python 3 as default for autocomplete. Do backup the original file before doing this. The file userDefineLang_python3.xml has keywords within that you may need to update in the
Settings -> Style Configurator
menu.Or you could copy userDefineLang_python3.xml into the userDefineLangs folder and copy python3.xml into the autoCompletion folder. This will display in Notepad++ as a UDL in the menu Language -> python3. This is not going to be so intergrated as the previous option with builtin theming and the other features.
The python3.xml file will be quite large at approximately 960KB, though here is an excerpt of a
uno
function entry:<KeyWord func="yes" name="uno.invoke"> <Overload descr="[function] Use this function to pass exactly typed Anys to the callee (using uno.Any)." retVal=""> <Param name="object"/> <Param name="methodname"/> <Param name="argTuple"/> </Overload> </KeyWord>
Tested with LibreOffice 7.1.7.2 which has Python 3.8. I am the author of the gen_python_3_api.py script so I should be able to help here if any on-topic questions are asked about this script, otherwise suggest to discuss at the repository.