Class e.p.p.w.w.Widget(Group):

Part of elisa.plugins.pigment.widgets.widget View In Hierarchy

Known subclasses: elisa.plugins.database.scanning_widget.ScannerWidget, elisa.plugins.database.widgets.synopsis.SynopsisWidget, elisa.plugins.pigment.widgets.box.Box, elisa.plugins.pigment.widgets.button.Button, elisa.plugins.pigment.widgets.entry.Entry, elisa.plugins.pigment.widgets.indicator_progressbar.Indicator, elisa.plugins.pigment.widgets.label.Label, elisa.plugins.pigment.widgets.list.List, elisa.plugins.pigment.widgets.osk.Button, elisa.plugins.pigment.widgets.osk.OnScreenKeyboard, elisa.plugins.pigment.widgets.range.Range, elisa.plugins.pigment.widgets.size_enforcer.Square, elisa.plugins.poblesec.base.grid.GridItem, elisa.plugins.poblesec.base.preview_list.PreviewWidget, elisa.plugins.poblesec.base.preview_list.Shortcut, elisa.plugins.poblesec.configuration.base.BaseScreenWidget, elisa.plugins.poblesec.login_settings_controller.ReturnButton, elisa.plugins.poblesec.player_video.CoverOverlay, elisa.plugins.poblesec.player_video.MouseOsd, elisa.plugins.poblesec.player_video.PlayerOsd, elisa.plugins.poblesec.plugins.PluginInformationWidget, elisa.plugins.poblesec.plugins.UsePluginWidget, elisa.plugins.poblesec.poblesec_browser_controller.BottomBar, elisa.plugins.poblesec.poblesec_browser_controller.BreadCrumbs, elisa.plugins.poblesec.poblesec_browser_controller.Crumb, elisa.plugins.poblesec.poblesec_browser_controller.TopBar, elisa.plugins.poblesec.poblesec_browser_controller.TopBarButton, elisa.plugins.poblesec.poblesec_browser_controller.TopBarWithBreadCrumbs, elisa.plugins.poblesec.popup.PopupWidget, elisa.plugins.poblesec.sections_menu.SectionItemWidget, elisa.plugins.poblesec.viewport_buttons.AutohideButtons, elisa.plugins.poblesec.widgets.button.IconButton, elisa.plugins.poblesec.widgets.button.StateButton, elisa.plugins.poblesec.widgets.button.TextButton, elisa.plugins.poblesec.widgets.entry.EntryBar, elisa.plugins.poblesec.widgets.image_with_reflection.ImageWithReflection, elisa.plugins.poblesec.widgets.loading_animation.LoadingAnimation, elisa.plugins.poblesec.widgets.long_loading_image.LongLoadingImage, elisa.plugins.poblesec.widgets.menu_item.MenuItemWidget, elisa.plugins.poblesec.widgets.nothing_to_display.NothingToDisplay, elisa.plugins.poblesec.widgets.player.buffering_bar.BufferingBar, elisa.plugins.poblesec.widgets.player.button.Button, elisa.plugins.poblesec.widgets.player.volumebar.VolumeBar, elisa.plugins.poblesec.widgets.search_results.SearchResultEntryWidget, elisa.plugins.poblesec.widgets.search_results.SearchResultWidget, elisa.plugins.poblesec.widgets.selector.ActionSelector, elisa.plugins.poblesec.widgets.sliced_image.SlicedImageHorizontal, elisa.plugins.shelf.shelf_controller.PluginWidget, elisa.plugins.shelf.shelf_controller.ShelfHeader

Basic widget for the python Pigment scenegraph.

It handles a simple focus system (at most one widget having the focus at one time) and a simple style system (with style and style-properties change notifications, also bound to state changes).

Emit these signals:

