Community
    • Login

    How to add external modules for python and autocompletition

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 3 Posters 1.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • UsulU
      Usul
      last edited by

      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.

      PeterJonesP mpheathM 2 Replies Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Usul
        last edited by

        @usul

        • AutoCompletion File Format
        • a search of “auto-completion” topics to which I have contributed
        UsulU 1 Reply Last reply Reply Quote 3
        • UsulU
          Usul @PeterJones
          last edited by

          @peterjones
          Thanks and I will try it.
          After that if I win I tell you.

          1 Reply Last reply Reply Quote 0
          • mpheathM
            mpheath @Usul
            last edited by

            @usul

            Could generate the autocomplete file with gen_python_3_api.py. Requires Python 3 obviously.

            1. Download gen_python_3_api.py from this repository.
            2. Copy gen_python_3_api.py to an empty directory for the operation.
            3. 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.

            1 Reply Last reply Reply Quote 3
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors