Hildon Widgets API for Python

hildon.CalendarPopup

hildon.CalendarPopup

A dialog which contains a gtk.Calendar.

Description

hildon.CalendarPopup is a dialog which contains a gtk.Calendar. It also contains arrow buttons for changing month/year. The earliest possible date is 1/1/1980 and the latest date 31/12/2100. If navigating with keyboard to a date that is not in the current month the calendar moves to the corresponding month. If the new date would be unallowed then an information banner will be shown. The usage of CalendarPopup is shown in the following code. This function should be connect to eg. button-press-event.

Ancestry

Up to the first non-hildon ancestor:

...
 +-- gtk.Dialog
        +-- hildon.CalendarPopup

Usage Example

import gtk
import hildon
 
def on_gather_date(widget, window, button):
      dialog = hildon.CalendarPopup (window, 2006, 04, 20)
dialog.run()
date_tuple = dialog.get_date()
dialog.destroy()
button.set_label("The date is (yy/mm/dd): %s/%s/%s" % date_tuple)
window = hildon.Window()
window.set_title("Test App")
button = gtk.Button("Click to enter a date")
window.add(button) button.connect("clicked", on_gather_date, window, button)
 
window.show_all()
 
gtk.main()

Properties

Name Access Description
"min-year" Read/Write Minimum valid year.
"max-year" Read/Write Maximum valid year.
"day" Read/Write Currently selected day.
"month" Read/Write Currently selected month.
"year" Read/Write Currently selected year.

Constructor

This function returns a new hildon.CalendarPopup. The initially selected date is specified by the parameters (year, month, day). If the specified date is invalid, the current date is used.

hildon.CalendarPopup(parent, year, month, day)
parent parent window for dialog

year

initial year
month initial month
day initial day
Returns A new hildon.CalendarPopup widget.

Methods

set_date

This method activates a new date on the calendar popup.

hildon.CalendarPopup.set_date(year, month, day)
year A year
month A month
day A day

get_date

This method is used to get the currently selected year, month, and day.

hildon.CalendarPopup.get_date()
Returns A tuple of the form (year, month, day).

hildon.ColorButton

hildon.ColorButton

A widget to open a hildon.ColorSelector.

Description

hildon.ColorButton is a widget to open hildon.ColorSelector. The color field in the button shows the selected color. The current color is set as a property to the button. The property name is "color" and it's type is gtk.gdk.Color.

Ancestry

Up to the first non-hildon ancestor:

...
 +-- gtk.Button
         +-- hildon.ColorButton

Usage Example

import gtk
import hildon
def color_changed(widget, label): color = widget.get_color()
label.set_text("Current color is: (red=%s, green=%s, blue=%s, pixel=%s)" %
                       (color.red, color.green, color.blue, color.pixel))
window = hildon.Window()
window.set_title("Test App")
label = gtk.Label()
button = hildon.ColorButton()
button.connect("clicked", color_changed, label)
color_changed (button, label)
 
#Init label text vbox = gtk.VBox(False, 10)
vbox.pack_start (button)
vbox.pack_start (label)
window.add(vbox)
 
window.show_all()
 
gtk.main()

Properties

Name Access Description
"color" Read/Write The selected color.

Constructor

Creates a new color button. This returns a widget in the form of a small button containing a swatch representing the current selected color. When the button is clicked, a color-selection dialog will open, allowing the user to select a color. The swatch will be updated to reflect the new color when the user finishes.

hildon.ColorButton(color)
color (optional) A gtk.gdk.Color to set the current color with.
Returns A new color button.

Methods

get_color

Gets a color from the button.

hildon.ColorButton.get_color()
Returns The color set to the button.

set_color

Sets a color to the button.

hildon.ColorButton.set_color(color)
color A color to be set.

hildon.ColorSelector

hildon.ColorSelector

A widget for selecting a color.

Description

hildon.ColorSelector allows a selection of a color. It consists of a control that displays the default palette of 16 colors and a control that can be opened to select a custom color from a 16M color palette.

Ancestry

Up to the first non-hildon ancestor:

...
 +-- gtk.Dialog
         +-- hildon.ColorSelector

Usage Example

import gtk
import hildon
def color_selected(widget, label, window):
         color_selector = hildon.ColorSelector(window)
color_selector.run()
color = color_selector.get_color()
color_selector.destroy()
label.set_text("Selected color is: (red=%s, green=%s, blue=%s, pixel=%s)" %
                       (color.red, color.green, color.blue, color.pixel))
window = hildon.Window()
window.set_title("Test App")
label = gtk.Label("No color has been selected yet...")
button = gtk.Button("Click here to select a color")
button.connect("clicked", color_selected, label, window)
vbox = gtk.VBox(False, 10)
vbox.pack_start (button)
vbox.pack_start (label)
window.add(vbox)
 
window.show_all()
 
gtk.main()

Properties

Name Access Description
"color" Read/Write The selected color.

Constructor

Creates a new hildon.ColorSelector dialog with 3x8 layout of base colors and 'OK', 'Modify' and 'Cancel' buttons.

hildon.ColorSelector(parent)
parent The parent window.
Returns A new hildon.ColorSelector.

Methods

get_color

Gets the currently selected color as gtk.gdk.Color.

hildon.ColorSelector.get_color()
Returns A copy of the currently selected gtk.gdk.Color.

set_color

Select the color specified. Does nothing if the color does not exists among the standard colors.

hildon.ColorSelector.set_color(color)
color gtk.gdk.Color to set.

hildon.Controlbar

hildon.Controlbar

A widget that allows increasing or decreasing a value within a pre-defined range.

Description

hildon.Controlbar is a horizontally positioned widget that allows increasing or decreasing a value within a pre-defined range. The amount of steps in a hildon.Controlbar can be changed.

Ancestry

Up to the first non-hildon ancestor:

...
 +-- gtk.Scale
         +-- hildon.Controlbar

Usage Example

import gtk
import hildon def control_changed(widget, label):
            label.set_text("Min:%s | Current: %s | Max:%s" %
                                    (widget.get_min(), widget.get_value(), widget.get_max()))
window = hildon.Window()
window.set_title("Test App")
label = gtk.Label()
controlbar = hildon.Controlbar(0, 50, 15)
controlbar.connect("value-changed", control_changed, label)
control_changed(controlbar, label)
 
