Skip to content
kelsa-pi edited this page Aug 5, 2017 · 15 revisions

Welcome to the PyUNO_Workspace wiki!

Installation

  • Install PyUNO Workspace

    Copy pyzoPyUNOWorkspace directory from this repo to ./pyzo/tools.

  • Install documentation offline browser (optional)

    • Install Dash-like offline documentation browser:

      Linux: Zeal

      OS X: Dash

      Windows: Velocity

    • Generate UNO docset for Dash

      Follow this instruction UNO2Dash

  • Install unostarter module (optional)

    Download or clone repo unostarter

Before You Start

  • Preparation in Pyzo

    • Set shell for PyUno

      When Pyzo starts, a default shell is created.

      Set breakpoints

      Type import uno in the default shell.

      If you do not see an error, everything is OK.

      If this is not the case you must create a new shell.

      In option exe put the location of Libre Office's Python (eg. /opt/libreoffice5.4/program/python)

    • Activate PyUNO Workspace

      Activate plugin by going to Tools -> PyUNO Workspace

  • Activate Dash and/or unostarter support (optional)

    • In PyUNO Workspace select checkbox and hit Save button.

    • Click on Tools -> Reload tools.

  • Create your project with unostarter module (optional)

    • Copy my_project to $LIBREOFFICE_PATH/Script/python directory, where $LIBREOFFICE_PATH is your Libre Office root directory.

Usage

  • Start LibreOffice from the command line

    soffice "--accept=socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" --writer --norestore

    /opt/libreofficedev5.4/program/soffice "--accept=socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" --writer --norestore

  • Start Dash-like offline documentation browser

  • Open your project in editor

    Set breakpoints

  • Set breakpoints in the source code

    Set breakpoints

  • Run source code in the editor

    Menu Run -> Run file as script

  • Debugging

    Use the toolbar buttons to move to the next line.

    Debug toolbar

    Move to next line or select property or method in workspace

  • Examine property or method

    With double clik drill futher

    Drill

    or find more information with right clik

    Context

  • Set argument

    Write argument and double click on object

    Context

  • Insert code in editor

    Pres icon to insert code at cursor position

    Context

    Inserted code in the script

    initial_target = document.BasicLibraries item = initial_target.getByName("Standard")

Clone this wiki locally