Before using Hildon, you need to initialize it; initialization connects to the window system display, and parses some standard command line arguments. See also gtk_init() to know more details on this topic.
Hildon should be initialized by using hildon_gtk_init() . Notice this function also initialize gtk by calling gtk_init() . In case you need a customized initialization of GTK+ library you could use hildon_init() after the customized GTK+ initialization.
import gtk
import hildon
def main():
# Create the main window
mainwin = hildon.StackableWindow()
# Set up our GUI elements
...
# Show the application window
mainwin.show_all()
# Enter the main event loop, and wait for user interaction
gtk.main()
if __name__ == "__main__":
main()
Initializes the hildon library. Call this function after calling gtk_init() and before using any hildon or GTK+ functions in your program.
New in version 2.2.
Convenience function to initialize the GTK+ and hildon libraries. Use this function to replace a call to gtk_init() and also initialize the hildon library. See hildon_init() and gtk_init() for details.
Parameters: |
|
---|
Hildon provides some functions to extend the functionality of existing Gtk widgets. This also includes convenience functions to easily perform frequent tasks.
This is a convenience function to create a gtk.Menu setting its widget name to allow Hildon specific styling.
Returns: | A newly created gtk.Menu widget. |
---|
This is a convenience function to create a GtkButton setting its size to one of the pre-defined Hildon sizes.
Buttons created with this function also override the “gtk-button-images” setting. Images set using gtk_button_set_image() are always shown.
Buttons created using this function have “focus-on-click” set to False by default.
Parameter: | size – Flags indicating the size of the new button |
---|---|
Returns: | A newly created GtkButton widget. |
This is a convenience function to create a GtkToggleButton setting its size to one of the pre-defined Hildon sizes.
Buttons created with this function also override the “gtk-button-images” setting. Images set using gtk_button_set_image() are always shown.
Buttons created using this function have “focus-on-click” set to False by default.
Parameter: | size – Flags indicating the size of the new button |
---|---|
Returns: | A newly created GtkToggleButton widget. |
This is a convenience function to create a gtk.RadioButton setting its size to one of the pre-defined Hildon sizes.
Buttons created with this function also override the “gtk-button-images” setting. Images set using gtk_button_set_image() are always shown.
Buttons created using this function have “focus-on-click” set to False by default.
Parameters: |
|
---|---|
Returns: | A newly created gtk.RadioButton widget. |
This is a convenience function to create a gtk.RadioButton setting its size to one of the pre-defined Hildon sizes.
Buttons created with this function also override the “gtk-button-images” setting. Images set using gtk_button_set_image() are always shown.
Buttons created using this function have “focus-on-click” set to False by default.
Parameters: |
|
---|---|
Returns: | A newly created gtk.RadioButton widget. |
Creates a new gtk.TreeView widget with the Hildon UI mode set to mode
Parameter: | mode – the Hildon UI mode |
---|---|
Returns: | A newly created gtk.TreeView widget. |
Creates a new gtk.TreeView widget with the Hildon UI mode set to mode and the model initialized to model.
Parameters: |
|
---|---|
Returns: | A newly created gtk.TreeView widget. |
Sets the UI mode of treeview to mode.
Parameters: |
|
---|
Creates a new gtk.IconView widget with the Hildon UI mode set to mode
Parameter: | mode – the Hildon UI mode |
---|---|
Returns: | A newly created gtk.IconView widget |
Creates a new gtk.IconView widget with the Hildon UI mode set to mode and the model intitialized to model.
Parameters: |
|
---|---|
Returns: | A newly created gtk.IconView widget. |
Sets the UI mode of iconview to mode.
Parameters: |
|
---|
This functions tells the window manager to show/hide a progress indicator in the window title. It applies to hildon.Dialog and hildon.Window (including subclasses).
Note that window must be realized for this to work.
Parameters: |
|
---|
Creates a new horizontal scale widget that lets the user select a value. The value is technically a double between 0.0 and 1.0. See gtk_adjustment_configure() for reconfiguring the adjustment.
The scale is hildonized, which means that a click or tap immediately jumps to the desired position, see gtk_range_set_jump_to_position() . Further more the value is not displayed, see gtk_scale_set_draw_value() .
Returns: | a new hildonized GtkHScale |
---|
Creates a new vertical scale widget that lets the user select a value. The value is technically a double between 0.0 and 1.0. See gtk_adjustment_configure() for reconfiguring the adjustment.
The scale is hildonized, which means that a click or tap immediately jumps to the desired position, see gtk_range_set_jump_to_position() . Further more the value is not displayed, see gtk_scale_set_draw_value() .
Returns: | a new hildonized gtk.VScale |
---|
hildon.Button hildon.CheckButton
Returns the icon size (height) for the given, named icon. In most cases it’s much more convienient to call one of the predefined macros instead of this function directly.
Parameter: | size – the icon size to get pixel size for |
---|---|
Returns: | the height/width of icon to use. O if icon could not be found. |
Hildon provides some helper functions that can be used for commonly performed tasks and functionality blocks. This includes operations on widget styles and probing functions for touch events.
This function assigns a defined logical font to the widget and all its child widgets. it also connects to the “style_set” signal which will retrieve assign the new font for the given logical name each time the theme is changed The returned signal id can be used to disconnect the signal. When calling multiple times the previous signal (obtained by calling this function) is disconnected automatically and should not be used.
Parameters: |
|
---|---|
Returns: | the signal id that is triggered every time theme is changed. 0 if font set failed. |
This function assigns a defined logical color to the widget and all it’s child widgets. It also connects to the “style_set” signal which will retrieve assign the new color for the given logical name each time the theme is changed. The returned signal id can be used to disconnect the signal. When calling multiple times the previous signal (obtained by calling this function) is disconnected automatically and should not be used.
Example: If the style you want to modify is bg[NORMAL] then set rcflags to GTK_RC_BG and state to GTK_STATE_NORMAL.
Parameters: |
|
---|---|
Returns: | The signal id that is triggered every time theme is changed. 0 if color set failed. |
Checks if the given button event is a finger event.
Parameter: | event – A GtkEventButton to check |
---|---|
Returns: | True if the event is a finger event. |
Warning
hildon_helper_set_insensitive_message() is deprecated and should not be used in newly-written code. As of hildon 2.2, it is strongly discouraged to use insensitive messages.
This function assigns an insensitive message to a widget. When the widget is in an insensitive state and the user activates it, the message will be displayed using a standard hildon.Banner.
Parameters: |
|
---|
Warning
hildon_helper_set_insensitive_messagef() is deprecated and should not be used in newly-written code. As of hildon 2.2, it is strongly discouraged to use insensitive messages.
A version of hildon_helper_set_insensitive_message with string formatting.
Parameters: |
|
---|
This function enables a thumb scrollbar on a given scrolled window. It’ll convert the existing normal scrollbar into a larger, finger-usable scrollbar that works without a stylus. As fingerable list rows are fairly high, consider using the whole available vertical space of your application for the content in order to have as many rows as possible visible on the screen at once.
Finger-Sized scrollbar should always be used together with finger-sized content.
Parameters: |
|
---|
GObject
+----Program
Program is an object used to represent an application running in the Hildon framework.
Applications can have one or more hildon.Window s. These can be registered in the Program with Program.add_window() , and can be unregistered similarly with Program.remove_window() .
Program provides the programmer with commodities such as applying a common toolbar and menu to all registered hildon.Window s. This is done with Program.set_common_menu() , Program.set_common_app_menu() and Program.set_common_toolbar().
Program is also used to apply program-wide properties that are specific to the Hildon framework. For instance Program.set_can_hibernate() sets whether or not an application can be set to hibernate by the Hildon task navigator, in situations of low memory.
program = hildon.Program.get_instance()
window1 = hildon.Window()
window2 = hildon.Window()
common_toolbar = create_common_toolbar()
window_specific_toolbar = create_window_specific_toolbar()
menu = create_menu()
program.add_window(window1)
program.add_window(window2)
program.set_common_app_menu (menu)
program.set_common_toolbar (common_toolbar)
window1.add_toolbar (window_specific_toolbar)
program.set_can_hibernate (True)
Returns the Program for the current process. The object is created on the first call. Note that you’re not supposed to unref the returned object since it’s not reffed in the first place.
Returns: | the Program . |
---|
Registers a hildon.Window as belonging to a given Program . This allows to apply program-wide settings as all the registered windows, such as Program.set_common_menu() , Program.set_common_app_menu() and Program.set_common_toolbar().
Parameter: | window – A hildon.Window to be added |
---|
Used to unregister a window from the program. Subsequent calls to Program.set_common_menu() , Program.set_common_app_menu() and Program.set_common_toolbar() will not affect the window.
Parameter: | window – The hildon.Window to unregister |
---|
Used to set whether or not the Hildon task navigator should be able to set the program to hibernation in case of low memory
Parameter: | can_hibernate – whether or not the Program can hibernate |
---|
Returns whether the Program is set to be support hibernation from the Hildon task navigator
Returns: | True if the program can hibernate, False otherwise. |
---|
Sets a gtk.Menu that will appear in all hildon.Window s registered with the Program . Only one common gtk.Menu can be set, further calls will detach the previous common gtk.Menu . A hildon.Window can use its own gtk.Menu with hildon.Window.set_menu()
This method does not support hildon.AppMenu s. See Program.set_common_app_menu() for that.
Parameter: | menu – A gtk.Menu to use as common menu for the program |
---|
Returns the gtk.Menu that was set as common menu for this Program .
Returns: | the gtk.Menu or None of no common menu was set. |
---|
Sets a hildon.AppMenu that will appear in all hildon.Window s registered with the Program . Only one common hildon.AppMenu can be set, further calls will detach the previous common hildon.AppMenu . A hildon.Window can use its own hildon.AppMenu with hildon.Window.set_app_menu()
This method does not support gtk.Menu s. See Program.set_common_menu() for that.
Parameter: | menu – A hildon.AppMenu to use as common menu for the program |
---|
Returns the hildon.AppMenu that was set as common menu for this Program .
Returns: | the hildon.AppMenu or None of no common app menu was set. |
---|
Sets a gtk.Toolbar that will appear in all the hildon.Window registered to the Program . Only one common gtk.Toolbar can be set, further call will detach the previous common gtk.Toolbar . A hildon.Window can use its own gtk.Toolbar with hildon.Window.add_toolbar() . Both Program and hildon.Window specific toolbars will be shown
Parameter: | toolbar – A gtk.Toolbar to use as common toolbar for the program |
---|
Returns the gtk.Toolbar that was set as common toolbar for this Program .
Returns: | the gtk.Toolbar or None of no common toolbar was set. |
---|
Returns whether one of the program’s windows or dialogs is currently activated by the window manager.
Returns: | True if a window or dialog is topmost, False otherwise. |
---|
Warning
Program.pop_window_stack() is deprecated and should not be used in newly-written code. Use hildon.Window.stack_pop() instead
Pops a window from the stack.
Returns: | A hildon.StackableWindow , or None |
---|
Warning
Program.peek_window_stack() is deprecated and should not be used in newly-written code. Use hildon.Window.stack_peek() instead
Returns: | A hildon.StackableWindow , or None |
---|
Warning
Program.go_to_root_window() is deprecated and should not be used in newly-written code. See hildon.WindowStack
Goes to the root window of the stack.
Name | type | Access | Default | Meaning |
---|---|---|---|---|
can-hibernate | bool | Read / Write | False | Whether the program should be set to hibernate by the Task Navigator in low memory situation. |
is-topmost | bool | Read | False | Whether one of the program’s window or dialog currently is activated by window manager. |