#Init label text vbox = gtk.VBox(False, 10)
vbox.pack_start (controlbar)
vbox.pack_start (label)
window.add(vbox)
 
window.show_all()
 
gtk.main()

Properties

Name Access Description
"min" Read/Write Smallest possible value.
"max" Read/Write Greatest possible value.
"value" Read/Write Current value.

Style Properties

Name Access Description
"inner_border_width" Read The border spacing between the controlbar border and controlbar blocks.

Constructor

Creates a new hildon.Controlbar widget.

hildon.Controlbar(min, max, value)
min (optional) Minimum value.
max (optional) Maximum value.
value (optional) Initial value.
Returns A new hildon.Controlbar widget.

Methods

get_value

Accessor method for getting its current value.

hildon.Controlbar.get_value()
Returns Its current value.

set_value

Accessor method for changing its current value.

hildon.Controlbar.set_value(value)
value Its current value.

get_min

Accessor method for getting its minimum value.

hildon.Controlbar.get_min()
Returns Its minimum value.

set_min

Accessor method for changing its minimum value.

hildon.Controlbar.set_min(min)
min Its minimum value.

get_max

Accessor method for getting its maximum value.

hildon.Controlbar.get_max()
Returns Its maximum value.

set_max

Accessor method for changing its maximum value.

hildon.Controlbar.set_max(max)
max Its maximum value.

set_range

Set its range, that is, both its maximum and minimum values.

hildon.Controlbar.set_range(min, max)
min Its minimum value.
max Its maximum value.

hildon.DateEditor

hildon.DateEditor

A simple widget with three entry fields (day, month, year) and an icon (eventbox). The clicking of that icon opens up a hildon.CalendarPopup.

Description

It's a simple widget with three entry fields (day, month, year) and an icon (eventbox). The clicking of that icon opens up a hildon.CalendarPopup. The current system date is shown in the editor by default.

Ancestry

Up to the first non-hildon ancestor:

...
 +-- gtk.Container
     +-- hildon.DateEditor

Usage Example

import gtk
import hildon
window = hildon.Window()
window.set_title("Test App")
dateeditor = hildon.DateEditor(2006, 4, 20)
window.add(dateeditor)
window.show_all()
gtk.main()

Properties

Name Access Description
"year" Read/Write Current year.
"month" Read/Write Current month.
"day" Read/Write Current day.
"min-year" Read/Write Minimum valid year.
"max-year" Read/Write Maximum valid year.

Constructor

Creates a new hildon.DateEditor widget.

hildon.DateEditor(year, month, day, min-year, max-year)
year (optional) A year.
month (optional) A month.
day (optional) A day.
min-year (optional) The minimum allowable year.
min-year (optional) The maximum allowable year.
Returns A new hildon.DateEditor widget.

Methods

get_date

This method is used to get the currently selected year, month, and day.

hildon.DateEditor.get_date()
Returns A tuple of the form (year, month, day).

set_date

This method activates a new date on the calendar popup.

hildon.DateEditor.set_date(year, month, day)
year A year
month A month
day A day

get_year

This method is used to get the currently selected year.

hildon.DateEditor.get_year()
Returns The currently selected year.

set_year

This method is used to select the year.

hildon.DateEditor.set_year(year)
year The year to be selected.

get_month

This method is used to get the currently selected month.

hildon.DateEditor.get_month()
Returns The currently selected month.

set_month

This method is used to select the month.

hildon.DateEditor.set_month(month)
month The month to be selected.

get_day

This method is used to get the currently selected day.

hildon.DateEditor.get_day()
Returns The currently selected day.

set_day

This method is used to select the day.

hildon.DateEditor.set_day(day)
day The day to be selected.

hildon.FileDetailsDialog

hildon-file-system-model documentation and usage it not clear to me. Have to fix its binding and this document when it's solved.

Used to show details of a file.

Description

Used to show details of a file.

Ancestry

Up to the first non-hildon ancestor:

...
  +-- gtk.Dialog
      +-- hildon.FileDetailsDialog

Usage Example

Source code.

Properties

"prop-name" Property description.

Constructor

Bla

hildon.Class(param1)
param1 param1 description
Returns A new something.

Methods

method_name

Bla

hildon.Class.method_name(param1)
param1 Param1 desc

hildon.FontSelectionDialog

hildon.FontSelectionDialog

A widget is used to select a font with certain properties

Description

Font selection dialog provides the user with the possiblity to choose a different font family, font size, font color, font weight (bold or not bold), font style (italic or not italic), underline, strikethrough, and position (normal, superscript or subscript).

Usage Example

import gtk
import hildon def font_selected(widget, label, fontDialog): fontDialog.run()
fontDialog.hide()
if fontDialog.get_property("family-set"): family = fontDialog.get_property("family")
else: family = "Not set"
if fontDialog.get_property("size-set"): size = fontDialog.get_property("size") else: size = "Not set"
if fontDialog.get_property("color-set"): gdk_color = fontDialog.get_property("color")
color = "(R:%s, G:%s, B:%s)" %
     (gdk_color.red, gdk_color.green, gdk_color.blue)
else: color = "Not set" if fontDialog.get_property("bold-set"):
bold = fontDialog.get_property("bold")
else: bold = "Not set" if fontDialog.get_property("italic-set"): italic = fontDialog.get_property("italic")
else: italic = "Not set" if fontDialog.get_property("underline-set"): underline = fontDialog.get_property("underline") else: underline = "Not set" if fontDialog.get_property("strikethrough-set"): strikethrough = fontDialog.get_property("strikethrough") else: strikethrough = "Not set" if fontDialog.get_property("position-set"): position = fontDialog.get_property("position") else: position = "Not set" label.set_text("Family: %s | Size: %s | Color: %s\n" "Bold: %s | Italic: %s | Underline: %s\n" "Sstrikethrough: %s | Position: %s" % (family, size, color, bold, italic, underline, strikethrough, position)) window = hildon.Window() window.set_title("Test App") label = gtk.Label("No font selected.") fontDialog = hildon.FontSelectionDialog(window, "Choose a font...") fontDialog.set_preview_text ("The lazy dogs caught the quick brown fox.") button = gtk.Button("Click to select a font") button.connect("clicked", font_selected, label, fontDialog) vbox = gtk.VBox(False, 10) vbox.pack_start (button) vbox.pack_start (label) window.add(vbox) window.show_all() gtk.main()

