Package advene :: Package gui :: Package util :: Module dialog
[hide private]
[frames] | no frames]

Module dialog

source code

Dialog building facilities.

Classes [hide private]
  CategorizedSelector
Widget displaying a menu with items sorted along categories.
Functions [hide private]
 
dialog_keypressed_cb(widget=None, event=None)
Generic dialog keypress handler.
source code
 
generate_list_model(elements, active_element=None)
Create a TreeModel matching the elements list.
source code
 
list_selector_widget(members=None, preselect=None, entry=False, callback=None)
Generate a widget to pick an element from a list.
source code
 
list_selector(title=None, text=None, members=None, controller=None, preselect=None, entry=False)
Pick an element from a list.
source code
 
message_dialog(label='', icon=<enum GTK_MESSAGE_INFO of type GtkMessageType>, modal=True, callback=None)
Message dialog.
source code
 
yes_no_cancel_popup(title=None, text=None)
Build a Yes-No-Cancel popup window.
source code
string
entry_dialog(title=None, text=None, default='', completions=None)
Display a dialog to enter a short text.
source code
 
build_optionmenu(elements, current, on_change_element, editable=True)
Build a ComboBox.
source code
 
title_id_widget(element_title=None, element_id=None)
Build a widget to get title and id.
source code
 
title_id_dialog(title='Name the element', element_title=None, element_id=None, text='Choose a name for the element', flags=None)
Build a dialog to get title and id.
source code
 
get_title_id(title='Name the element', text='Choose a name for the element', element_title=None, element_id=None)
Get a title and id pair.
source code
 
get_filename(title='Open a file', action=<enum GTK_FILE_CHOOSER_ACTION_OPEN of type GtkFileChooserAction>, button='gtk-open', default_dir=None, default_file=None, alias=False, filter='any')
Get a filename.
source code
 
get_dirname(title='Choose a directory', action=<enum GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER of type GtkFileCho..., button='gtk-ok', default_dir=None)
Get a directory name.
source code
 
center_on_mouse(w)
Center the given gtk.Window on the mouse position.
source code
Variables [hide private]
  _fs_encoding = 'utf8'
Function Details [hide private]

generate_list_model(elements, active_element=None)

source code 

Create a TreeModel matching the elements list.

Element 0 is the label. Element 1 is the element Element 2 is the color (optional)

Parameters:
  • elements - a list of couples (element, label) or tuples (element, label, color)
  • active_element - the element that should be preselected

list_selector_widget(members=None, preselect=None, entry=False, callback=None)

source code 

Generate a widget to pick an element from a list.

Parameters:
  • members (list) - list of couples (element, label) or tuples (element, label, color)
  • preselect (object) - the element to preselect
  • entry (boolean) - use a comboboxentry ?
  • callback (method) - a callback to call on value change

list_selector(title=None, text=None, members=None, controller=None, preselect=None, entry=False)

source code 

Pick an element from a list.

members is a list of couples (element, label) or tuples (element, label, color)

Return None if the action is cancelled.

message_dialog(label='', icon=<enum GTK_MESSAGE_INFO of type GtkMessageType>, modal=True, callback=None)

source code 

Message dialog.

If callback is not None, then the dialog will not be modal and the callback function will be called upon validation.

yes_no_cancel_popup(title=None, text=None)

source code 

Build a Yes-No-Cancel popup window.

Return codes are in (gtk.RESPONSE_YES, gtk.RESPONSE_NO, gtk.RESPONSE_CANCEL)

entry_dialog(title=None, text=None, default='', completions=None)

source code 

Display a dialog to enter a short text.

Parameters:
  • title (string) - title of the dialog
  • text (string) - text of the dialog
  • default (string) - default value for the entry
  • completions (list of strings) - a list of possible completions
Returns: string
the entry value or None if the dialog was cancelled

build_optionmenu(elements, current, on_change_element, editable=True)

source code 

Build a ComboBox.

The `on_change_element` method signature is:

``def on_change_element([self,] element):``

Parameters:
  • elements (dict) - dict holding (key, values) where the values will be used as labels
  • current - current activated element (i.e. one of the keys)
  • on_change_element (method) - method be called upon option modification
Returns:
the combobox widget

title_id_widget(element_title=None, element_id=None)

source code 

Build a widget to get title and id.

Parameters:
  • element_title (string) - default title
  • element_id (string) - default id
Returns:
the widget

title_id_dialog(title='Name the element', element_title=None, element_id=None, text='Choose a name for the element', flags=None)

source code 

Build a dialog to get title and id.

Parameters:
  • title (string) - title of the dialog
  • text (string) - text of the dialog
  • element_title (string) - default title
  • element_id (string) - default id
  • flags - optional gtk.Dialog flags (such as gtk.DIALOG_MODAL)
Returns:
the dialog widget

get_title_id(title='Name the element', text='Choose a name for the element', element_title=None, element_id=None)

source code 

Get a title and id pair.

Parameters:
  • title (string) - title of the dialog
  • text (string) - text of the dialog
  • element_title (string) - default title
  • element_id (string) - default id
Returns:
a tuple (title, id). Both will be None if the dialog was cancelled

get_filename(title='Open a file', action=<enum GTK_FILE_CHOOSER_ACTION_OPEN of type GtkFileChooserAction>, button='gtk-open', default_dir=None, default_file=None, alias=False, filter='any')

source code 

Get a filename.

Parameters:
  • title (string) - the dialog title
  • action - the dialog action: gtk.FILE_CHOOSER_ACTION_OPEN (default) or gtk.FILE_CHOOSER_ACTION_SAVE
  • button - the validation button id: gtk.STOCK_OPEN (default) or gtk.STOCK_SAVE
  • default_dir (string) - the default directory
  • default_file (string) - the default file
  • alias (boolean) - wether to display the alias entry
  • filter (string) - the filename filter ('any', 'advene', 'session', 'video')
Returns:
if alias, a tuple (filename, alias), else the filename

get_dirname(title='Choose a directory', action=<enum GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER of type GtkFileCho..., button='gtk-ok', default_dir=None)

source code 

Get a directory name.

Parameters:
  • title (string) - the dialog title
  • action - the dialog action: gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER (default)
  • button - the validation button id: gtk.STOCK_OK (default)
  • default_dir (string) - the default directory
Returns:
the directory name