Instance Variablesnamethe name of the widget (type: string )
stylethe present style of the widget (type: pgm.widget.Style )
statethe present state of the widget (type: enum(STATE_NORMAL, STATE_ACTIVE, STATE_PRELIGHT, STATE_SELECTED, STATE_INSENSITIVE) )
Line # Kind Name Docs
73 Method __init__ Set the default styles for the widget. Subclasses should override and
134 Method state__get The present state of the widget
138 Method state__set Set the state of the widget and emit the "state-changed" signal if
155 Method do_state_changed Default 'state-changed' handler
162 Method style__get The present style
166 Method style__set Set the present style, after binding it to the widget and subscribing
193 Method do_style_set Default 'style-set' signal handler
275 Method update_style_properties Update the widget's appearence basing on the properties set.
312 Method get_parent Get the parent, if exists.
320 Method get_children Get the list of direct children.
328 Method get_root Get the root of the widget's tree hierarchy
339 Method get_descendants Get the list of nodes in the subtree
376 Method focus__get Whether the widget has focus
380 Method focus__set Set the focus state on the widget emitting the 'focus' signal on the
417 Method focus_child__get Get the child with focus
423 Method do_key_press_event Default 'key-press-event' signal handler.
438 Method clean Undocumented
492 Class Method demo Create a demo widget, put it on a canvas and show it in a viewport.
96 Method _init_styles Undocumented
189 Method _style_property_changed Undocumented
198 Method _parse_style_key Parse a style property key into a couple (widget, attribute name).
236 Method _parse_style_value Parse a style property value.
353 Method _set_focused Set or unset the focused widget and update the focused child property of
435 Method _do_real_key_press_event Undocumented
445 Class Method _demo_create_viewport Undocumented
452 Class Method _on_demo_delete Undocumented
460 Class Method _demo_widget Meant to be overidden by inheriting widgets for widget creation and
471 Class Method _set_demo_widget_defaults Undocumented

Inherited from Group:

Line # Kind Name Docs
85 Method canvas__set Undocumented
105 Method canvas__get Undocumented
110 Method layer__set Undocumented
123 Method layer__get Undocumented
131 Method add Undocumented
173 Method remove Undocumented
192 Method empty Undocumented
202 Method __len__ Undocumented
205 Method __iter__ Undocumented
208 Method update_absolute_x Undocumented
215 Method update_absolute_y Undocumented
222 Method update_absolute_z Undocumented
229 Method update_absolute_position Undocumented
236 Method update_absolute_width Undocumented
245 Method update_absolute_height Undocumented
254 Method update_absolute_size Undocumented
263 Method update_absolute_visible Undocumented
268 Method update_absolute_opacity Undocumented
274 Method regenerate Undocumented
161 Method _proxy_child_signal_scrolled Undocumented
165 Method _proxy_child_signal Undocumented
169 Method _proxy_child_signal_with_pressure Undocumented

Inherited from Node (via Group):

