Window implements atk.ImplementorIface and gtk.Buildable .
clipboard-operation : Run First
Window is a GTK widget which represents a top-level window in the Hildon framework. It is derived from gtk.Window and provides additional commodities specific to the Hildon framework.
Window s can have a menu attached, which is toggled with a hardware key or by tapping on the window frame. This menu can be either a gtk.Menu or a AppMenu (set with Window.set_main_menu() and Window.set_app_menu() respectively). Only one type of menu can be used at the same time. In Hildon 2.2, AppMenu is the recommended menu to use.
Similarly, a Window can have several toolbars attached. These can be added with Window.add_toolbar() . In addition to those, a Window can also have a EditToolbar . To add it to the window use Window.set_edit_toolbar() .
import gtk
import hildon
window = hildon.Window()
toolbar = create_toolbar()
menu = create_menu()
icon_pixbuf = create_icon()
window.set_app_menu(menu)
window.add_toolbar(toolbar)
window.fullscreen()
window.set_urgency_hint(True)
window.set_icon(window, icon_pixbuf)
Value | Meaning |
---|---|
WINDOW_CO_COPY | Areaing follows pointer |
WINDOW_CO_CUT | Areaing uses physics to “spin” the widget |
WINDOW_CO_PASTE | Automatically chooses between push and accel modes |
Adds child to the Window and creates a scrollbar for it. Similar to adding first a GtkScrolledWindow and then child to it.
Parameter: | child – gtk.Widget |
---|
Sets the menu to be used for this window. This menu overrides a program-wide menu that may have been set with HildonProgram.set_common_menu() . Pass None to remove the current menu. Window takes ownership of the passed menu and you’re not supposed to free it yourself anymore.
Note that if you’re using a AppMenu rather than a gtk.Menu you should use Window.set_app_menu() instead.
Parameter: | menu – The gtk.Menu to be used for this Window |
---|
Gets the gtk.Menu assigned to the HildonAppview . Note that the window is still the owner of the menu.
Note that if you’re using a AppMenu rather than a gtk.Menu you should use Window.get_app_menu() instead.
Returns: | The gtk.Menu assigned to this application view. |
---|
Sets the menu to be used for this window. Pass None to remove the current menu. Any reference to a previous menu will be dropped. Window takes ownership of the passed menu and you’re not supposed to free it yourself anymore.
Note that if you’re using a gtk.Menu rather than a AppMenu you should use Window.set_main_menu() instead.
Parameter: | menu – a AppMenu to be used for this window |
---|
Returns the AppMenu assigned to self, or None if it’s unset. Note that the window is still the owner of the menu.
Note that if you’re using a gtk.Menu rather than a AppMenu you should use Window.get_main_menu() instead.
Returns: | a AppMenu |
---|
Warning
Window.set_menu() is deprecated and should not be used in newly-written code. Hildon 2.2: use Window.set_main_menu()
Sets the menu to be used for this window. This menu overrides a program-wide menu that may have been set with HildonProgram.set_common_menu() . Pass None to remove the current menu. Window takes ownership of the passed menu and you’re not supposed to free it yourself anymore.
Note: Window.set_menu() calls GtkWidget.show_all() for the gtk.Menu . To pass control about visibility to the application developer, Window.set_main_menu() was introduced, which doesn’t do this.
Parameter: | menu – The gtk.Menu to be used for this Window |
---|
Warning
Window.get_menu() is deprecated and should not be used in newly-written code. In Hildon 2.2 this function has been renamed to Window.get_main_menu() for consistency
Returns: | a gtk.Menu |
---|
Adds a toolbar to the window. Note that the toolbar is not automatically shown. You need to call GtkWidget.show_all() on it to make it visible. It’s also possible to hide the toolbar (without removing it) by calling GtkWidget.hide()
Parameter: | toolbar – A gtk.Toolbar to add to the Window |
---|
Removes a toolbar from the window. Note that this decreases the refference count on the widget. If you want to keep the toolbar alive call GObject.ref() before calling this function.
Parameter: | toolbar – A gtk.Toolbar to remove from the Window |
---|
Adds a EditToolbar to the window. Note that the toolbar is not automatically shown. You need to call gtk.Widget.show() on it to make it visible. It’s also possible to hide the toolbar (without removing it) by calling gtk.Widget.hide() .
A window can only have at most one edit toolbar at a time, so the previous toolbar (if any) is replaced after calling this function.
Parameter: | toolbar – A EditToolbar , or None to remove the current one. |
---|
Returns whether the Window is currenty activated by the window manager.
Returns: | True self is currently activated, False otherwise. |
---|
Sets the marked up title of window. The accepted format is the one used in Pango (see PangoMarkupFormat ) with the exception of span.
Note that you need support from the window manager for this title to be used. See gtk.Window.set_title() for the standard way of setting the title of a window.
Parameter: | markup – the marked up title of the window, or None to unset the current one |
---|
Gets the marked up title of the window title. See Window.set_markup()
Returns: | the marked up title of the window, or None if none has been set explicitely. The returned string is owned by the widget and must not be modified or freed. |
---|
Name | type | Access | Default | Meaning |
---|---|---|---|---|
is-topmost | bool | Read | False | Whether the window is currently activated by the window manager. |
markup | str | Read / Write | None | The Markup Text for the window title. |
Name | type | Access | Default | Meaning |
---|---|---|---|---|
borders | gtk.Border | Read | Size of graphical window borders. | |
toolbar-borders | gtk.Border | Read | Size of graphical toolbar borders. |
The clipboard-operation signal.
- hildon.user_function(hildon_window, arg1, user_data)¶
Parameters:
- hildon_window – the object which received the signal.
- operation – the operation that happened
- user_data – user data set when the signal handler was connected.
StackableWindow implements atk.ImplementorIface and gtk.Buildable .
The StackableWindow is a GTK+ widget which represents a top-level window in the Hildon framework. It is derived from Window . Applications that use stackable windows are organized in a hierarchical way so users can go from any window back to the application’s root window.
The user can only see and interact with the window on top of the stack. Although all other windows are mapped and visible, they are obscured by the topmost one so in practice they appear as if they were hidden.
To add a window to the stack, just use gtk.Widget.show_all() . The previous one will be obscured by the new one. When the new window is destroyed, the previous one will appear again.
Alternatively, you can remove a window from the top of the stack without destroying it by using WindowStack.pop(). The window will be automatically hidden and the previous one will appear.
For advanced details on stack handling, see WindowStack
import gtk
import hildon
def show_new_window(widget):
win = hildon.StackableWindow()
# ... configure new window
win.show_all()
def main():
program = hildon.hildon_program_get_instance()
win = hildon.StackableWindow()
win.set_title("Main window")
# ... add some widgets to the window
button.connect("clicked", show_new_window, None);
win.connect("destroy", gtk.main_quit, None)
# This call show the window and also add the window to the stack
win.show_all()
gtk.main()
if __name__ == "__main__":
main()
Creates a new StackableWindow .
Returns: | A StackableWindow |
---|
Returns the stack where window self is on, or None if the window is not stacked.
Returns: | a WindowStack , or None |
---|
Warning
StackableWindow.set_main_menu() is deprecated and should not be used in newly-written code. Hildon 2.2: use Window.set_app_menu()
Parameter: | menu – a AppMenu to be used for this window |
---|
The WindowStack is an object used to represent a stack of windows in the Hildon framework.
Stacks contain all StackableWindow s that are being shown. The user can only interact with the topmost window from each stack (as it covers all the others), but all of them are mapped and visible from the Gtk point of view.
Each window can only be in one stack at a time. All stacked windows are visible and all visible windows are stacked.
Each application has a default stack, and windows are automatically added to it when they are shown with gtk.Widget.show_all() .
Additional stacks can be created at any time using WindowStack() . To add a window to a specific stack, use WindowStack.push_1() (remember that, for the default stack, gtk.Widget.show_all() can be used instead).
To remove a window from a stack use WindowStack.pop_1() , or simply gtk.Widget.hide() .
For more complex layout changes, applications can push and/or pop several windows at the same time in a single step. See WindowStack.push() , WindowStack.pop() and WindowStack.pop_and_push() for more details.
Returns the default window stack. This stack always exists and doesn’t need to be created by the application.
Returns: | the default WindowStack |
---|
Creates a new WindowStack . The stack is initially empty.
Returns: | a new WindowStack |
---|
Returns the number of windows in stack
Returns: | Number of windows in stack |
---|
Returns the list of windows on this stack (topmost first). The widgets in the list are not individually referenced.
Returns: | a newly-allocated list of StackableWindow s |
---|
Returns the window on top of stack. The stack is never modified.
Returns: | the window on top of the stack, or None if the stack is empty. |
---|
Pushes all windows to the top of stack, and shows them. Everything is done in a single transition, so the user will only see the last window. None of the windows must be already stacked.
Parameters: |
|
---|
Pushes all windows in list to the top of stack, and shows them. Everything is done in a single transition, so the user will only see the last window in list during this operation. None of the windows must be already stacked.
Parameter: | list – A list of HildonStackableWindow s to push |
---|
Adds win to the top of stack, and shows it. The window must not be already stacked.
win: A StackableWindow
Pops nwindows windows from stack, and hides them. Everything is done in a single transition, so the user will not see any of the windows being popped in this operation.
If popped_windows is not None , the list of popped windows is stored there (ordered bottom-up). That list must be freed by the user.
nwindows: Number of windows to pop
popped_windows: if non-None , the list of popped windows is stored here
Removes the window on top of stack, and hides it. If the stack is empty nothing happens.
Returns: | the window on top of the stack, or None if the stack is empty. |
---|
Pops nwindows windows from stack (and hides them), then pushes all passed windows (and shows them). Everything is done in a single transition, so the user will only see the last pushed window. None of the pushed windows must be already stacked.
If popped_windows is not None , the list of popped windows is stored there (ordered bottom-up). That list must be freed by the user.
nwindows: Number of windows to pop.
popped_windows: if non-None , the list of popped windows is stored here
win1: The first window to push
...: A None -terminated list of additional StackableWindow s to push.
Pops nwindows windows from stack (and hides them), then pushes all windows in list (and shows them). Everything is done in a single transition, so the user will only see the last window from list. None of the pushed windows must be already stacked.
If popped_windows is not None , the list of popped windows is stored there (ordered bottom-up). That list must be freed by the user.
nwindows: Number of windows to pop.
popped_windows: if non-None , the list of popped windows is stored here
list: A list of StackableWindow s to push
The window-group property
Name | type | Access | Default | Meaning |
---|---|---|---|---|
window-group | gtk.WindowGroup | Read / Write / Construct Only |
GtkWindowGroup that all windows on this stack belong to.
Button implements atk.ImplementorIface and gtk.Buildable .
The Button is a GTK widget which represents a clickable button. It is derived from the GtkButton widget and provides additional commodities specific to the Hildon framework.
The height of a Button can be set to either “finger” height or “thumb” height. It can also be configured to use halfscreen or fullscreen width. Alternatively, either dimension can be set to “auto” so it behaves like a standard GtkButton .
The Button can hold any valid child widget, but it usually contains two labels, named title and value, and it can also contain an image. The contents of the button are packed together inside a gtk.Alignment and they do not expand by default (they don’t use the full space of the button).
To change the alignment of both labels, use gtk.Button.set_alignment().
To make them expand and use the full space of the button, use Button.set_alignment() .
To change the relative alignment of each label, use Button.set_title_alignment() and Button.set_value_alignment() .
In hildon-button-example.c included in the Hildon distribution you can see examples of how to create the most common button layouts.
If only one label is needed, GtkButton can be used as well, see also GtkButton.
def button_clicked(button, user_data=None):
title = button.get_title()
value = button.get_value()
print "Button clicked with title %s and value %s" % (title, value)
def create_button():
button = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
hildon.BUTTON_ARRANGEMENT_VERTICAL)
button.set_text("Some title", "some value")
image = gtk.image_new_from_stock(gtk.STOCK_INFO, gtk.ICON_SIZE_BUTTON)
button.set_image(image)
button.set_image_position(gtk.POS_RIGHT)
button.set_alignment(button, 0.0, 0.5)
button.connect("clicked", button_clicked)
return button
Value | Meaning |
---|---|
BUTTON_ARRANGEMENT_HORIZONTAL | Labels are arranged from left to right |
BUTTON_ARRANGEMENT_VERTICAL | Labels are arranged from top to bottom |
Describes the arrangement of labels inside a Button
Value | Meaning |
---|---|
BUTTON_STYLE_NORMAL | The button will look like a Button |
BUTTON_STYLE_PICKER | The button will look like a PickerButton |
Describes the visual style of a Button
Creates a new Button with two labels, title and value.
If you just don’t want to use one of the labels, set it to None . You can set it to a non-None value at any time later using Button.set_title() or Button.set_value() .
Parameters: |
|
---|---|
Parma value: | Value of the button (secondary label), or None |
Returns: | a new Button |
Sets the title (main label) of button to title.
This will clear any previously set title.
If title is set to None , the title label will be hidden and the value label will be realigned.
Parameter: | title – a new title (main label) for the button, or None |
---|
Sets the value (secondary label) of button to value.
This will clear any previously set value.
If value is set to None , the value label will be hidden and the title label will be realigned.
Parameter: | value – a new value (secondary label) for the button, or None |
---|
Fetches the text from the main label (title) of button, as set by Button.set_title() or Button.set_text() . If the label text has not been set the return value will be None . This will be the case if you create an empty button to use as a container.
Returns: | The text of the title label. This string is owned by the widget and must not be modified or freed. |
---|
Fetches the text from the secondary label (value) of button, as set by Button.set_value() or Button.set_text() . If the label text has not been set the return value will be None . This will be the case if you create an empty button to use as a container.
Returns: | The text of the value label. This string is owned by the widget and must not be modified or freed. |
---|
Convenience function to change both labels of a Button
Parameters: |
|
---|
Sets the image of button to the given widget. The previous image (if any) will be removed.
Parameter: | image – a widget to set as the button image |
---|
Gets the widget that is currenty set as the image of button, previously set with Button.set_image()
Returns: | a gtk.Widget or None in case there is no image |
---|
Sets the position of the image inside button. Only gtk.POS_LEFT and gtk.POS_RIGHT are currently supported.
Parameter: | position – the position of the image (gtk.POS_LEFT or gtk.POS_RIGHT) |
---|
Sets the alignment of the contents of the widget. If you don’t need to change xscale or yscale you can just use gtk.Button.set_alignment() instead.
Note that for this method to work properly the, child widget of button must be a gtk.Alignment . That’s what Button uses by default, so this function will work unless you add a custom widget to button.
Parameters: |
|
---|
Sets the alignment of the title label. See also Button.set_alignment() to set the alignment of the whole contents of the button.
Parameters: |
|
---|
Sets the alignment of the value label. See also Button.set_alignment() to set the alignment of the whole contents of the button.
Parameters: |
|
---|
Sets the alignment of the image. See also Button.set_alignment() to set the alignment of the whole contents of the button.
Parameters: |
|
---|
Adds the title label of button to size_group.
Parameter: | group – A gtk.SizeGroup for the button title (main label) |
---|
Adds the value label of button to size_group.
Parameter: | group – A gtk.SizeGroup for the button value (secondary label) |
---|
Adds the image of button to size_group. You must add an image using Button.set_image() before calling this function.
Parameter: | size_group – A gtk.SizeGroup for the button image |
---|
Convenience function to add title, value and image to size groups. None size groups will be ignored.
Parameters: |
|
---|
Sets the style of button to style. This changes the visual appearance of the button (colors, font sizes) according to the particular style chosen, but the general layout is not altered.
Use BUTTON_STYLE_NORMAL to make it look like a normal Button , or BUTTON_STYLE_PICKER to make it look like a PickerButton .
Parameter: | style – A ButtonStyle for button. |
---|
Gets the visual style of the button.
Returns: | a ButtonStyle |
---|
Name | type | Access | Default | Meaning |
---|---|---|---|---|
arrangement | ButtonArrangement | Write / Construct Only | BUTTON_ARRANGEMENT_HORIZONTAL | How the buttons must be arranged. |
size | SizeType | Write / Construct Only | Size request for the button. | |
style | ButonStyle | Read / Write | BUTTON_STYLE_NORMAL | Visual style of the button. |
title | str | Read / Write | None | Text of the title label inside the button. |
value | str | Read / Write | None | Text of the value label inside the button. |
Name | type | Access | Default | Meaning |
---|---|---|---|---|
horizontal-spacing | int | Read | 25 | Horizontal spacing between the title and value labels, when in horizontal mode. |
vertical-spacing | int | Read | 5 | Vertical spacing between the title and value labels, when in vertical mode. |
CheckButton implements atk.ImplementorIface and gtk.Buildable .
HildonCheckButton is a button containing a label and a check box which will remain ‘pressed-in’ when clicked. Clicking again will make the check box toggle its state.
The state of a HildonCheckButton can be set using hildon.check_button_set_active() , and retrieved using hildon.check_button_get_active() . The label can be set using gtk.Button.set_label() and retrieved using gtk.Button.get_label() .
Note
HildonCheckButton does NOT support an image, so don’t use gtk.Button.set_image() .
def button_toggled(checkbutton):
if (checkbutton.get_active()):
print "Button is active"
else:
print "Button is not active"
def create_check_button():
button = hildon.CheckButton(gtk.HILDON_SIZE_AUTO)
button.set_label("Click me")
button.connect("toggled", button_toggled)
return button
Creates a new HildonCheckButton .
Parameter: | size – Flags indicating the size of the new button |
---|---|
Returns: | A newly created HildonCheckButton |
Sets the status of a HildonCheckButton . Set to True if you want button to be ‘pressed-in’, and False to raise it. This action causes the “toggled” signal to be emitted.
Parameter: | is_active – new state for the button |
---|
Gets the current state of button.
Returns: | True if button is active, False otherwise. |
---|
The checkbox-size style property
Name | type | Access | Default | Meaning |
---|---|---|---|---|
checkbox-size | int | Read | 26 | Size of the check box. |
The toggled signal
Emitted when the HildonCheckButton ‘s state is changed.
Parameter: | user_data – user data set when the signal handler was connected. |
---|
HildonPickerButton implements atk.ImplementorIface and gtk.Buildable .
PickerButton is a widget that lets the user select a particular item from a list. Visually, it’s a button with title and value labels that brings up a PickerDialog . The user can then use this dialog to choose an item, which will be displayed in the value label of the button.
You should create your own TouchSelector at convenience and set it to the PickerButton with PickerButton.set_selector() . For the common use cases of buttons to select date and time, you can use DateButton and TimeButton .
Creates a new HildonPickerButton . See hildon.Button() for details on the parameters.
Parameters: |
|
---|---|
Returns: | a newly created HildonPickerButton |
Sets selector as the TouchSelector to be shown in the PickerDialog that button brings up.
Parameter: | selector – a TouchSelector |
---|
Retrieves the TouchSelector associated to button.
Returns: | a TouchSelector |
---|
Sets the active item of the TouchSelector associated to button to index. If the selector has several columns, only the first one is used.
Parameter: | index – the index of the item to select, or -1 to have no active item |
---|
Returns the index of the currently active item, or -1 if there’s no active item. If the selector has several columns, only the first one is used.
Returns: | an integer which is the index of the currently active item, or -1 if there’s no active item. |
---|
Gets the text used in the PickerDialog that is launched by button. If no custom text is set, then None is returned.
Returns: | the custom string to be used, or None if the default “done-button-text” is to be used. |
---|
Sets a custom string to be used in the “done” button in PickerDialog . If unset, the default “done-button-text” property value will be used.
Parameter: | done_button_text – a string |
---|
Name | type | Access | Default | Meaning |
---|---|---|---|---|
done-button-text | str | Read / Write | None | The text for the “done” button in the dialog launched. |
touch-selector | TouchSelector | Read / Write | TouchSelector | Widget to be launched on button clicked. |
The value-changed signal
The ::value-changed signal is emitted each time the user chooses a different item from the TouchSelector related, and the value label gets updated.
Parameters: |
|
---|
HildonDateButton implements atk.ImplementorIface and gtk.Buildable .
HildonDateButton is a widget that shows a text label and a date, and allows the user to select a different date. Visually, it’s a button that, once clicked, presents a PickerDialog containing a HildonDateSelector . Once the user selects a different date from the selector, this will be shown in the button.
Creates a new HildonDateButton . See hildon_button_new() for details on the parameters.
Parameters: |
|
---|---|
Returns: | a new HildonDateButton |
Creates a new HildonDateButton with a specific valid range of years. See hildon.DateSelector.new_with_year_range() for details on the range.
Parameters: |
|
---|---|
Returns: | a new HildonDateButton |
Retrieves currently selected date from button.
Parameters: |
|
---|
Sets the date in button. The date set will be displayed and will be the default selected option on the shown HildonDateSelector .
Parameters: |
|
---|
PickerButton TimeButton
HildonTimeButton implements atk.ImplementorIface and gtk.Buildable .
HildonTimeButton is a widget that shows a text label and a time, and allows the user to select a different time. Visually, it’s a button that, once clicked, presents a PickerDialog containing a HildonTimeSelector . Once the user selects a different time from the selector, this will be shown in the button.
Creates a new HildonTimeButton . See hildon.Button() for details on the parameters.
Parameters: |
|
---|---|
Returns: | a new HildonTimeButton |
Creates a new HildonTimeButton . See hildon.Button() for details on the parameters.
Parameters: |
|
---|---|
Returns: | a new HildonTimeButton |
Retrieves the time from button.
Parameters: |
|
---|
Sets the time to be displayed in button. This time will be selected by default on the HildonTimeSelector .
Parameters: |
|
---|
PickerButton DateButton
Banner implements atk.ImplementorIface and gtk.Buildable .
Banner is a small, pop-up window that can be used to display a short, timed notification or information to the user. It can communicate that a task has been finished or that the application state has changed.
Hildon provides convenient funtions to create and show banners. To create and show information banners you can use hildon_banner_show_information() , hildon_banner_show_informationf() or hildon_banner_show_information_with_markup() .
Two more kinds of banners are maintained for backward compatibility but are no longer recommended in Hildon 2.2. These are the animated banner (created with hildon_banner_show_animation() ) and the progress banner (created with hildon_banner_show_progress() ). See hildon_gtk_window_set_progress_indicator() for the preferred way of showing progress notifications in Hildon 2.2.
Information banners dissapear automatically after a certain period. This is stored in the “timeout” property (in miliseconds), and can be changed using set_timeout() .
Note that Banner s should only be used to display non-critical pieces of information.
This function creates and displays an information banner that automatically goes away after certain time period. For each window in your application there can only be one timed banner, so if you spawn a new banner before the earlier one has timed out, the previous one will be replaced.
Parameters: |
|
---|---|
Returns: | the newly created Banner |
This function creates and displays an information banner that automatically goes away after certain time period. For each window in your application there can only be one timed banner, so if you spawn a new banner before the earlier one has timed out, the previous one will be replaced.
Parameters: |
|
---|---|
Returns: | the newly created Banner |
Shows an animated progress notification. It’s recommended not to try to show more than one progress notification at a time, since they will appear on top of each other. You can use progress notifications with timed banners. In this case the banners are located so that you can somehow see both.
Please note that banners are destroyed automatically once the window they are attached to is closed. The pointer that you receive with this function does not contain additional references, so it can become invalid without warning (this is true for all toplevel windows in gtk). To make sure that the banner does not disappear automatically, you can separately ref the return value (this doesn’t prevent the banner from disappearing, just the object from being finalized).
Parameters: |
|
---|---|
Returns: | the newly created Banner |
Warning
hildon_banner_show_animation is deprecated and should not be used in newly-written code. Hildon 2.2: use hildon_gtk_window_set_progress_indicator() instead.
Shows progress notification. See hildon_banner_show_animation for more information.
Parameters: |
|
---|---|
Returns: | the newly created Banner |
Warning
hildon_banner_show_progress is deprecated and should not be used in newly-written code. Hildon 2.2: use hildon_gtk_window_set_progress_indicator() instead.
Sets the text that is displayed in the banner.
Parameter: | text – a new text to display in banner |
---|
Sets the text with markup that is displayed in the banner.
Parameter: | markup – a new text with Pango markup to display in the banner |
---|
The fraction is the completion of progressbar, the scale is from 0.0 to 1.0. Sets the amount of fraction the progressbar has.
Note that this method only has effect if the banner was created with hildon_banner_show_progress()
Parameter: | fraction – a double |
---|
Sets the icon to be used in the banner.
Parameter: | icon_name – the name of icon to use. Can be None for default icon |
---|
Warning
Banner.set_icon is deprecated and should not be used in newly-written code. This function does nothing. As of hildon 2.2, hildon banners don’t allow changing their icons.
Sets the icon from its filename to be used in the banner.
Parameter: | icon_file – the filename of icon to use. Can be None for default icon. |
---|
Warning
Banner.set_icon_from_file is deprecated and should not be used in newly-written code. This function does nothing. As of hildon 2.2, hildon banners don’t allow changing their icons.
Sets the timeout on the banner. After the given amount of miliseconds has elapsed the banner will go away. Note that settings this only makes sense on the banners that are timed and that have not been yet displayed on the screen.
Parameter: | timeout – timeout to set in miliseconds. |
---|
Note that this method only has effect if the object is an information banner (created using hildon_banner_show_information() and friends).
Name | type | Access | Default | Meaning |
---|---|---|---|---|
is-timed | bool | Read / Write / Construct Only | False | Whether the banner is timed and goes away automatically. |
parent-window | gtk.Window | Read / Write / Construct Only | The window for which the banner will be singleton. | |
timeout | int | Read / Write / Construct Only | 3000 | The time before making the banner banner go away. This needs to be adjusted before the banner is mapped to the screen. Allowed values: 10000 |
Note implements atk.ImplementorIface and gtk.Buildable .
Note is a convenient way to prompt users for a small amount of input. A simple note contains an information text and, in case of confirmation notes, it shows buttons to confirm or cancel. It also can include a gtk.ProgressBar.
This widget provides convenient methods to create either information notes, confirmation notes or cancel notes, which are useful to show the progress of a requested task allowing the user to cancel it.
def show_confirmation_note(parent):
note = hildon.Note("confirmation", parent, "Confirmation message...")
retcode = gtk.Dialog.run(note)
if retcode == gtk.RESPONSE_OK:
print "User pressed 'OK' button'"
return True
else:
print "User pressed 'Cancel' button"
return False
Note
Note constructor has changed API since Diablo.
Creates a new Note.
Parameters: |
|
---|---|
Returns: | A newly created Note. |
Sets the button text to be used by the hildon_note widget.
Parameters: |
|
---|
Sets the button texts to be used by this hildon_note widget.
Parameters: |
|
---|
Name | Meaning |
---|---|
hildon.NOTE_TYPE_CONFIRMATION | |
hildon.NOTE_TYPE_CONFIRMATION_BUTTON | |
hildon.NOTE_TYPE_INFORMATION | |
hildon.NOTE_TYPE_INFORMATION_THEME | |
hildon.NOTE_TYPE_PROGRESSBAR |
Name | type | Access | Default | Meaning |
---|---|---|---|---|
description | str | Read / Write | Description for the note. | |
icon | str | Read / Write | None | Icon for the note. |
note-type | NoteType | Read / Write | hildon.NOTE_TYPE_CONFIRMATION | The type of the note dialog. |
progressbar | gtk.ProgressBar | Read / Write | Progressbar for the note (if any). | |
stock-icon | str | Read / Write | None | Stock icon name for the note. |
TouchSelector implements atk.ImplementorIface and gtk.Buildable .
TouchSelector is a selector widget, that allows users to select items from one to many predefined lists. It is very similar to gtk.ComboBox , but with several individual pannable columns.
Normally, you would use TouchSelector together with a PickerDialog activated from a button. For the most common cases, you should use PickerButton .
The composition of each column in the selector is represented by a GtkTreeModel . To add a new column to a TouchSelector , use hildon_touch_selector_append_column() . If you want to add a text-only column, without special attributes, use hildon_touch_selector_append_text_column() .
It is highly recommended that you use only one column TouchSelector s. If you only need a text only, one column selector, you can create it with hildon_touch_selector_new_text() and populate with hildon_touch_selector_append_text() , hildon_touch_selector_prepend_text() , and hildon_touch_selector_insert_text() .
If you need a selector widget that also accepts user inputs, you can use TouchSelectorEntry .
The current selection has a string representation. In the most common cases, each column model will contain a text column. You can configure which column in particular using the TouchSelectorColumn property “text-column”
You can get this string representation using get_current_text(). You can configure how the selection is printed with set_print_func(), that sets the current hildon touch selector print function. The widget has a default print function, that uses the “text-column” property on each SelectorColumn to compose the final representation.
If you create the selector using hildon_touch_selector_new_text() you don’t need to take care of this property, as the model is created internally. If you create the selector using __init__() , you need to specify properly the property for your custom model in order to get a non-empty string representation, or define your custom print function.
def selection_changed(selector, user_data):
current_selection = selector.get_current_text()
print "Current selection : %s" % current_selection
def create_customized_selector():
selector = hildon.TouchSelector()
icon_list = gtk.stock_list_ids()
store_icons = gtk.ListStore(gobject.TYPE_STRING);
for item in icon_list:
new_iter = store_icons.append()
store_icons.set(new_iter, 0, item)
renderer = gtk.CellRendererPixbuf()
renderer.set_fixed_size(-1, 100)
# Add the column to the selector
# FIXME: bug 4646
#column = selector.append_column(store_icons, renderer, "stock-id", 0)
selector.set_column_selection_mode(hildon.TOUCH_SELECTOR_SELECTION_MODE_MULTIPLE)
column.set_property("text-column", 0)
return selector
Value | Meaning |
---|---|
hildon.TOUCH_SELECTOR_SELECTION_MODE_SINGLE | Users can select one item |
hildon.TOUCH_SELECTOR_SELECTION_MODE_MULTIPLE | Users can select one to many items |
Creates a new empty TouchSelector .
Returns: | a new TouchSelector . |
---|
Appends a new entry in a TouchSelector created with hildon_touch_selector_new_text().
Parameter: | text – a non None text string. |
---|
Prepends a new entry in a TouchSelector created with hildon_touch_selector_new_text().
Parameter: | text – a non None text string. |
---|
Inserts a new entry in a particular position of a TouchSelector created with hildon_touch_selector_new_text().
Parameters: |
|
---|
Equivalent to append_column(), but using a default text cell renderer. This is the most common use case of the widget.
Parameters: |
|
---|---|
Returns: | The new column added, None otherwise. |
This functions adds a new column to the widget, whose data will be obtained from the model. Only widgets added this way should used on the selection logic, i.e., the print function, the “changed” signal, etc. You can optionally pass a gtk.CellRenderer in cell_renderer, together with a None -terminated list of pairs property/value, in the same way you would use gtk.TreeViewColumn.set_attributes(). This will pack cell_renderer at the start of the column, expanded by default. If you prefer not to add it this way, you can simply pass None to cell_rendererand use the gtk.CellLayout interface on the returned SelectorColumn to set your renderers. There is a prerequisite to be considered on models used: text data must be in the first column. This method basically adds a gtk.TreeView to the widget, using the model and the data received.
Parameters: |
|
---|---|
Returns: | the new column added added, None otherwise. |
Warning
set_column_attributes() is deprecated and should not be used in newly-written code. SelectorColumn implements gtk.CellLayout , use this interface instead. See get_column().
Sets the attributes for the given column. The attributes must be given in attribute/column pairs, just like in set_attributes(). All existing attributes are removed and replaced with the new ones.
Parameters: |
|
---|
Removes a column from selector.
Parameter: | column – the position of the column to be removed |
---|---|
Returns: | True if the column was removed, False otherwise |
Gets the number of columns in the TouchSelector .
Returns: | the number of columns in selector. |
---|
Sets the selection mode for selector. See TouchSelectorSelectionMode .
Parameter: | mode – the TouchSelectorMode for selector |
---|
Gets the selection mode of selector.
Returns: | one of TouchSelectorSelectionMode |
---|
Use this method to retrieve a TouchSelectorColumn . Then, you can use the gtk.CellLayout interface to set up the layout of the column.
Parameter: | column – a column number |
---|---|
Returns: | the column-th TouchSelectorColumn in selector |
Sets the active item of the TouchSelector to index. The column number is taken from column. selector must be in TOUCH_SELECTOR_SELECTION_MODE_SINGLE
Parameters: |
|
---|
Returns the index of the currently active item in column number column, or -1 if there’s no active item. selector must be in TOUCH_SELECTOR_SELECTION_MODE_SINGLE
Parameter: | column – column number |
---|---|
Returns: | an integer which is the index of the currently active item, or -1 if there’s no active item. |
Returns a 2-tuple with a GtkTreeModel and GtkTreIter to the currently selected node on the nth-column, if selection is set to TOUCH_SELECTOR_SINGLE or TOUCH_SELECTOR_MULTIPLE with a column different that the first one. Iterator may be None if you just want to test if selection has any selected items. This function will return None if selection is in TOUCH_SELECTOR_MULTIPLE mode and the column is the first one.
See gtk.TreeSelection.get_selected() for more information.
Parameter: | column – the column number we want to get the element |
---|---|
Returns: | a 2-tuple containing a reference to the GtkTreeModel and a GtkTreeIter pointing to the currently selected node. |
Sets the currently selected item in the column column to the one pointed by iter, optionally smoothly scrolling to it.
Parameters: |
|
---|
Unselect the item pointed by iter in the column column
Parameters: |
|
---|
Unselects all the selected items in the column column.
Parameter: | column – the position of the column to get the selected rows from |
---|
Creates a list of gtk.TreePath s of all selected rows in a column. Additionally, if you to plan to modify the model after calling this function, you may want to convert the returned list into a list of GtkTreeRowReferences. To do this, you can use gtk.TreeRowReference.
See gtk.TreeSelection.get_selected_rows() for more information.
Parameter: | column – the position of the column to get the selected rows from |
---|---|
Returns: | A new list containing a gtk.TreePath for each selected row in the column column. |
Sets the gtk.TreeModel for a particular column in model.
Parameters: |
|
---|
Gets the model of a column of selector.
Parameter: | column – the position of the column in selector |
---|---|
Returns: | the gtk.TreeModel for the column column of selector. |
Returns a string representing the currently selected items for each column of selector. See set_print_func().
Returns: | a newly allocated string. |
---|
Sets the function to be used by get_current_text() to produce a text representation of the currently selected items in selector. The default function will return a concatenation of comma separated items selected in each column in selector. Use this to override this method if you need a particular representation for your application.
Parameter: | func – a callable object |
---|
Gets the PrintFunc currently used. See set_print_func().
Returns: | a object or None if the default one is currently used. |
---|
Determines whether selector is complex enough to actually require an extra selection step than only picking an item. This is normally True if selector has multiple columns, multiple selection, or when it is a more complex widget, like TouchSelectorEntry . This information is useful for widgets containing a TouchSelector , like PickerDialog , that could need a “Done” button, in case that its internal TouchSelector has multiple columns, for instance.
Returns: | True if selector requires multiple selection steps. |
---|
Name | type | Access | Default | Meaning |
---|---|---|---|---|
has-multiple-selection | bool | Read | False | Whether the widget has multiple selection (like multiple columns, multiselection mode, or multiple internal widgets) and therefore it may need a confirmation button, for instance. |
initial-scroll | bool | Read / Write / Construct | True | Whether to scroll to thecurrent selection when the selector is firstshown. |
The changed signal
The “changed” signal is emitted when the active item on any column is changed. This can be due to the user selecting a different item from the list, or due to a call to select_iter() on one of the columns.
Parameters: |
|
---|
The columns-changed signal
The “columns-changed” signal is emitted when the number of columns in the TouchSelector change.
Parameters: |
|
---|
TouchSelectorColumn implements gtk.CellLayout .
TouchSelectorColumn object represents a visible column in TouchSelector . It allows to manage the cell renderers related to each column.
Name | type | Access | Default | Meaning |
---|---|---|---|---|
text-column | int | Read / Write | -1 | A column in the data source model to get the strings from. |
SelectorEntry implements atk.ImplementorIface and gtk.Buildable .
SelectorEntry is a selector widget with a text entry, similar in behaviour to gtk.ComboBoxEntry , that allows user to select an item from a predefined list or to enter a different one in a HildonEntry . Items can also be searched and selected by typing in the entry. For more specific use cases, the HildonEntry can be accessed directly with hildon_touch_selector_get_entry() .
The main difference between the gtk.TreeModel used by HildonTouchSelector and TouchSelectorEntry , is that the latter must always include a text column. You should set it with touch_selector_entry_set_text_column().
Normally, you would use TouchSelectorEntry together with a PickerDialog activated from a button. For the most common cases, you should use PickerButton .
If you only need a text only, one column selector, you can create it with hildon_touch_selector_entry_new_text() and populate it with append_text(), prepend_text(), and insert_text().
Creates a TouchSelectorEntry
Returns: | A new TouchSelectorEntry |
---|
Sets the model column which touch selector box should use to get strings from to be text_column.
Parameter: | text_column – A column in model to get the strings from |
---|
Gets the text column that selector is using as a text column.
Returns: | the number of the column used as a text column. |
---|
Sets the input mode to be used in the gtk.Entry in selector. See set_input_mode() for details. It must be noted that not all input modes are available for the entry in selector. In particular, GTK_INPUT_MODE_MULTILINE, GTK_INPUT_MODE_INVISIBLE, GTK_INPUT_MODE_DICTIONARY are disabled, since these are irrelevant for TouchSelectorEntry .
Parameter: | input_mode – GtkInputMode mask |
---|
Returns: | a mask of GtkInputMode |
---|
Creates a TouchSelectorEntry with a single text column that can be populated conveniently through append_text(), prepend_text(), insert_text().
Returns: | A new TouchSelectorEntry |
---|
Name | type | Access | Default | Meaning |
---|---|---|---|---|
text-column | int | Read / Write | -1 |
TouchSelector PickerButton
DateSelector implements atk.ImplementorIface and gtk.Buildable .
DateSelector is a date widget with multiple columns. Users can choose a date by selecting values in the day, month and year columns.
The currently selected month and year can be altered with select_month(). The day can be selected from the active month using select_day().
Creates a new DateSelector
Returns: | a new DateSelector |
---|
Modify the current month and year on the current active date Ytility function to keep this API similar to the previously existing Calendar widget.
Parameters: |
|
---|---|
Returns: | True on success, False otherwise |
Modify the current day on the current active date Utility function to keep this API similar to the previously existing Calendar widget.
Parameter: | day – the current day (1-31, 1-30, 1-29, 1-28) depends on the month |
---|
Sets the current active date on the DateSelector widget
Parameters: |
|
---|---|
Returns: | True on success, False otherwise |
Gets the current active date on the DateSelector widget
Returns: | a tuple with (year, month, day) |
---|
- hildon.hildon_date_selector_new_with_year_range(min_year, max_year)¶
Creates a new DateSelector with a specific year range. If min_year or max_year are set to -1, then the default upper or lower bound will be used, respectively.
Parameters:
- min_year – the minimum available year or -1 to ignore
- max_year – the maximum available year or -1 to ignore
Returns: a new DateSelector
Name | type | Access | Default | Meaning |
---|---|---|---|---|
max-year | int | Read / Write / Construct Only | 2037 | The maximum available year in the selector. |
min-year | int | Read / Write / Construct Only | 1970 | The minimum available year in the selector. |
TimeSelector implements atk.ImplementorIface and gtk.Buildable .
TimeSelector allows users to choose a time by selecting hour and minute. It also allows choosing between AM or PM format.
The currently selected time can be altered with set_time(), and retrieved using get_time().
Use this widget instead of deprecated HildonTimeEditor widget.
Creates a new TimeSelector
Returns: | a new TimeSelector |
---|
Creates a new TimeSelector minutes_step: step between the minutes we are going to show in the selector
Parameter: | minutes_step – |
---|---|
Returns: | a new TimeSelector |
Sets the current active hour on the TimeSelector widget The format of the hours accepted is always 24h format, with a range (0-23):(0-59).
Parameters: |
|
---|---|
Returns: | True on success, False otherwise |
Gets the current active hour on the TimeSelector widget. This method returns the date always in 24h format, with a range (0-23):(0-59)
Returns: | a tuple with (hours, minutes) |
---|
Name | type | Access | Default | Meaning |
---|---|---|---|---|
minutes-step | int | Read / Write / Construct Only | 1 | Step between the minutes in the list of options of the widget. |
PannableArea implements atk.ImplementorIface and gtk.Buildable .
PannableArea is a container widget that can be “panned” (scrolled) up and down using the touchscreen with fingers. The widget has no scrollbars, but it rather shows small scroll indicators to give an idea of the part of the content that is visible at a time. The scroll indicators appear when a dragging motion is started on the pannable area.
The scrolling is “kinetic”, meaning the motion can be “flicked” and it will continue from the initial motion by gradually slowing down to an eventual stop. The motion can also be stopped immediately by pressing the touchscreen over the pannable area.
Value | Meaning |
---|---|
PANNABLE_AREA_MODE_PUSH | Areaing follows pointer |
PANNABLE_AREA_MODE_ACCEL | Areaing uses physics to “spin” the widget |
PANNABLE_AREA_MODE_AUTO | Automatically chooses between push and accel modes, depending on input. |
Value | Meaning |
---|---|
MOVEMENT_MODE_HORIZ | 1 1 |
MOVEMENT_MODE_VERT | 1 2 |
MOVEMENT_MODE_BOTH | 0x000006 |
Value | Meaning |
---|---|
MOVEMENT_UP | |
MOVEMENT_DOWN | |
MOVEMENT_LEFT | |
HILDON_MOVEMENT_RIGHT |
Value | Meaning |
---|---|
SIZE_REQUEST_MINIMUM | The minimum size the widget could use to paint itself |
SIZE_REQUEST_CHILDREN | The minimum size of the children of the widget |
Ctors:
Convenience function used to add a child to a GtkViewport , and add the viewport to the scrolled window.
Parameter: | child – Child widget to add to the viewport |
---|
Smoothly scrolls area to ensure that (x, y) is a visible point on the widget. To move in only one coordinate, you must set the other one to -1. Notice that, in PANNABLE_AREA_MODE_PUSH, this function works just like jump_to().
This function is useful if you need to present the user with a particular element inside a scrollable widget, like GtkTreeView . For instance, the following example shows how to scroll inside a GtkTreeView to make visible an item, indicated by the GtkTreeIter iter.
If you want to present a child widget in simpler scenarios, use scroll_to_child() instead.
There is a precondition to this function: the widget must be already realized. Check the jump_to_child() for more tips regarding how to call this function during initialization.
Parameters: |
|
---|
Jumps the position of area to ensure that (x, y) is a visible point in the widget. In order to move in only one coordinate, you must set the other one to -1. See scroll_to() function for an example of how to calculate the position of children in scrollable widgets like GtkTreeview . There is a precondition to this function: the widget must be already realized. Check the jump_to_child() for more tips regarding how to call this function during initialization.
Parameters: |
|
---|
Smoothly scrolls until child is visible inside area. child must be a descendant of area. If you need to scroll inside a scrollable widget, e.g., GtkTreeview , see scroll_to().
There is a precondition to this function: the widget must be already realized. Check the jump_to_child() for more tips regarding how to call this function during initialization.
Parameter: | child – A gtk.Widget , descendant of area. |
---|
Jumps to make sure child is visible inside area. child must be a descendant of area. If you want to move inside a scrollable widget, like, GtkTreeview , see scroll_to().
There is a precondition to this function: the widget must be already realized. You can control if the widget is ready with the GTK_WIDGET_REALIZED macro. If you want to call this function during the initialization process of the widget do it inside a callback to the ::realize signal, using g_signal_connect_after() function.
Parameter: | child – A gtk.Widget , descendant of area. |
---|
Get the widget at the point (x, y) inside the pannable area. In case no widget found it returns None.
Parameters: |
|
---|---|
Returns: | the gtk.Widget if we find a widget, NULL in any other case |
This function returns the current size request policy of the widget. That policy controls the way the size_request is done in the pannable area. Check set_size_request_policy() for a more detailed explanation.
Returns: | the policy is currently being used in the widget HildonSizeRequestPolicy . |
---|
Returns the horizontal adjustment. This adjustment is the internal widget adjustment used to control the animations. Do not modify it directly to change the position of the pannable, to do that use the pannable API. If you modify the object directly it could cause artifacts in the animations.
Returns: | The horizontal GtkAdjustment |
---|
Create a new HildonPannableArea widget and set various properties
Parameters: |
|
---|---|
Returns: | the newly create HildonPannableArea |
Name | type | Access | Default | Meaning |
---|---|---|---|---|
bounce-steps | int | Read / Write / Construct | 3 | Number of steps that is going to be used to bounce when hitting theedge, the rubberband effect depends on it. |
deceleration | float | Read / Write / Construct | 0.93 | The multiplier used when decelerating when in acceleration scrolling mode. |
direction-error-margin | int | Read / Write / Construct | 10 | After detecting the direction of the movement (horizontal orvertical), we can add this margin of error to allow the movement inthe other direction even apparently it is not. |
drag-inertia | float | Read / Write / Construct | 0.85 | Percentage of the calculated speed in each moment we are are going to useto calculate the launch speed, the other part would be the speedcalculated previously. |
enabled | bool | Read / Write / Construct | True | Enable or disable finger-scroll. |
force | int | Read / Write / Construct | 120 | Force applied to the movement, multiplies the calculated speed of theuser movement the cursor in the screen. |
hadjustment | gtk.Adjustment | Read | The GtkAdjustment for the horizontal | |
hovershoot-max | int | Read / Write / Construct | 150 | Space we allow the widget to pass over its horizontal limits whenhitting the edges, set 0 in order to deactivate overshooting. |
hscrollbar-policy | GtkPolicyType | Read / Write / Construct | gtk.POLICY_AUTOMATIC | Visual policy of the horizontal scrollbar. |
initial-hint | bool | Read / Write / Construct | True | Whether to hint the user about the pannability of the container. |
low-friction-mode | bool | Read / Write / Construct | False | Change the finger-scrolling mode. |
mode | Mode | Read / Write / Construct | PANNABLE_AREA_MODE_AUTO | Change the finger-scrolling mode. |
mov-mode | MovementMode | Read / Write / Construct | hildon.MOVEMENT_MODE_VERT | Controls if the widget can scroll vertically, horizontally or both. |
panning-threshold | int | Read / Write / Construct | 6 | Amount of pixels to consider a motion event an scroll, if it is lessit is a click detected incorrectly by the touch screen. |
scroll-time | float | Read / Write / Construct | 10 | The time to scroll to a position when calling the hildon_pannable_scroll_to function. |
scrollbar-fade-delay | int | Read / Write / Construct | 3000 | Time the scrollbar is going to be visible if the widget is not inaction in miliseconds. |
size-request-policy | SizeRequestPol | Read / Write / Construct | SIZE_REQUEST_MINIMUM | Controls the size request policy of the widget. |
sps | int | Read / Write / Construct | 20 | Amount of scroll events to generate per second. |
vadjustment | gtk.Adjustment | Read | The GtkAdjustment for the vertical position. | |
velocity-fast-factor | float | Read / Write / Construct | 0.02 | Minimum velocity that is considered ‘fast’: children widgets won’t receive button presses. Expressed as a fraction of the maximum velocity. |
velocity-max | float | Read / Write / Construct | 500 | Maximum distance the child widget should scroll per ‘frame’, in pixels per frame. |
velocity-min | float | Read / Write / Construct | 20 | Minimum distance the child widget should scroll per ‘frame’, in pixels per frame. |
velocity-overshooting-max | float | Read / Write / Construct | 20 | Maximum distance the child widget should scroll per ‘frame’, in pixels per frame when it overshoots after hitting the edge. |
vovershoot-max | int | Read / Write / Construct | 150 | Space we allow the widget to pass over its vertical limits whenhitting the edges, set 0 in order to deactivate overshooting. |
vscrollbar-policy | PolicyType | Read / Write / Construct | gtk.POLICY_AUTOMATIC | Visual policy of the vertical scrollbar. |
Name | type | Access | Default | Meaning |
---|---|---|---|---|
indicator-width | int | Read / Write | 8 | Pixel width used to draw the scroll indicators. |
The horizontal-movement signal
The horizontal-movement signal is emitted when the pannable area starts a horizontal movement.
Parameters: |
|
---|
The vertical-movement signal
The vertical-movement signal is emitted when the pannable area starts a vertical movement.
Parameters: |
|
---|
gtk.ScrolledWindow
Entry implements atk.ImplementorIface , gtk.Buildable , GtkEditable and GtkCellEditable .
The Entry is a GTK widget which represents a text entry. It is derived from the gtk.Entry widget and provides additional commodities specific to the Hildon framework.
Besides all the features inherited from gtk.Entry , a Entry can also have a placeholder text. This text will be shown if the entry is empty and doesn’t have the input focus, but it’s otherwise ignored. Thus, calls to Entry.get_text() will never return the placeholder text, not even when it’s being displayed.
def create_entry():
entry = hildon.Entry(gtk.HILDON_SIZE_AUTO)
entry.set_placeholder("First name")
return entry
Sets the text in entry to text, replacing its current contents. Note that you must never use Entry.set_text() to set the text of a Entry .
Parameter: | text – the new text |
---|
Gets the current text in entry. Note that you must never use get_text() to get the text from a Entry . Also note that placeholder text (set using set_placeholder() is never returned. Only text set by set_text() or typed by the user is considered.
Returns: | the text in entry. This text must not be modified or freed. |
---|
Sets the placeholder text in entry to text.
Parameter: | text – the new text |
---|
TextView implements atk.ImplementorIface and gtk.Buildable .
The TextView is a GTK widget which represents a text view. It is derived from the gtk.TextView widget and provides additional commodities specific to the Hildon framework.
Besides all the features inherited from gtk.TextView , a TextView can also have a placeholder text. This text will be shown if the text view is empty and doesn’t have the input focus, but it’s otherwise ignored. Thus, calls to hildon_text_view_get_buffer() will never return the placeholder text, not even when it’s being displayed.
Although TextView is derived from gtk.TextView , get_buffer() and set_buffer() must never be used to get/set the buffer in this widget. get_buffer() and set_buffer() must be used instead.
def create_text_view ():
text_view = hildon.TextView()
text_view.set_placeholder("Type some text here")
return text_view
Sets buffer as the buffer being displayed by text_view. The previous buffer displayed by the text view is unreferenced, and a reference is added to buffer. If you owned a reference to bufferbefore passing it to this function, you must remove that reference yourself Note that you must never use set_buffer() to set the buffer of a TextView .
Parameter: | buffer – a gtk.TextBuffer |
---|
Returns the text buffer in text_view. The reference count is not incremented; the caller of this function won’t own a new reference. Note that you must never use get_buffer() to get the buffer from a TextView . Also note that placeholder text (set using set_placeholder() is never contained in this buffer.
Returns: | a gtk.TextBuffer |
---|
Sets the placeholder text in text_view to text.
Parameter: | text – the new text |
---|
FindToolbar implements atk.ImplementorIface and gtk.Buildable .
FindToolbar is a toolbar that contains a search entry and a dropdown list with previously searched strings. The list is represented using a gtk.ListStore and can be accesed using a property ‘list’. Entries are added automatically to the list when the search button is pressed.
Creates a new FindToolbar with a model.
Parameters: |
|
---|---|
Returns: | a new FindToolbar |
Highlights the current entry in the find toolbar.
Parameters: |
|
---|
Sets the active item on the toolbar’s combo-box. Simply calls gtk_combo_box_set_active on the FindToolbar’s combo.
Parameters: |
|
---|
Gets the index of the currently active item, or -1 if there’s no active item. Simply calls gtk_combo_box_get_active on the FindToolbar’s combo.
Returns: | An integer which is the index of the currently active item, or -1 if there’s no active item. |
---|
Sets the current active item to be the one referenced by iter. Simply calls gtk_combo_box_set_active_iter on the FindToolbar’s combo.
Parameter: | iter – An iter to make active |
---|
Sets iter to point to the current active item, if it exists. Simply calls gtk.comboBox.get_active_iter() on the FindToolbar’s combo.
Parameter: | iter – The uninitialized GtkTreeIter |
---|---|
Returns: | True, if iter was set |
Returns the index of the last (most recently added) item in the toolbar. Can be used to set this item active in the history-append signal.
Returns: | Index of the last entry |
---|
Name | type | Access | Default | Meaning |
---|---|---|---|---|
column | int | Read / Write | 0 | The column number in gtk.ListStore where strings of search history are kept. |
history-limit | int | Read / Write / Construct | 5 | Maximum number of history items in the combobox. |
labe | str | Read / Write / Construct | “ecdg_ti_find_toolbar_label” | The label to display before the search box. |
list | gtk.ListStore | Read / Write | A gtk.ListStore where the search history is kept. | |
max-characters | int | Read / Write / Construct | 0 | Maximum number of characters in search string. |
prefix | str | Read / Write / Construct | None | Search string. |
The close signal
Gets emitted when the close button is pressed.
Parameters: |
|
---|
The history-append signal
Gets emitted when the current search prefix should be added to history.
Parameters: |
|
---|
The invalid-input signal
The search signal
Gets emitted when the find button is pressed.
Parameters: |
|
---|
EditToolbar implements atk.ImplementorIface and gtk.Buildable .
The EditToolbar is a toolbar which contains a label and two buttons, one of them being an arrow pointing backwards.
The label is a description of the action that the user is supposed to do. The button is to be pressed when the user completes the action. The arrow is used to go back to the previous view discarding any changes.
Note that those widgets don’t do anything themselves by default. To actually peform actions the developer must provide callbacks for them.
To add a EditToolbar to a window use Window.set_edit_toolbar() .
window = hildon.StackableWindow()
toolbar = hildon.EditToolbar("Choose items to delete", "Delete")
# Create more widgets here ...
# Add toolbar to window
window.set_edit_toolbar(toolbar)
# Add other widgets ...
toolbar.connect("button-clicked", delete_button_clicked, someparameter)
toolbar.connect_swapped("arrow-clicked", gtk.widget_destroy, window)
gtk.widget_show_all(window)
gtk.window_fullscreen(window)
Creates a new EditToolbar , with the toolbar label set to label and the button label set to button.
Parameters: |
|
---|---|
Returns: | a new EditToolbar |
Sets the label of toolbar to label. This will clear any previously set value.
Parameters: |
|
---|
Sets the label of the toolbar button to label. This will clear any previously set value.
Parameters: |
|
---|
Name | type | Access | Default | Meaning |
---|---|---|---|---|
arrow-height | int | Read | 56 | Height of the arrow button. |
arrow-width | int | Read | 112 | Width of the arrow button. |
The arrow-clicked signal
Emitted when the toolbar back button (arrow) has been activated (pressed and released).
Parameters: |
|
---|
The button-clicked signal
Emitted when the toolbar button has been activated (pressed and released).
Parameters: |
|
---|
WizardDialog implements atk.ImplementorIface and gtk.Buildable.
WizardDialog is a widget to create a guided installation process. The dialog has three standard buttons, previous, next, finish, and contains several pages.
Response buttons are dimmed/undimmed automatically. The notebook widget provided by users contains the actual wizard pages.
Usage of the API is very simple, it has only one function to create it and the rest of it is handled by developers notebook. Also, the response is returned, either cancel or finish. Next and previous buttons are handled by the wizard dialog it self, by switching the page either forward or backward in the notebook.
It is possible to determinate whether users can go to the next page by setting a WizardDialogPageFunc function with WizardDialog.set_forward_page_func().
Creates a new WizardDialog .
Parameters: |
|
---|---|
Returns: |
Sets the page forwarding function to be page_func. This function will be used to determine whether it is possible to go to the next page when the user presses the forward button. Setting page_func to None wil make the wizard to simply go always to the next page.
The signature of page_func is:
def page_func(current_page, user_data):
where current_page is the index of the current page and user_data is data.
Parameters: |
|
---|
Used to control the size request policy of the widget
Value | Meaning |
---|---|
WIZARD_DIALOG_CANCEL | Returned by the ‘Cancel’ button. |
WIZARD_DIALOG_PREVIOUS | Returned by the ‘Previous’ button. |
WIZARD_DIALOG_NEXT | Returned by the ‘Next’ button. |
WIZARD_DIALOG_FINISH | Returned by the ‘Finish’ button. |
Warning
WIZARD_DIALOG_CANCEL is deprecated and should not be used in newly-written code.
Name | type | Access | Default | Meaning |
---|---|---|---|---|
autotitle | bool | Read / Write | True | If the wizard should automatically try to change the window title when changing steps. Set to FALSE if you’d like to override the default behaviour. |
wizard-name | str | Read / Write | None | The name of the wizard. |
wizard-notebook | gtk.Notebook | Read / Write | The notebook object, which is used by the WizardDialog. |
PickerDialog implements atk.ImplementorIface and gtk.Buildable .
PickerDialog is a dialog that is used to show a TouchSelector widget and a ‘Done’ button to allow users to finish their selections.
The PickerDialog will show a ‘Done’ button in case the TouchSelector allows multiple selection. The label of the button can be set using PickerDialog.set_done_label() and retrieved using PickerDialog.get_done_label()
Note that in most cases developers don’t need to deal directly with this widget. PickerButton is designed to pop up a PickerDialog and manage the interaction with it.
Button label
Creates a new PickerDialog
Parameter: | parent – the parent window |
---|---|
Returns: | a new PickerDialog |
Sets selector as the TouchSelector to be shown in dialog
Parameter: | selector – a TouchSelector |
---|---|
Returns: | True if selector was set, False otherwise |
Sets a custom string to be used as the ‘Done’ button label in dialog.
Parameters: |
|
---|
Retrieves current ‘Done’ button label.
Returns: | the custom string to be used. |
---|
Retrieves the TouchSelector associated to dialog.
Returns: | a TouchSelector |
---|
Name | type | Access | Default | Meaning |
---|---|---|---|---|
center-on-show | bool | Read / Write / Construct | True | If the dialog should center on the current selection when it is showed. |
done-button-text | str | Read / Write / Construct | “wdgt_bd_done” | Done Button Label. |
Creates a new AnimationActor .
Returns: | A AnimationActor |
---|
Sends an X11 ClientMessage event to the window manager with the specified parameters – id (message_type) and data (l0, l1, l2, l3, l4).
This is an internal utility function that application will not need to call directly.
Parameters: |
|
---|
Send a message to the window manager setting the anchor point for the animation actor. The anchor point is the point to which the actor position within its parent it is relative.
If the animation actor WM-counterpart is not ready, the show message will be queued until the WM is ready for it.
Parameters: |
|
---|
Send a message to the window manager setting the anchor point for the animation actor. The anchor point is the point to which the actor position within its parent it is relative. Instead of being defined in (x, y)-coordinates, the anchor point is defined in the relative “gravity” constant as:
If the animation actor WM-counterpart is not ready, the show message will be queued until the WM is ready for it.
Parameter: | gravity – The gravity constant. |
---|
A shortcut for AnimationActor.set_position_full() , changing the window depth, but preserving it’s position.
Parameter: | depth – Desired window depth (Z coordinate) |
---|
This function is a shortcut for AnimationActor.set_show_full() , setting actor opacity without changing it’s overall visibility.
See AnimationActor.set_show_full() for description of the range of values opacity argument takes.
Parameter: | opacity – Desired opacity setting |
---|
Send a message to the window manager setting the parent window for the animation actor. Parenting an actor will not affect the X window that the AnimationActor represents, but it’s off-screen bitmap as it is handled by the compositing window manager.
Parenting an animation actor will affect its visibility as set by the gtk.Widget.show_all() , GtkWidget.hide() and AnimationActor.set_show() . The animation actor will only be visible when the top-level window it is parented is visible.
Passing None as a parent argument will unparent the animation actor. This will restore the actor’s visibility if it was suppressed by being unparented or parented to an unmapped window.
If the animation actor WM-counterpart is not ready, the show message will be queued until the WM is ready for it.
Parameter: | parent – A gtk.Window that the actor will be parented to. |
---|
A shortcut for AnimationActor.set_position_full() , changing the window position, but preserving it’s depth setting.
Parameters: |
|
---|
Send a message to the window manager setting the position of the animation actor. This will set the position of the animation actor off-screen bitmap as it is rendered to the screen. The position of the actor is relative to the parent window. The actor is also subject to the animation effects rendered by the compositing window manager on that window (like those by task switcher).
The window depth affects the stacking of animation actors within a parent window and, more generally, the stacking of clutter actors within a stage/container. The default depth is 0 and a parent window’s container will have it’s window texture stacked at that level. The stacking at any depth level is sequential – animation actor B created/parented after animation actor A will obscure the latter if they overlap.
Animation actors with non-zero depth settings are subject to scaling as per the global scene perspective setup, which limits the depth setting as the primary parameter to control the stacking order. Since the stacking order follows the parenting order, it may be better to use AnimationActor.set_parent() for setting the stacking.
If the animation actor WM-counterpart is not ready, the show message will be queued until the WM is ready for it.
Parameters: |
|
---|
Send a message to the window manager setting the animation actor rotation around one of the three axes. The rotation center coordinates depend on the axis of rotation:
If the animation actor WM-counterpart is not ready, the show message will be queued until the WM is ready for it.
Parameters: |
|
---|
This function is just like AnimationActor.set_rotation() , but the rotation angle is given as 16-bit fixed-point number.
Parameters: |
|
---|---|
Parma degrees: | The rotation angle in degrees. |
Send a message to the window manager setting the scale factors of the animation actor. This will set the scale factors on the animation actor off-screen bitmap as it is rendered to the screen. If the animation actor is parented to another top-level window, the animation effects rendered by the compositing window manager on that top-level window (like those by task switcher) will also affect the animation actor.
If the animation actor WM-counterpart is not ready, the show message will be queued until the WM is ready for it.
Parameters: |
|
---|
This function is just like AnimationActor.set_scale() , but the scale factors are given as 16-bit fixed-point number.
Parameters: |
|
---|
This function is a shortcut for AnimationActor.set_show_full() , setting the overall actor visibility without changing it’s opacity setting.
Parameter: | show – A boolean flag setting the visibility of the animation actor. |
---|
Send a message to the window manager setting the visibility of the animation actor. This will only affect the visibility of the animation actor set by the compositing window manager in its own rendering pipeline, after X has drawn the window to the off-screen buffer. This setting, naturally, has no effect if the AnimationActor widget is not visible in X11 terms (i.e. realized and mapped).
Furthermore, if a widget is parented, its final visibility will be affected by that of the parent window.
The opacity setting ranges from zero (0), being completely transparent to 255 (0xff) being fully opaque.
If the animation actor WM-counterpart is not ready, the show message will be queued until the WM is ready for it.
Parameters: |
|
---|
See also
See also
See also
The RemoteTexture is a GTK+ widget which allows the rendering of a shared memory area within hildon-desktop. It allows the memory area to be positioned and scaled, without altering its’ contents.
Creates a new RemoteTexture .
Returns: | A RemoteTexture |
---|
Sends an X11 ClientMessage event to the window manager with the specified parameters — id (message_type) and data (l0, l1, l2, l3, l4).
This is an internal utility function that application will not need to call directly.
Parameters: |
|
---|
Parameters: |
|
---|
Send a message to the window manager setting the offset of the remote texture in the window (in Remote texture’s pixels). The texture is also subject to the animation effects rendered by the compositing window manager on that window (like those by task switcher).
If the remote texture WM-counterpart is not ready, the show message will be queued until the WM is ready for it.
Parameters: |
|
---|
This function is a shortcut for RemoteTexture.set_show_full() , setting actor opacity without changing it’s overall visibility.
See RemoteTexture.set_show_full() for description of the range of values opacity argument takes.
Parameter: | opacity – Desired opacity setting |
---|
Send a message to the window manager setting the parent window for the remote texture. Parenting an actor will not affect the X window that the RemoteTexture represents, but it’s off-screen bitmap as it is handled by the compositing window manager.
Parenting an remote texture will affect its visibility as set by the gtk.Widget.show_all() , GtkWidget.hide() and RemoteTexture.set_show() . The remote texture will only be visible when the top-level window it is parented is visible.
Passing None as a parent argument will unparent the remote texture. This will restore the actor’s visibility if it was suppressed by being unparented or parented to an unmapped window.
If the remote texture WM-counterpart is not ready, the show message will be queued until the WM is ready for it.
Parameter: | parent – A gtk.Window that the actor will be parented to. |
---|
Send a message to the window manager setting the offset of the remote texture in the window (in Remote texture’s pixels). The texture is also subject to the animation effects rendered by the compositing window manager on that window (like those by task switcher).
If the remote texture WM-counterpart is not ready, the show message will be queued until the WM is ready for it.
Parameters: |
|
---|
This function is a shortcut for RemoteTexture.set_show_full() , setting the overall actor visibility without changing it’s opacity setting.
Parameter: | show – A boolean flag setting the visibility of the remote texture. |
---|
Send a message to the window manager setting the visibility of the remote texture. This will only affect the visibility of the remote texture set by the compositing window manager in its own rendering pipeline, after X has drawn the window to the off-screen buffer. This setting, naturally, has no effect if the RemoteTexture widget is not visible in X11 terms (i.e. realized and mapped).
Furthermore, if a widget is parented, its final visibility will be affected by that of the parent window.
The opacity setting ranges from zero (0), being completely transparent to 255 (0xff) being fully opaque.
If the remote texture WM-counterpart is not ready, the show message will be queued until the WM is ready for it.
Parameters: |
|
---|
This signals to hildon-desktop that a specific region of the memory area has changed. This will trigger a redraw and will update the relevant tiles of the texture.
Parameters: |
|
---|