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

Class QtDialog

source code

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

This version uses KDialog to integrate well with KDE.

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

Instance Methods [hide private]
 
__runKdialog(self, title, args) source code
tuple(int, str)
input_dialog(self, title='Enter a value', message='Enter a value', default='')
Show an input dialog
source code
tuple(int, str)
password_dialog(self, title='Enter password', message='Enter password')
Show a password input dialog
source code
tuple(int, str)
combo_menu(self, options, title='Choose an option', message='Choose an option')
Show a combobox menu
source code
tuple(int, str)
list_menu(self, options, title='Choose a value', message='Choose a value', default=None)
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=[])
Show a multiple-selection list menu
source code
tuple(int, str)
open_file(self, title='Open File', initialDir='~', fileTypes='*|All Files', rememberAs=None)
Show an Open File dialog
source code
tuple(int, str)
save_file(self, title='Save As', initialDir='~', fileTypes='*|All Files', rememberAs=None)
Show a Save As dialog
source code
tuple(int, str)
choose_directory(self, title='Select Directory', initialDir='~', rememberAs=None)
Show a Directory Chooser dialog
source code
tuple(int, str)
choose_colour(self, title='Select Colour')
Show a Colour Chooser dialog
source code
Method Details [hide private]

input_dialog(self, title='Enter a value', message='Enter a value', default='')

source code 

Show an input dialog

Usage: dialog.input_dialog(title="Enter a value", message="Enter a value", default="")

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')

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

combo_menu(self, options, title='Choose an option', message='Choose an option')

source code 

Show a combobox menu

Usage: dialog.combo_menu(options, title="Choose an option", message="Choose an option")

Parameters:
  • options - list of options (strings) for the dialog
  • title - window title for the dialog
  • message - message displayed above the combobox
Returns: tuple(int, str)
a tuple containing the exit code and user choice

list_menu(self, options, title='Choose a value', message='Choose a value', default=None)

source code 

Show a single-selection list menu

Usage: dialog.list_menu(options, title="Choose a value", message="Choose a value", default=None)

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=[])

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=[])

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', initialDir='~', fileTypes='*|All Files', rememberAs=None)

source code 

Show an Open File dialog

Usage: dialog.open_file(title="Open File", initialDir="~", fileTypes="*|All Files", rememberAs=None)

Parameters:
  • title - window title for the dialog
  • initialDir - starting directory for the file dialog
  • fileTypes - file type filter expression
  • rememberAs - gives an ID to this file dialog, allowing it to open at the last used path next time
Returns: tuple(int, str)
a tuple containing the exit code and file path

save_file(self, title='Save As', initialDir='~', fileTypes='*|All Files', rememberAs=None)

source code 

Show a Save As dialog

Usage: dialog.save_file(title="Save As", initialDir="~", fileTypes="*|All Files", rememberAs=None)

Parameters:
  • title - window title for the dialog
  • initialDir - starting directory for the file dialog
  • fileTypes - file type filter expression
  • rememberAs - gives an ID to this file dialog, allowing it to open at the last used path next time
Returns: tuple(int, str)
a tuple containing the exit code and file path

choose_directory(self, title='Select Directory', initialDir='~', rememberAs=None)

source code 

Show a Directory Chooser dialog

Usage: dialog.choose_directory(title="Select Directory", initialDir="~", rememberAs=None)

Parameters:
  • title - window title for the dialog
  • initialDir - starting directory for the directory chooser dialog
  • rememberAs - gives an ID to this file dialog, allowing it to open at the last used path next time
Returns: tuple(int, str)
a tuple containing the exit code and chosen path

choose_colour(self, title='Select Colour')

source code 

Show a Colour Chooser dialog

Usage: dialog.choose_colour(title="Select Colour")

Parameters:
  • title - window title for the dialog
Returns: tuple(int, str)
a tuple containing the exit code and colour