Line # Kind Name Docs
39 Method absolute_width__get Undocumented
42 Method absolute_width__set Undocumented
47 Method absolute_height__get Undocumented
50 Method absolute_height__set Undocumented
55 Method absolute_x__get Undocumented
58 Method absolute_x__set Undocumented
64 Method absolute_y__get Undocumented
67 Method absolute_y__set Undocumented
73 Method absolute_z__get Undocumented
76 Method absolute_z__set Undocumented
82 Method parent__set Undocumented
95 Method parent__get Undocumented
100 Method x__get Undocumented
106 Method x__set Undocumented
122 Method y__get Undocumented
128 Method y__set Undocumented
145 Method z__get Undocumented
151 Method z__set Undocumented
168 Method position__get Undocumented
174 Method position__set Undocumented
198 Method width__get Undocumented
204 Method width__set Undocumented
222 Method height__get Undocumented
228 Method height__set Undocumented
248 Method size__get Undocumented
254 Method size__set Undocumented
274 Method visible__get Undocumented
280 Method visible__set Undocumented
297 Method opacity__get Undocumented
303 Method opacity__set Undocumented
def __init__(self):
overridden in elisa.plugins.database.scanning_widget.ScannerWidget, elisa.plugins.database.widgets.synopsis.SynopsisWidget, elisa.plugins.pigment.widgets.box.Box, elisa.plugins.pigment.widgets.button.Button, elisa.plugins.pigment.widgets.entry.Entry, elisa.plugins.pigment.widgets.indicator_progressbar.Indicator, elisa.plugins.pigment.widgets.label.Label, elisa.plugins.pigment.widgets.list.List, elisa.plugins.pigment.widgets.osk.Button, elisa.plugins.pigment.widgets.osk.OnScreenKeyboard, elisa.plugins.pigment.widgets.range.Range, elisa.plugins.pigment.widgets.size_enforcer.Square, elisa.plugins.poblesec.base.grid.GridItem, elisa.plugins.poblesec.base.preview_list.PreviewWidget, elisa.plugins.poblesec.base.preview_list.Shortcut, elisa.plugins.poblesec.configuration.base.BaseScreenWidget, elisa.plugins.poblesec.login_settings_controller.ReturnButton, elisa.plugins.poblesec.player_video.CoverOverlay, elisa.plugins.poblesec.player_video.MouseOsd, elisa.plugins.poblesec.player_video.PlayerOsd, elisa.plugins.poblesec.plugins.PluginInformationWidget, elisa.plugins.poblesec.plugins.UsePluginWidget, elisa.plugins.poblesec.poblesec_browser_controller.BottomBar, elisa.plugins.poblesec.poblesec_browser_controller.BreadCrumbs, elisa.plugins.poblesec.poblesec_browser_controller.Crumb, elisa.plugins.poblesec.poblesec_browser_controller.TopBar, elisa.plugins.poblesec.poblesec_browser_controller.TopBarButton, elisa.plugins.poblesec.poblesec_browser_controller.TopBarWithBreadCrumbs, elisa.plugins.poblesec.popup.PopupWidget, elisa.plugins.poblesec.sections_menu.SectionItemWidget, elisa.plugins.poblesec.viewport_buttons.AutohideButtons, elisa.plugins.poblesec.widgets.button.IconButton, elisa.plugins.poblesec.widgets.button.StateButton, elisa.plugins.poblesec.widgets.button.TextButton, elisa.plugins.poblesec.widgets.entry.EntryBar, elisa.plugins.poblesec.widgets.image_with_reflection.ImageWithReflection, elisa.plugins.poblesec.widgets.loading_animation.LoadingAnimation, elisa.plugins.poblesec.widgets.long_loading_image.LongLoadingImage, elisa.plugins.poblesec.widgets.menu_item.MenuItemWidget, elisa.plugins.poblesec.widgets.nothing_to_display.NothingToDisplay, elisa.plugins.poblesec.widgets.player.buffering_bar.BufferingBar, elisa.plugins.poblesec.widgets.player.button.Button, elisa.plugins.poblesec.widgets.player.volumebar.VolumeBar, elisa.plugins.poblesec.widgets.search_results.SearchResultEntryWidget, elisa.plugins.poblesec.widgets.search_results.SearchResultWidget, elisa.plugins.poblesec.widgets.selector.ActionSelector, elisa.plugins.poblesec.widgets.sliced_image.SlicedImageHorizontal, elisa.plugins.shelf.shelf_controller.PluginWidget, elisa.plugins.shelf.shelf_controller.ShelfHeader
Set the default styles for the widget. Subclasses should override and call "self.update_style_properties(self.style.get_items())" after calling this base class constructor.
def _init_styles(self):
Undocumented
def state__get(self):
The present state of the widget
def state__set(self, state):
Set the state of the widget and emit the "state-changed" signal if necessary.
Parametersstatethe new state (type: enum(STATE_NORMAL, STATE_ACTIVE, STATE_PRELIGHT, STATE_SELECTED, STATE_INSENSITIVE) )
def do_state_changed(self, previous_state):
Default 'state-changed' handler
def style__get(self):
The present style
def style__set(self, style):
Set the present style, after binding it to the widget and subscribing for property change notifications.
Parametersstylethe style to set (type: pgm.widget.Style )
def _style_property_changed(self, style, key, value):
Undocumented
def do_style_set(self, style):
Default 'style-set' signal handler
def _parse_style_key(self, key, logstr):
Parse a style property key into a couple (widget, attribute name).

The following keys will be parsed:
 * "subwidget-attribute": C{self.subwidget.attribute}
 * "attribute": C{self.attribute}

@param key:    the key of the style property to parse
@type key:     C{str}
@param logstr: a base string to use when logging parsing errors
@type logstr:  C{str}

@raise AttributeError: when the key fails to be parsed

@return: a tuple (widget, attribute name, enriched logging string)
@rtype:  (L{Widget}, C{str}, C{str})
def _parse_style_value(self, value, widget, attribute, logstr):
Parse a style property value.

Pigment properties will be transformed based on the type of the widget they apply to and the name of the attribute.

Parametersvaluethe value of the style property to parse (type: str )
widgetthe widget the style property applies to (type: Widget )
attributethe name of the attribute the style property applies to (type: str )
logstra base string to use when logging parsing errors (type: str )
Returnsthe value transformed (if relevant, untouched otherwise)
RaisesAttributeErrorwhen the value fails to be parsed to a valid pigment property
def update_style_properties(self, props=None):
Update the widget's appearence basing on the properties set.