Properties

Name Access Description
"family" Read/Write String that defines the font family.
"family-set" Read/Write/Construct Whether the family property is inconsistent.
"size" Read/Write Font size in Pt (points, typographical unit).
"size-set" Read/Write/Construct Whether the size property is inconsistent.
"color" Read/Write gdk color for the text.
"color-set" Read/Write/Construct Whether the color property is inconsistent.
"bold" Read/Write Whether the text is bold.
"bold-set" Read/Write/Construct Whether the bold is inconsistent.
"italic" Read/Write Whether the text is italic.
"italic-set" Read/Write/Construct Whether the italic is inconsistent.
"underline" Read/Write Whether the text is underlined.
"underline-set" Read/Write/Construct Whether the underline is inconsistent.
"strikethrough" Read/Write Whether the text is strikethroughed.
"strikethrough-set" Read/Write/Construct Whether the strikethrough is inconsistent.
"position" Read/Write Font position (regular, super or subscript).
"position-set" Read/Write/Construct Whether the position is inconsistent.
"preview-text" Read/Write The text in preview dialog, which does not include the "Reference: " text. eg: "The quick brown fox jumps over the lazy dog."

Constructor

Creates a new font selection dialog.

hildon.FontSelectionDialog(parent, title)
parent The parent window.
title (optional) The title of font selection dialog. If it's not passed, then a default title "Font" will be used.
Returns A new hildon.FontSelectionDialog widget.

Methods

get_preview_text

Gets the text in preview dialog, which does not include the reference text ("Reference: ").

hildon.FontSelectionDialog.get_preview_text()
Returns The preview text being used. eg: "The quick brown fox jumps over the lazy dog."

set_preview_text

Sets the text in preview dialog, which does not include the reference text ("Reference: "). The default preview text is "The quick brown fox jumped over the lazy dogs".

hildon.FontSelectionDialog.set_preview_text(text)
text The preview text to be used.

hildon.GetPasswordDialog

hildon.GetPasswordDialog

hildon.GetPasswordDialog is used to get a password.

Description

hildon.GetPasswordDialog is used to get a password.

Ancestry

Up to the first non-hildon ancestor:

... +-- gtk.Dialog +-- hildon.GetPasswordDialog

Usage Example

import gtk import hildon def get_password(widget, label, passwordDialog): passwordDialog.set_property ("password", "") #Clear the password string, in case it was already set. response = passwordDialog.run() passwordDialog.hide() if response == gtk.RESPONSE_OK: label.set_text("Password typed is: %s" % passwordDialog.get_password()) window = hildon.Window() window.set_title("Test App") label = gtk.Label("No password entered.") passwordDialog = hildon.GetPasswordDialog(window, True) button = gtk.Button("Click and type a password") button.connect("clicked", get_password, label, passwordDialog) vbox = gtk.VBox(False, 10) vbox.pack_start (button) vbox.pack_start (label) window.add(vbox) window.show_all() gtk.main()

Properties

Name Access Description
"domain" Read/Write Set domain (content) for optional label.
"password" Read/Write Set content for password entry.
"numbers_only" Read/Write Set entry to accept only numeric values.
"caption-label" Read/Write The text to be set as the caption label.
"max-characters" Read/Write The maximum number of characters the password dialog accepts.
"get-old" Read/Write/Construct Only True if dialog is a get old password dialog, False if dialog is a get password dialog.

Constructor

Creates a new hildon.GetPasswordDialog widget.

hildon.GetPasswordDialog(parent, get_old_password_title)
parent Its parent window.
get_old_password_title False creates a "get new password" dialog and True creates a "get current password" dialog.
Returns A new hildon.GetPasswordDialog widget.

Methods

set_domain

Sets the optional descriptive text.

hildon.GetPasswordDialog.set_domain(domain)
domain The domain or some other descriptive text to be set.

set_title

Sets the dialog title.

hildon.GetPasswordDialog.set_title(new_title)
new_title The new dialog title.

set_caption

Sets the text that goes besides the password field. e.g.: "Password:" .

hildon.GetPasswordDialog.set_caption(new_caption)
new_caption The new dialog caption.

set_max_characters

Sets the maximum number of characters the password dialog accepts.

hildon.GetPasswordDialog.set_max_characters(max_characters)
max_characters The maximum number of characters the password dialog accepts.

get_password

Gets the password entered in the dialog.

