Skip to content

Simple dialog boxes

kelsa-pi edited this page Aug 1, 2016 · 10 revisions

###Provides a simple dialog boxes for scripts

python3 ./unodit.py -d 'LIBREOFFICE_PATH/4/user/Scripts/python/TestLib'
                    -a 'Test_dialogs'
                    -m 'dialogs_create'

Available options for parameter -m: 'dialogs_create', 'dialogs_files', 'dialogs_oxt', 'dialogs_all'

Parameter Description Note
'dialogs_create' create files write your code in src/Test_dialogs.py
'dialogs_files' create script extension files change description.txt, title.txt and license.txt
'dialogs_oxt' create script extension extension file Test_dialogs_Devel.oxt
'dialogs_all' all in one - testing dialogs_create + dialogs_files + dialogs_oxt

Directory structure and parameters

TestLib/
        src/
            Test_dialogs.py           dialogs_create
            pythonpath/
                simple_dialogs.py    ---------------       
        META-INF/
            manifest.xml
        description/
            description.txt           dialogs_files
            title.txt
        registration/
            license.txt
        Addons.xcu
        description.xml              --------------
        Test_dialogs_Devel.oxt        dialogs_oxt

####Dialogs

All dialogs are defined in simple_dialogs.py. In order to use dialog eg. SelectBox in your script Test_dialogs.py import it:

from simple_dialogs import SelectBox

GUI operations are a simple a matter of invoking SelectBox functions with a few parameters

s = SelectBox(message="Select your favorite city", title="My choice", choices=["New York","London", "Paris", "Berlin"])
print(s)

Generate files with option 'dialogs_create' and read Test_dialogs.py for more information.

#####SelectBox

Usage: SelectBox(message="Select one item", title="SelectBox", choices=['a','b','c'])

Return: a string, or None

SelectBox

#####OptionBox

Usage: OptionBox(message="Select multiple items", title="OptionBox", choices=['a','b','c'])

Return: a tuple of selected items, or empty tuple

OptionBox

#####TextBox Usage: TextBox(message="Enter your input", title="TextBox", text="")

Return: a string, or None

TextBox

#####NumberBox Usage: NumberBox(message="Enter a number", title="NumberBox", default_value=0, min_=-10000, max_=10000, decimals=0)

Return: an integer/float or None

NumberBox

#####DateBox Usage: DateBox(message="Date of birth", title="BirthDay")

Return: the selected date in format YYYYMMDD

DateBox

#####FolderPathBox

Usage: FolderPathBox(title='Get directory path')

Return: the path of a directory or an empty string

FolderPathBox

#####FilePathBox

Usage: FilePathBox(title='Get file path')

Return: the path of a file or an empty string

FilePathBox

#####MessageBox

Usage: MessageBox(message="Message", title="MessageBox")

MessageBox

#####ActionBox

Usage: ActionBox(message="Message", title="ActionBox")

Return: OK or NO or Cancel

ActionBox

Clone this wiki locally