By default all properties that can match a public member of the widget will be applied automatically. If custom style properties not matching real subwidgets/attributes need to be defined, this method should be overridden: the custom properties should be processed first, and then the remaining properties passed to the parent's update_style_properties method.

Parameterspropsthe properties that have to be updated (type: dictionary of strings ==> anything )
def get_parent(self):
Get the parent, if exists.
Returnselisa.plugins.pigment.widgets.Widget
def get_children(self):
Get the list of direct children.
Returnslist of elisa.plugins.pigment.widgets.Widget
def get_root(self):
Get the root of the widget's tree hierarchy
Returnselisa.plugins.pigment.widgets.Widget
def get_descendants(self):
Get the list of nodes in the subtree
Returnslist of elisa.plugins.pigment.widgets.Widget
def _set_focused(self, state):
Set or unset the focused widget and update the focused child property of the ancestors.
Parametersvaluethe focus state. (type: boolean. )
def focus__get(self):
Whether the widget has focus
def focus__set(self, state):
Set the focus state on the widget emitting the 'focus' signal on the previously focused widget and then on self.
Parametersvaluethe focus state. (type: boolean. )
def focus_child__get(self):
Get the child with focus
def do_key_press_event(self, viewport, event, widget):
Default 'key-press-event' signal handler.

Forward the signal to the focused child, if any.

def _do_real_key_press_event(self, viewport, event, widget):
Undocumented
def clean(self):
overridden in elisa.plugins.database.scanning_widget.ScannerWidget, elisa.plugins.database.widgets.synopsis.SynopsisWidget, elisa.plugins.pigment.widgets.box.Box, elisa.plugins.pigment.widgets.entry.Entry, elisa.plugins.pigment.widgets.list.List, elisa.plugins.pigment.widgets.osk.Button, elisa.plugins.pigment.widgets.osk.OnScreenKeyboard, elisa.plugins.pigment.widgets.size_enforcer.Square, elisa.plugins.poblesec.base.grid.GridItem, elisa.plugins.poblesec.base.preview_list.PreviewWidget, elisa.plugins.poblesec.configuration.base.BaseScreenWidget, elisa.plugins.poblesec.plugins.PluginInformationWidget, elisa.plugins.poblesec.plugins.UsePluginWidget, elisa.plugins.poblesec.popup.PopupWidget, elisa.plugins.poblesec.viewport_buttons.HomeButton, elisa.plugins.poblesec.viewport_buttons.MinMaxCloseButtons, elisa.plugins.poblesec.widgets.button.IconButton, elisa.plugins.poblesec.widgets.button.StateButton, elisa.plugins.poblesec.widgets.button.TextButton, elisa.plugins.poblesec.widgets.entry.EntryBar, elisa.plugins.poblesec.widgets.loading_animation.LoadingAnimation, elisa.plugins.poblesec.widgets.long_loading_image.LongLoadingImage, elisa.plugins.poblesec.widgets.menu_item.MenuItemWidget, elisa.plugins.poblesec.widgets.player.buffering_bar.BufferingBar, elisa.plugins.poblesec.widgets.player.button.Button, elisa.plugins.poblesec.widgets.search_results.SearchResultEntryWidget, elisa.plugins.poblesec.widgets.search_results.SearchResultWidget, elisa.plugins.poblesec.widgets.sliced_image.SlicedImageHorizontal
Undocumented
@classmethod
def _demo_create_viewport(cls, plugin):
Undocumented
@classmethod
def _on_demo_delete(self, viewport, event):
Undocumented
@classmethod
def _demo_widget(cls):
Meant to be overidden by inheriting widgets for widget creation and setup at demo time.
Returnselisa.plugins.pigment.widgets.Widget
@classmethod
def _set_demo_widget_defaults(cls, widget, canvas, viewport):
Undocumented
@classmethod
def demo(cls, plugin='opengl'):
Create a demo widget, put it on a canvas and show it in a viewport.

Just start a pgm.main() or an "ipython -gthread" shell to interactively test your widget. See the __main__ block at the end of this file.

Returnsthe demo elisa.plugins.pigment.widgets.Widget
API Documentation for Elisa Media Center, generated by pydoctor at 2009-02-16 19:15:05.