Skip to content

Create extension with dialog

sasa edited this page Apr 14, 2017 · 9 revisions

Convert dialog file .xdl to python code and create extension

Usage

  • Prepare
    • create dialog in Dialog Editor
    • create project directory in LIBREOFFICE_PATH/4/user/Scripts/python/
    • copy config.ini in project directory and edit section to customize behavior (optional)
  • Write code
    • run unodit with parameter script_convert

      use parameter -f to set the path to any local directory with xdl file

          python3 ./unodit.py -m 'script_convert'
                              -d 'LIBREOFFICE_PATH/4/user/Scripts/python/TestLib'
                              -f 'LIBREOFFICE_PATH/4/user/basic/DialogLib/Default.xdl'
                              -a 'Test_convert'
      
    • write your code in generated file Test_convert.py

  • Prepare extension files
    • run unodit with parameter script_files

          python3 ./unodit.py -m 'script_files'
                              -d 'LIBREOFFICE_PATH/4/user/Scripts/python/TestLib'
                              -f 'LIBREOFFICE_PATH/4/user/basic/DialogLib/Default.xdl'
                              -a 'Test_convert'
      
    • change description.txt, title.txt and license.txt (optional)

  • Create extension
    • run unodit with parameter script_oxt

          python3 ./unodit.py -m 'script_oxt'
                              -d 'LIBREOFFICE_PATH/4/user/Scripts/python/TestLib'
                              -f 'LIBREOFFICE_PATH/4/user/basic/DialogLib/Default.xdl'
                              -a 'Test_convert'
      
    • install extension Test_convert_Devel.oxt

    • start extension with Tools - AddOns - Test_convert

Available options for parameter -m: 'script_convert' , 'script_files' , 'script_oxt' , 'script_all' 'script_all' = all in one, use for testing

Directory structure and parameters

TestLib/
        src/
            Test_convert.py           script_convert
            pythonpath/
                Test_convert_UI.py   ---------------       
        META-INF/
            manifest.xml
        description/
            description.txt           script_files
            title.txt
        registration/
            license.txt
        Addons.xcu
        description.xml              --------------
        Test_convert_Devel.oxt        script_oxt
Clone this wiki locally