lib.scripting.GtkDialog

Package lib :: Module scripting :: Class GtkDialog |
[hide private]
[frames] | no frames]

# Class GtkDialog

source code

Provides a simple interface for the display of some basic dialogs to collect information from the user.

This version uses Zenity to integrate well with GNOME. To pass additional arguments to Zenity that are not specifically handled, use keyword arguments. For example, to pass the --timeout argument to Zenity pass `timeout="15"` as one of the parameters. All keyword arguments must be given as strings.

A note on exit codes: an exit code of 0 indicates that the user clicked OK.

Instance Methods | [hide private]
_run_zenity(self, title, args, kwargs) | source code
`tuple(int, str)` |
info_dialog(self, title=`'``Information``'`, message=`'````'`, **kwargs) Show an information dialog | source code
`tuple(int, str)` |
input_dialog(self, title=`'``Enter a value``'`, message=`'``Enter a value``'`, default=`'````'`, **kwargs) Show an input dialog | source code
`tuple(int, str)` |
password_dialog(self, title=`'``Enter password``'`, message=`'``Enter password``'`, **kwargs) Show a password input dialog | source code
`tuple(int, str)` |
list_menu(self, options, title=`'``Choose a value``'`, message=`'``Choose a value``'`, default=None, **kwargs) Show a single-selection list menu | source code
`tuple(int, str)` |
list_menu_multi(self, options, title=`'``Choose one or more values``'`, message=`'``Choose one or more values``'`, defaults=`[``]`, **kwargs) Show a multiple-selection list menu | source code
`tuple(int, str)` |
open_file(self, title=`'``Open File``'`, **kwargs) Show an Open File dialog | source code
`tuple(int, str)` |
save_file(self, title=`'``Save As``'`, **kwargs) Show a Save As dialog | source code
`tuple(int, str)` |
choose_directory(self, title=`'``Select Directory``'`, initialDir=`'``~``'`, **kwargs) Show a Directory Chooser dialog | source code
`tuple(int, str)` |
calendar(self, title=`'``Choose a date``'`, format=`'``%Y-%m-%d``'`, date=`'``today``'`, **kwargs) Show a calendar dialog | source code

Method Details | [hide private]

### info_dialog(self, title=`'``Information``'`, message=`'````'`, **kwargs) | source code
Show an information dialog Usage: `dialog.info_dialog(title="Information", message="", **kwargs)` Parameters: `title` - window title for the dialog `message` - message displayed in the dialog Returns: `tuple(int, str)` a tuple containing the exit code and user input

### input_dialog(self, title=`'``Enter a value``'`, message=`'``Enter a value``'`, default=`'````'`, **kwargs) | source code
Show an input dialog Usage: `dialog.input_dialog(title="Enter a value", message="Enter a value", default="", **kwargs)` Parameters: `title` - window title for the dialog `message` - message displayed above the input box `default` - default value for the input box Returns: `tuple(int, str)` a tuple containing the exit code and user input

### password_dialog(self, title=`'``Enter password``'`, message=`'``Enter password``'`, **kwargs) | source code
Show a password input dialog Usage: `dialog.password_dialog(title="Enter password", message="Enter password")` Parameters: `title` - window title for the dialog `message` - message displayed above the password input box Returns: `tuple(int, str)` a tuple containing the exit code and user input

### list_menu(self, options, title=`'``Choose a value``'`, message=`'``Choose a value``'`, default=None, **kwargs) | source code
Show a single-selection list menu Usage: `dialog.list_menu(options, title="Choose a value", message="Choose a value", default=None, **kwargs)` Parameters: `options` - list of options (strings) for the dialog `title` - window title for the dialog `message` - message displayed above the list `default` - default value to be selected Returns: `tuple(int, str)` a tuple containing the exit code and user choice

### list_menu_multi(self, options, title=`'``Choose one or more values``'`, message=`'``Choose one or more values``'`, defaults=`[``]`, **kwargs) | source code
Show a multiple-selection list menu Usage: `dialog.list_menu_multi(options, title="Choose one or more values", message="Choose one or more values", defaults=[], **kwargs)` Parameters: `options` - list of options (strings) for the dialog `title` - window title for the dialog `message` - message displayed above the list `defaults` - list of default values to be selected Returns: `tuple(int, str)` a tuple containing the exit code and user choice

### open_file(self, title=`'``Open File``'`, **kwargs) | source code
Show an Open File dialog Usage: `dialog.open_file(title="Open File", **kwargs)` Parameters: `title` - window title for the dialog Returns: `tuple(int, str)` a tuple containing the exit code and file path

### save_file(self, title=`'``Save As``'`, **kwargs) | source code
Show a Save As dialog Usage: `dialog.save_file(title="Save As", **kwargs)` Parameters: `title` - window title for the dialog Returns: `tuple(int, str)` a tuple containing the exit code and file path

### choose_directory(self, title=`'``Select Directory``'`, initialDir=`'``~``'`, **kwargs) | source code
Show a Directory Chooser dialog Usage: `dialog.choose_directory(title="Select Directory", **kwargs)` Parameters: `title` - window title for the dialog Returns: `tuple(int, str)` a tuple containing the exit code and path

### calendar(self, title=`'``Choose a date``'`, format=`'``%Y-%m-%d``'`, date=`'``today``'`, **kwargs) | source code
Show a calendar dialog Usage: `dialog.calendar_dialog(title="Choose a date", format="%Y-%m-%d", date="YYYY-MM-DD", **kwargs)` Parameters: `title` - window title for the dialog `format` - format of date to be returned `date` - initial date as YYYY-MM-DD, otherwise today Returns: `tuple(int, str)` a tuple containing the exit code and date