hildon.GetPasswordDialog.get_password()
Returns The password entered in the dialog (or the default if one hasn't been entered yet).

hildon.GridItem

hildon.GridItem is intended to be used with hildon.Grid.

Description

hildon.GridItem is an uninteractive widget representing item on hildon.Grid. Each item has an icon and a label. Depending on current style, icon can be either above or to the left of the label.

Ancestry

Up to the first non-hildon ancestor:

... +-- gtk.Container +-- hildon.GridItem

Usage Example

import gtk import hildon window = hildon.Window() window.set_title("Test App") grid = hildon.Grid() grid_item = hildon.GridItem("Calculator") grid.add(grid_item) grid_item = hildon.GridItem("Calendar", "A simple calendar") grid.add(grid_item) window.add(grid) window.show_all() gtk.main()

Properties

Name Access Description
"emblem-type" Write The emblem's basename.
"icon-basename" Write The icon's basename.

Constructor

Creates a new hildon.GridItem widget.

hildon.GridItem(icon_basename, label)
icon_basename Icon base name.
label (optional) Text label for icon.
Returns A new hildon.GridItem.

Methods

get_emblem_type

Returns emblem's basename.

hildon.GridItem.get_emblem_type()
Returns Emblem's basename.

set_emblem_type

Sets item emblem type.

hildon.GridItem.set_emblem_type(emblem_basename)
emblem_basename Emblem's basename.

hildon.Grid

Intended to be used where ever a number of single tap activatable items need to be presented (e.g. Control Panel applets).

Description

hildon.Grid is a set of application-defineable items that are presented in a table. The form of this table is selected from two modes: large icon mode and small icon mode. In large icon mode, the Grid View items are presented with a large icon and a label underneath it. In small icon mode, the items are presented with a small icon and a label on the right side of the icon. The label of an item is displayed within a band of colour displayed as a background colour as wide as the maximum text width. This allows the text to have focus as well as be legible when displayed upon a black or dark background image. Long names are truncated with an ellipsis ("...") appended.

Ancestry

Up to the first non-hildon ancestor:

... +-- gtk.Container +-- hildon.Grid

Usage Example

See hildon.GridItem

Properties

Name Access Description
"empty_label" Read/Write Label to show when grid has no items.
"style" Read/Write Widget's Style. Setting style sets widget size, spacing, label position, number of columns, and icon sizeLabel to show when grid has no items.
"scrollbar-position" Read/Write View (scrollbar) position.

Style Properties

Name Access Description
"item_height" Read Total height of an item.
"item_hspacing" Read Item horizontal spacing. Margin between two columns and labels.
"item_vspacing" Read Item vertical spacing. Icon on right: Margin between rows / Icon at bottom: Vertical margin between label and icon.
"label_hspacing" Read Margin between focus edge and item edge.
"label_vspacing" Read Vertical margin between item and label.
"label_height" Read Height of icon label.
"n_columns" Read Number of columns.
"label_pos" Read Position of label related to the icon.
"icon_size" Read Size of the icon in pixels (width).
"emblem_size" Read Size of the emblem in pixels.

Constructor

Creates a new hildon.Grid widget.

hildon.Grid()
Returns A new hildon.Grid.

Methods

set_style

Sets style. Setting style sets widget size, spacing, label position, number of columns, and icon size.

hildon.Grid.set_style(style_name)
style_name Style name.

get_style

Returns the name of the style being currently used.

hildon.Grid.get_style()
Returns Style name.

set_scrollbar_pos

Sets view (scrollbar) to specified position.

hildon.Grid.set_scrollbar_pos(scrollbar_pos)
scrollbar_pos New position (in pixels).

get_scrollbar_pos

Returns position of scrollbar (in pixels).

hildon.Grid.get_scrollbar_pos()
Returns Scrollbar position.

activate_child

Emits a signal to tell HildonGridItem was actiavated.

hildon.Grid.activate_child(item)
item Grid item to be activated.

Signals

activate-child

Emitted when a child (hildon.GridItem) is activated either by tapping on it or by pressing enter.

def callback(grid, grid_item, user_param1, ...)
grid hildon.Grid that received the signal.
grid_item hildon.GridItem that was activated.
user_param1 The first user parameter (if any) specified with the connect() method.
... Additional user parameters (if any).

popup-context-menu

Emitted when popup-menu is supposed to open. Used for tap-and-hold.

def callback(grid, grid_item, user_param1, ...)
grid hildon.Grid that received the signal.
grid_item A hildon.GridItem.
user_param1 The first user parameter (if any) specified with the connect() method.
... Additional user parameters (if any).

hildon.HVolumebar

hildon.HVolumebar

A widget that displays a horizontal volume bar.

Description

The hildon.HVolumebar widget displays a horizontal volume bar that allows increasing or decreasing volume within a pre-defined range, and muting the volume by clicking on a specific mute icon.

Ancestry

Up to the first non-hildon ancestor:

... +-- gtk.Container +-- hildon.Volumebar +-- hildon.HVolumebar

Usage Example

import gtk import hildon def level_changed(volumebar, label): label.set_text("Volume level: %s" % volumebar.get_level()) def mute_toggled(volumebar, label): if volumebar.get_mute(): label.set_text("Volume level: Mute") else: level_changed(volumebar, label) window = hildon.Window() window.set_title("Test App") label = gtk.Label() volumebar = hildon.HVolumebar() volumebar.connect("level_changed", level_changed, label) volumebar.connect("mute_toggled", mute_toggled, label) level_changed(volumebar, label) #Init label text vbox = gtk.VBox(False, 10) vbox.pack_start (volumebar) vbox.pack_start (label) window.add(vbox) window.show_all() gtk.main()

Constructor

Creates a new hildon.HVolumebar widget.

hildon.HVolumebar()
Returns A new hildon.HVolumebar widget.

hildon.NamePasswordDialog

hildon.NamePasswordDialog

A widget which allows a user to enter username and password.

Description

Used to enter a username and password when accessing a password protected function.

Ancestry

Up to the first non-hildon ancestor:

... +-- gtk.Dialog +-- hildon.NamePasswordDialog

Usage Example

import gtk import hildon def on_click(widget, window): dialog = hildon.NamePasswordDialog(window) response = dialog.run() dialog.hide() if response == gtk.RESPONSE_OK: widget.set_label("Name: %s\nPassword: %s" % (dialog.get_name(), dialog.get_password())) else: widget.set_label("Enter name and password") dialog.destroy() window = hildon.Window() window.set_title("Test App") button = gtk.Button("Enter name and password") button.connect("clicked", on_click, window) window.add(button) window.show_all() gtk.main()

Properties

Name Access Description
"content" Read/Write Set content for content label.
"name" Read/Write Set content for name entry.
"password" Read/Write Set content for password entry.

Constructor

Creates a new hildon.NamePasswordDialog.

hildon.NamePasswordDialog(parent)
parent Its parent window.
Returns A new hildon.NamePasswordDialog.

Methods

get_name

Gets the text that's in the name entry.

hildon.NamePasswordDialog.get_name()
Returns The text that's in the name entry.

get_password

Gets the text that's in the password entry.

hildon.NamePasswordDialog.get_password()
Returns The text that's in the password entry.

set_domain

Sets the optional descriptive text.

hildon.NamePasswordDialog.set_domain(domain)
domain The domain or some other descriptive text to be set.

hildon.Note

hildon.Note Confirmation

 

hildon.Note Information

A widget to ask confirmation from the user or to show some information to him.

Description

Notes are used to ask a confirmation (Ok/Cancel/etc.) from the user. A simple note contains an information text and an Ok-button to be pressed. Additional features can be e.g. progressbars or animations.

Ancestry

Up to the first non-hildon ancestor:

... +-- gtk.Dialog +-- hildon.Note

Usage Example

Confirmation Note

import gtk import hildon def on_show_note(widget, window, button): dialog = hildon.Note ("confirmation", (window, "Are you sure?", gtk.STOCK_DIALOG_WARNING) ) dialog.set_button_texts ("Yes", "No") response = dialog.run() dialog.destroy() if response == gtk.RESPONSE_OK: button.set_label("Confirmed") else: button.set_label("Canceled") window = hildon.Window() window.set_title("Test App") button = gtk.Button("Click to confirm.") window.add(button) button.connect("clicked", on_show_note, window, button) window.show_all() gtk.main()

Information Note

import gtk import hildon def on_show_note(widget, window): dialog = hildon.Note ("information", (window, "That's some important info.", gtk.STOCK_DIALOG_INFO) ) dialog.set_button_text("Alright") dialog.run() dialog.destroy() window = hildon.Window() window.set_title("Test App") button = gtk.Button("Click to have some info.") window.add(button) button.connect("clicked", on_show_note, window) window.show_all() gtk.main()

Properties

Name Access Description
"note_type" Read/Write/Construct The type of the note dialog.
"description" Read/Write The text that appears in the note dialog.
"icon" Read/Write The name of the icon that appears in the note dialog.
"progressbar" Read/Write The progressbar that appears in the note dialog (if it has one).

Constructor

Creates a new hildon.Note widget. Its type is specified in the note_type argument.

Each type of hildon.Note needs a different set of arguments, both in quantity and in quality. To handle this, note_type states the desired type and note_tuple contains a tuple having the arguments needed by the specified note type. The following table relates a note type with its correspondent note_type value and note_tuple format:

Note Type note_type value note_tuple format
Confirmation "confirmation" (parent, description, icon_name(optional))
Information "information" (parent, description, icon_name(optional))
A progress bar with a "Cancel" button "cancel_with_progress_bar" (parent, description, progress_bar)

 

Tuple Arguments
parent Its parent window.
description The note's message/description.
icon_name (optional) Name of the icon to be used in the dialog (e.g.: gtk.STOCK_DIALOG_WARNING). If not specified, the default icon will be used.
progress_bar The gtk.ProgressBar to be used by this note.

 

hildon.Note(note_type, note_tuple)
note_type The type of the Note widget.
note_tuple A tuple containing the construction parameters according to the note type specified in note_type
Returns A new hildon.Note widget.

Methods

set_button_text

Sets the button text to be used by this hildon.Note widget.

hildon.Note.set_button_text(text)
text Sets the button text and if there are two buttons in the dialog the button's texts will be <text> and "Cancel".

set_button_texts

Sets the button texts to be used by this hildon.Note widget.

hildon.Note.set_button_texts(textOk, textCancel)
textOk The new text for the "Ok" button.
textCancel The new text for the "Cancel" button.

hildon.NumberEditor

hildon.NumberEditor

A widget used to set a number.

Description

hildon.NumberEditor is used to set a number from a specific range. There are two buttons to scroll the value in the number field and manual input is also possible.

Ancestry

Up to the first non-hildon ancestor:

... +-- gtk.Container +-- hildon.NumberEditor

Usage Example

import gtk import hildon window = hildon.Window() window.set_title("Test App") number_editor = hildon.NumberEditor(0, 10) number_editor.set_value(5) window.add(number_editor) window.show_all() gtk.main()

Properties

Name Access Description
"value" Read/Write The current value of number editor.

Constructor

Creates new number editor with a given range (minimum and maximum allowable values).

hildon.NumberEditor(min, max)
min Minimum allowable value.
max Maximum allowable value.
Returns A new hildon.NumberEditor widget.

Methods

set_range

Sets the editor's number range.

hildon.NumberEditor.set_range(min, max)
min Minimum allowable value.
max Maximum allowable value.

get_value

Gets its current value.

hildon.NumberEditor.get_value()
Returns Editor's current value.

set_value

Sets its current value.

hildon.NumberEditor.set_value(value)
value Editor's current value.

hildon.RangeEditor

hildon.RangeEditor

Used to set a number range from specific limits.

Description

hildon.RangeEditor is used to set a number range/interval from specific limits.

Ancestry

Up to the first non-hildon ancestor:

... +-- gtk.Container +-- hildon.RangeEditor

Usage Example

import gtk import hildon window = hildon.Window() window.set_title("Test App") range_editor = hildon.RangeEditor() range_editor.set_limits(-100, 100) range_editor.set_range(-10, 23) range_editor.set_separator("to") window.add(range_editor) window.show_all() gtk.main()

Properties

Name Access Description
"min" Read/Write/Construct Minimum value in a range.
"max" Read/Write/Construct Maximum value in a range.
"lower" Read/Write/Construct Current value in the entry presenting lower end of selected range.
"higher" Read/Write/Construct Current value in the entry presenting higher end of selected range.
"separator" Read/Write/Construct Separator string to separate lower and higher entries.

Style Properties

Name Access Description
"hildon_range_editor_entry_alignment" Read Hildon RangeEditor entry alignment.
"hildon_range_editor_separator_padding" Read Hildon RangeEditor separaror padding.

Constructor

hildon.RangeEditor contains two gtk.Entry that accepts numbers and minus.

hildon.RangeEditor()
Returns A new hildon.RangeEditor widget.

Methods

get_range

Gets the current range (the lower and higher entry values).

hildon.RangeEditor.get_range()
Returns A tuple of the form (lower, higher) containing the current range set.

set_range

Sets the current range (the lower and higher entry values).

hildon.RangeEditor.set_range(lower, higher)
lower Interval's lower bound.
higher Interval's upper bound.

set_limits

Sets the limits for allowable range values. The range will be forced to stay within these limits.

hildon.RangeEditor.set_limits(min, max)
min Minimum allowable lower bound.
max Maximum allowable upper bound.

get_lower

Gets range's lower entry value.

hildon.RangeEditor.get_lower()
Returns Interval's lower bound.

set_lower

Sets range's lower entry value.

hildon.RangeEditor.set_lower(value)
value Interval's lower bound.

get_higher

Gets range's higher entry value.

hildon.RangeEditor.get_higher()
Returns Interval's upper bound.

set_higher

Sets range's higher entry value.

hildon.RangeEditor.set_higher(value)
value Interval's upper bound.

get_min

Gets the minimun allowable value for range's lower entry.

hildon.RangeEditor.get_min()
Returns Minimum allowable lower bound.

set_min

Sets the minimun allowable value for range's lower entry.

hildon.RangeEditor.Set_min(value)
value Minimum allowable lower bound.

get_max

Gets the maximun allowable value for range's higher entry.

hildon.RangeEditor.get_max()
Returns Maximum allowable upper bound.

set_max

Sets the maximun allowable value for range's higher entry.

hildon.RangeEditor.Set_max(value)
value Maximum allowable upper bound.

get_separator

Gets the string that separates lower and higher entries.

hildon.RangeEditor.get_separator()
Returns String that separates lower and higher entries.

set_separator

Sets the string that separates lower and higher entries.

hildon.RangeEditor.set_separator(separator)
separator String that separates lower and higher entries.

hildon.Seekbar

hildon.Seekbar

hildon.Seekbar is used to seek a place from a content. Can be used eg. to browse a mp3 track.

Description

hildon.Seekbar is used to seek a place from a content. Can be used eg. to browse a mp3 track.

Ancestry

Up to the first non-hildon ancestor:

... +-- gtk.Scale +-- hildon.Seekbar

Usage Example

import gobject import gtk import hildon def increase_fraction(seekbar): if seekbar.get_fraction() + 1 < seekbar.get_total_time(): seekbar.set_fraction(seekbar.get_fraction() + 1) result = True else: seekbar.set_fraction(seekbar.get_total_time()) result = False seekbar.notify("fraction") seekbar.queue_draw() return result; def control_changed(widget, label): label.set_text("Position: %s | Fraction: %s | Total time: %s" % (widget.get_position(), widget.get_fraction(), widget.get_total_time())) def fraction_changed(widget, param_spec, label): control_changed(widget, label) window = hildon.Window() window.set_title("Test App") label = gtk.Label() seekbar = hildon.Seekbar(total_time = 180, fraction = 10) seekbar.set_position(0) seekbar.connect("value-changed", control_changed, label) seekbar.connect("notify::fraction", fraction_changed, label) control_changed(seekbar, label) #Init label text vbox = gtk.VBox(False, 10) vbox.pack_start (seekbar) vbox.pack_start (label) window.add(vbox) gobject.timeout_add(500, increase_fraction, seekbar) window.show_all() gtk.main()

Properties

Name Access Description
"total_time" Read/Write Total playing time of this media file.
"position" Read/Write Current position in this media file.
"fraction" Read/Write Current available fraction of total time. Value ranges from zero to "total_time"

Constructor

Creates a new hildon.Seekbar widget.

hildon.Class(total_time, position, fraction)
total_time Total time.
position Current position within the available fraction.
fraction Current fraction. Must be between zero and total_time.
Returns A new hildon.Seekbar widget.

Methods

get_total_time

Gets the total playing time of stream in seconds.

hildon.Seekbar.get_total_time()
Returns The total time.

set_total_time

Sets the total playing time of stream in seconds.

hildon.Seekbar.set_total_time(time)
time The total time.

get_position

Gets the current position in stream in seconds.

hildon.Seekbar.get_position()
Returns The current position in stream.

set_position

Sets the current position in stream in seconds.

hildon.Seekbar.set_position(time)
time The current position in stream.

get_fraction

Gets current fraction related to the progress indicator. It must be between zero and seekbar's total time.

hildon.Seekbar.get_fraction()
Returns The current fraction related to the progress indicator.

set_fraction

Sets current fraction related to the progress indicator. It must be between zero and seekbar's total time.

hildon.Seekbar.set_fraction(fraction)
fraction The current fraction related to the progress indicator.

hildon.SetPasswordDialog

A 'set password' dialog

 

A 'change password' dialog

Used to receive a new password from user. (User sets the password).

Description

Used to receive a new password from user. (User sets the password).

Ancestry

Up to the first non-hildon ancestor:

... +-- gtk.Dialog +-- hildon.SetPasswordDialog

Usage Example

import gtk import hildon def set_password(widget, label, window): passwordDialog = hildon.SetPasswordDialog(window, False) response = passwordDialog.run() passwordDialog.hide() if response == gtk.RESPONSE_OK: label.set_text("Your ultra-secret password is \"%s\"." % passwordDialog.get_password()) else: label.set_text("No password set.") passwordDialog.destroy() window = hildon.Window() window.set_title("Test App") label = gtk.Label("No password set.") button = gtk.Button("Click set a password") button.connect("clicked", set_password, label, window) vbox = gtk.VBox(False, 10) vbox.pack_start (button) vbox.pack_start (label) window.add(vbox) window.show_all() gtk.main()

Properties

Name Access Description
"domain" Read/Write Set Domain (content) for domain label.
"modify_protection" Read/Write/Construct Only Set type to dialog.
"password" Read/Write The current password set.

Constructor

Creates a new hildon.SetPasswordDialog.

hildon.SetPasswordDialog(parent, modify_protection)
parent Its parent window.
modify_protection True creates a new "change password" dialog and False creates a new "set password" dialog.
Returns A new hildon.SetPasswordDialog.

Methods

get_password

Returns the current password set.

hildon.SetPasswordDialog.get_password()
Returns The current password set.

get_protected

Returns protection mode.

hildon.SetPasswordDialog.get_protected()
Returns Password protection mode ( True when the protection is 'ON' and False when the protection is 'OFF' ) .

set_domain

Sets the optional descriptive text.

hildon.SetPasswordDialog.set_domain(domain)
domain The domain or some other descriptive text to be set.

Class

Bla

Description

Bla

Ancestry

Up to the first non-hildon ancestor:

... +-- gtk.Ancestor +-- hildon.Class

Usage Example

Source code.

Properties

Name Access Description
"prop-name" Read/Write Property description.

Constructor

Bla

hildon.Class(param1)
param1 param1 description
Returns A new something.

Methods

method_name

Bla

hildon.Class.method_name(param1)
param1 Param1 desc

hildon.SortDialog

A sort dialog

A widget for defining sorting order of items.

Description

Sort Dialog is used to define the order in which items are shown in a list.

Ancestry

Up to the first non-hildon ancestor:

... +-- gtk.Dialog +-- hildon.SortDialog

Usage Example

import gtk import hildon def sort(widget, label, window): dialog = hildon.SortDialog(window) sort_keys = ("ham", "spam", "eggs") dialog.add_sort_key(sort_keys[0]) dialog.add_sort_key(sort_keys[1]) dialog.add_sort_key(sort_keys[2]) response = dialog.run() dialog.hide() if response == gtk.RESPONSE_OK: if (dialog.get_sort_order() == gtk.SORT_ASCENDING): sort_order = "ascending" else: sort_order = "descending" label.set_text("Sort by %s, %s" % (sort_keys[dialog.get_sort_key()], sort_order)) else: label.set_text("Canceled") dialog.destroy() window = hildon.Window() window.set_title("Test App") label = gtk.Label("No sorting yet.") button = gtk.Button("Click to sort") button.connect("clicked", sort, label, window) vbox = gtk.VBox(False, 10) vbox.pack_start (button) vbox.pack_start (label) window.add(vbox) window.show_all() gtk.main()

Properties

Name Access Description
"sort-key" Read/Write The currently active sort key.
"sort-order" Read/Write The current sorting order.

Constructor

Creates a new hildon.SortDialog.

hildon.SortDialog(parent)
parent Its parent window.
Returns A new hildon.SortDialog.

Methods

get_sort_key

Gets index to currently active sort key.

hildon.SortDialog.get_sort_key()
Returns An integer which is the index value of the "Sort by" field.

set_sort_key

Sets index to currently active sort key.

hildon.SortDialog.set_sort_key(key)
key An integer which is the index value of the "Sort by" field.

get_sort_order

Gets current sorting order from "Sort order" field.

hildon.SortDialog.get_sort_order()
Returns Current sorting order as a GTK Sort Type constant. That is, either gtk.SORT_ASCENDING or gtk.SORT_DESCENDING.

set_sort_order

Sets current sorting order for "Sort order" field.

hildon.SortDialog.set_sort_order(order)
order Current sorting order as a GTK Sort Type constant. That is, either gtk.SORT_ASCENDING or gtk.SORT_DESCENDING.

add_sort_key

Adds a new sort key and returns its respective index in sort key combobox.

hildon.SortDialog.add_sort_key(sort_key)
sort_key A new combo box's key value.
Returns An integer which is the index of the added combo box's item.

hildon.TimeEditor

A simple widget with entries for hours and minutes and a pm/am indicator as well as a button which pops up a hildon.TimePicker dialog window.

Description

A simple widget with entries for hours and minutes and a pm/am indicator as well as a button which pops up a hildon.TimePicker dialog window.

Ancestry

Up to the first non-hildon ancestor:

... +-- gtk.Container +-- hildon.TimeEditor

Usage Example

TO DO

Properties

Name Access Description
"ticks" Read/Write If editor is in duration mode, contains the duration seconds. If not, contains seconds since midnight.
"show_seconds" Read/Write Controls whether seconds are shown in the editor.
"show_hours" Read/Write Controls whether hours are shown in the editor.
"duration_mode" Read/Write Controls whether the TimeEditor is in duration mode.
"duration_min" Read/Write Minimum allowed duration value.
"duration_max" Read/Write Maximum allowed duration value.

Constructor

Creates a new hildon.TimeEditor widget.

hildon.TimeEditor()
Returns A new hildon.TimeEditor.

Methods

get_time

Gets the time of the hildon.TimeEditor widget. The time returned is always in 24h format.

hildon.TimeEditor.get_time()
Returns A tuple of the form (hours, minutes, seconds).

set_time

Sets the time. If the time specified by the arguments is invalid, the function returns without doing anything else. The time is assumed to be in 24h format.

hildon.TimeEditor.set_time(hours, minutes, seconds)
hours Hours.
minutes Minutes.
seconds Seconds.

get_duration_range

Gets the time range of the duration editor.

hildon.TimeEditor.get_duration_range()
Returns A tuple of the form (min_seconds, max_seconds), with min_seconds being its minimum allowed time in seconds and max_seconds its maximum allowed time in seconds.

set_duration_range

Sets the time range of the duration editor.

hildon.TimeEditor.set_duration_range(min_seconds, max_seconds)
min_seconds Minimum allowed time, in seconds.
max_seconds Maximum allowed time, in seconds.

get_ticks

Returns the current duration, in seconds. This means seconds from midnight, if not in duration mode.

hildon.TimeEditor.get_ticks()
Returns The current duration, in seconds.

set_ticks

Sets the current duration, in seconds. This means seconds from midnight, if not in duration mode.

hildon.TimeEditor.set_ticks(ticks)
ticks The current duration, in seconds.

get_show_seconds

Returns whether the seconds field is being shown or not.

hildon.TimeEditor.get_show_seconds()
Returns True if seconds field is being shown and False otherwise.

set_show_seconds

This method shows or hides the seconds field.

hildon.TimeEditor.set_show_seconds(show_seconds)
show_seconds True to show or False to hide the seconds field.

get_duration_mode

 

hildon.TimeEditor.get_duration_mode()
Returns True if it's in duration mode.

set_duration_mode

This method sets the duration editor mode, in which the maximum hours is 99 and the hildon.TimePicker is disabled.

hildon.TimeEditor.set_duration_mode(duration_mode)
duration_mode True to set it in duration mode.

get_duration_min

Returns the shortest duration hildon.TimeEditor allows in duration mode.

hildon.TimeEditor.get_duration_min()
Returns Mimimum allowed duration, in seconds.

set_duration_min

Sets the minimum allowed duration for the duration mode. Note: Has no effect in time mode.

hildon.TimeEditor.get_duration_min(duration_min)
duration_min Mimimum allowed duration, in seconds.

get_duration_max

Returns the longest duration hildon.TimeEditor allows in duration mode.

hildon.TimeEditor.get_duration_max()
Returns Maximum allowed duration, in seconds.

set_duration_max

Sets the maximum allowed duration for the duration mode. Note: Has no effect in time mode.

hildon.TimeEditor.get_duration_max(duration_max)
duration_max Maximum allowed duration, in seconds.

hildon.TimePicker

hildon.TimePicker

A dialog popup widget which lets the user set a time.

Description

hildon.TimePicker is a dialog popup widget which lets the user set a time. using up/down arrows on hours and minutes. There are two arrows for minutes, so that minutes can be added also in 10min steps.

Ancestry

Up to the first non-hildon ancestor:

... +-- gtk.Dialog +-- hildon.TimePicker

Usage Example

import gtk import hildon def pick_time(widget, label, time_picker): response = time_picker.run() time_picker.hide() if response == gtk.RESPONSE_OK: label.set_text("Time is %s hours and %s minutes." % time_picker.get_time()) window = hildon.Window() window.set_title("Test App") label = gtk.Label("No time picked yet.") time_picker = hildon.TimePicker(window) button = gtk.Button("Click to pick a time") button.connect("clicked", pick_time, label, time_picker) vbox = gtk.VBox(False, 10) vbox.pack_start (button) vbox.pack_start (label) window.add(vbox) window.show_all() gtk.main()

Properties

Name Access Description
"minutes" Read/Write The selected time in minutes since midnight.
"arrow-width" Read Increase/decrease arrows width.
"arrow-height" Read Increase/decrease arrows height.

Constructor

Hildon Time Picker shows a time picker dialog. Close button is placed in dialog's action area and time picker is placed in dialogs vbox. Actual time picker consists two gtk.Label fields, one for hours and other for minutes, arrow buttons and an AM/PM button. A ":" is placed between hours and minutes fields.

hildon.TimePicker(parent)
parent Its parent window.
Returns A new hildon.TimePicker.

Methods

get_time

Gets the time currently set in the dialog.

hildon.Class.get_time()
Returns A tuple of the form (hours, minutes), with hours being in 24h format.

set_time

Sets the time to be shown in the dialog.

hildon.Class.set_time(hours, minutes)
hours Hours in 24h format.
minutes Minutes.

hildon.Volumebar

Base class for widgets that displays a volume bar.

Description

hildon.Volumebar is a base class for widgets that displays a volume bar that allows increasing or decreasing volume within a pre-defined range and muting the volume by clicking on a specific mute icon.

Ancestry

Up to the first non-hildon ancestor:

... +-- gtk.Container +-- hildon.Volumebar

Properties

Name Access Description
"can-focus" Read/Write/Construct The widget focusablility. True is focusable.
"has_mute" Read/Write/Construct Whether the mute button is visible. Default value is True.
"level" Read/Write Current volume level. Varies from 0.0 to 100.0.
"mute" Read/Write Whether volume is muted.

Signals

"mute_toggled" def callback(widget, user_param1, ...)
"level_changed" def callback(widget, user_param1, ...)

Methods

get_level

Gets the volume level, ranging between 0.0 and 100.0 (inclusive).

hildon.Volumebar.get_level()
Returns The volume level

set_level

Sets the volume level, ranging between 0.0 and 100.0 (inclusive).

hildon.Volumebar.set_level(level)
level The new volume level

get_mute

Gets mute status.

hildon.Volumebar.get_mute()
Returns True if it's mute and False otherwise.

set_mute

Sets mute status.

hildon.Volumebar.set_mute(mute)
mute True to mute and False otherwise.

level_change

Emits "level_changed" signal to the given volumebar. This method is mainly used by derived classes.

hildon.Volumebar.level_change()

get_adjustment

Gets the gtk.Adjustment used in volumebar.

This is a temporary solution until volumebar is restructured to be a child class of gtk.Range.

hildon.Volumebar.get_adjustment()
Returns A gtk.Adjustment used by the volume bar.

hildon.VVolumebar

hildon.VVolumebar

A widget that displays a vertical volume bar.

Description

The hildon.VVolumebar widget displays a vertical volume bar that allows increasing or decreasing volume within a pre-defined range, and muting the volume by clicking on a specific mute icon.

Ancestry

Up to the first non-hildon ancestor:

... +-- gtk.Container +-- hildon.Volumebar +-- hildon.VVolumebar

Usage Example

import gtk import hildon def level_changed(volumebar, label): label.set_text("Volume level: %s" % volumebar.get_level()) def mute_toggled(volumebar, label): if volumebar.get_mute(): label.set_text("Volume level: Mute") else: level_changed(volumebar, label) window = hildon.Window() window.set_title("Test App") label = gtk.Label() volumebar = hildon.VVolumebar() volumebar.connect("level_changed", level_changed, label) volumebar.connect("mute_toggled", mute_toggled, label) level_changed(volumebar, label) #Init label text vbox = gtk.VBox(False, 10) vbox.pack_start (volumebar) vbox.pack_start (label) window.add(vbox) window.show_all() gtk.main()

Constructor

Creates a new hildon.VVolumebar widget.

hildon.VVolumebar()
Returns A new hildon.VVolumebar widget.

hildon.WeekdayPicker

hildon.WeekdayPicker

A widget for selecting weekday(s).

Description

Weekday picker supports non-mutually exclusive selection of days of the week. Selected days of the week are shown with a pushed-in effect.

Weekday picker is used where users are required to pick days on which a certain event should take place, for example, which days a Calendar event should be repeated on. It is used in Calendar in the Repeat dialog, in Tasks in the Repeat dialog and in the Email set-up wizard.

Ancestry

Up to the first non-hildon ancestor:

... +-- gtk.Container +-- hildon.WeekdayPicker

Signals

"selection_changed" def callback(widget, int, user_param1, ...)

Constructor

Creates a new hildon.WeekdayPicker widget.

hildon.WeekdayPicker()
Returns A new hildon.WeekdayPicker widget.

Methods

set_day

Set a day.

hildon.WeekdayPicker.set_day(day)
day Day to be set. Acceptable values are: "monday", "tuesday", "wednesday", "thursday", "friday", "saturday" and "sunday".

unset_day

Deselect a day.

hildon.WeekdayPicker.set_day(day)
day Day to be deselected. Acceptable values are: "monday", "tuesday", "wednesday", "thursday", "friday", "saturday" and "sunday".

toggle_day

Toggle current status of the specified weekday.

hildon.WeekdayPicker.toggle_day(day)
day Day to be toggled. Acceptable values are: "monday", "tuesday", "wednesday", "thursday", "friday", "saturday" and "sunday".

set_all

Select all weekdays.

hildon.WeekdayPicker.set_all()

unset_all

Deselect all weekdays.

hildon.WeekdayPicker.unset_all()

isset_day

Check if the specified day of the week is selected.

hildon.WeekdayPicker.isset_day(day)
day A day of the week. Acceptable values are: "monday", "tuesday", "wednesday", "thursday", "friday", "saturday" and "sunday".
Returns True if it's selected and False otherwise.


Improve this page