comet.dialog¶
This module provides helper functionality to create commonly used dialogs for querying user input.
See also
- Class
CDialog
Create custom dialogs dialogs for your scripts.
Methods¶
- comet.dialog.create(dialogSpec='')¶
Create a new
CDialog
object which can then be further modified using the class functions.The dialog can either be created using an existing dialog specification - which is a JSON string - or by not providing a specification, resulting in a new empty dialog.
- Parameters
dialogSpec (str) –
The JSON specification.
Empty str: Empty dialog
- Returns
The newly created dialog. This dialog is not shown yet!
- Return type
- Raises
CometError – On internal error
- Available
- comet.dialog.askStr(title='', label='', text='', okay='', cancel='', multiLine=True, maxChars=- 1)¶
Open a dialog to enter text.
- Parameters
title (str) – The dialog title.
label (str) – Hint for the text field.
text (str) – The initial text for the entry field.
okay (str) – Caption for the ‘Ok’ button. * Empty str: ‘Okay’
cancel (str) – Caption for the ‘Cancel’ button. * Empty str: ‘Cancel’
multiLine (bool) – Whether the dialog should have a text field for entering multi line text.
maxChars (int) –
Impose a limit to the number of characters that can be entered. * <0: No limit.
Warning
Not implemented when parameter multiLine is
True
- Returns
Whether the user accepted the dialog, and the content of the text field.
- Return type
- Raises
TypeError – When parameter types are invalid.
CometError – On internal error.
- Available
- CScript
- comet.dialog.selectFile(title='', askForNew=False, suggestion='')¶
Open a dialog to select an existing file or get the path for a new file.
- Parameters
- Returns
User selected a path: The selected filepath
User cancelled:
None
- Return type
- Raises
TypeError – When parameter types are invalid.
CometError – On internal error.
- Available
- CScript
- comet.dialog.selectFolder(title='', suggestion='')¶
Open a dialog to select an existing folder.
- Parameters
- Returns
User selected a path: The selected folder
User cancelled:
None
- Return type
- Raises
TypeError – When parameter types are invalid.
CometError – On internal error.
- Available
- CScript