Package elisa :: Package plugins :: Package pigment :: Package widgets :: Module box :: Class Box

Class Box

source code


Box is an abstract widget that defines a specific kind of container that layouts a variable number of widgets into a rectangular area. The former is organized into either a single row or a single column of child widgets depending upon whether the box is of type HBox or VBox, respectively.

Use repeated calls to gtk_box_pack_start to pack widgets from start to end. Use gtk_box_pack_end to add widgets from end to start.

Instance Methods
 
__init__(self)
Set the default styles for the widget.
source code
 
create_widgets(self)
Override this method in subclasses to create subwidgets.
source code
 
regenerate(self) source code
 
do_mapped(self) source code
 
clean(self) source code
 
pack_start(self, widget, expand=False)
Add widget to the box packed after any other widget packed using pack_start.
source code
 
pack_end(self, widget, expand=False)
Add widget to the box packed after any other widget packed using pack_end.
source code
 
remove(self, widget) source code
 
pop(self) source code
 
__len__(self) source code
 
__contains__(self, widget) source code
 
spacing__get(self) source code
 
spacing__set(self, spacing) source code
 
padding__get(self) source code
 
padding__set(self, padding) source code
 
alignment__get(self) source code
 
alignment__set(self, alignment) source code
bool
set_focus(self)
Pass the focused state to the widget.
source code
bool
cycle_focus(self, reverse=False, excludes=[])
Try to pass the focus to the next child widget in a cyclic way.
source code
bool
handle_input(self, manager, event)
Handle an Elisa input event.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

    Inherited from widget.Widget
 
add_navigation_rule(self, start_widget, event_value, end_widget)
Add a specific navigation rule to the set of known rules.
source code
 
do_state_changed(self, previous_state)
Default 'state-changed' signal handler
source code
 
do_style_set(self, style)
Default 'style-set' signal handler
source code
 
get_children(self)
Get the list of direct children.
source code
 
get_descendants(self)
Get the list of nodes in the subtree
source code
 
get_parent(self)
Get the parent, if exists.
source code
 
get_root(self)
Get the root of the widget's tree hierarchy
source code
 
load_theme(self, theme)
DOCME
source code
 
remove_navigation_rule(self, start_widget, event_value)
Remove an existing navigation rule from the set of known rules.
source code
 
set_focus_proxy(self, proxy_widget)
DOCME
source code
 
set_name(self, name)
Set the name of the widget and potentially update its style if name specific rules were declared in the stylesheets.
source code
 
state__get(self)
The present state of the widget
source code
 
state__set(self, state)
Set the state of the widget and emit the "state-changed" signal if necessary.
source code
 
style__get(self)
The present style
source code
 
style__set(self, style)
Set the present style, after binding it to the widget and subscribing for property change notifications.
source code
 
update_style_properties(self, props=None)
Update the widget's appearence basing on the properties set.
source code
    Inherited from graph.group.Group
 
__iter__(self) source code
 
add(self, child, forward_signals=True, layer=None) source code
 
canvas__get(self) source code
 
canvas__set(self, canvas) source code
 
empty(self) source code
 
get_factors_absolute(self, unit)
Compute the size in absolute coordinates, that is the canvas coordinates system, of one 'unit' for the x-axis and for the y-axis.
source code
 
get_factors_relative(self, unit)
Compute the size in relative coordinates, that is in the group's coordinates system, of one 'unit' for the x-axis and for the y-axis.
source code
 
is_mapped(self)
True when the group is visible, that is when it is in a canvas and absolute_visible is True
source code
 
layer__get(self) source code
 
layer__set(self, layer) source code
 
set_absolute_height(self, value) source code
 
set_absolute_opacity(self, value) source code
 
set_absolute_position(self, value) source code
 
set_absolute_size(self, value) source code
 
set_absolute_visible(self, value) source code
 
set_absolute_width(self, value) source code
 
set_absolute_x(self, value) source code
 
set_absolute_y(self, value) source code
 
set_absolute_z(self, value) source code
 
update_absolute_height(self, parent) source code
 
update_absolute_opacity(self, parent) source code
 
update_absolute_position(self, parent) source code
 
update_absolute_size(self, parent) source code
 
update_absolute_visible(self, parent) source code
 
update_absolute_width(self, parent) source code
 
update_absolute_x(self, parent) source code
 
update_absolute_y(self, parent) source code
 
update_absolute_z(self, parent) source code
    Inherited from graph.node.Node
 
absolute_height__get(self) source code
 
absolute_height__set(self, value) source code
 
absolute_width__get(self) source code
 
absolute_width__set(self, value) source code
 
absolute_x__get(self) source code
 
absolute_x__set(self, value) source code
 
absolute_y__get(self) source code
 
absolute_y__set(self, value) source code
 
absolute_z__get(self) source code
 
absolute_z__set(self, value) source code
 
animated(self) source code
 
animated__get(self) source code
 
height__get(self) source code
 
height__set(self, value) source code
 
opacity__get(self) source code
 
opacity__set(self, value) source code
 
parent__get(self) source code
 
parent__set(self, parent) source code
 
position__get(self) source code
 
position__set(self, position) source code
 
size__get(self) source code
 
size__set(self, size) source code
 
visible__get(self) source code
 
visible__set(self, value) source code
 
width__get(self) source code
 
width__set(self, value) source code
 
x__get(self) source code
 
x__set(self, value) source code
 
y__get(self) source code
 
y__set(self, value) source code
 
z__get(self) source code
 
z__set(self, value) source code
Class Methods
    Inherited from widget.Widget
 
demo(cls, plugin='opengl')
Create a demo widget, put it on a canvas and show it in a viewport.
source code
Class Variables
elisa.core.input_event.EventValue prev_event_value = None
An event value to navigate to the previous widget
elisa.core.input_event.EventValue next_event_value = None
An event value to navigate to the next widget
    Inherited from widget.Widget
  __gsignals__ = {'focus':(gobject.SIGNAL_RUN_LAST, gobject.TYPE...
  focus = property(_focus__get, _focus__set)
    Inherited from graph.group.Group
  canvas = property(canvas__get, canvas__set)
  layer = property(layer__get, layer__set)
    Inherited from graph.node.Node
  absolute_height = property(absolute_height__get, absolute_heig...
  absolute_width = property(absolute_width__get, absolute_width_...
  absolute_x = property(absolute_x__get, absolute_x__set)
  absolute_y = property(absolute_y__get, absolute_y__set)
  absolute_z = property(absolute_z__get, absolute_z__set)
  height = property(height__get, height__set)
  opacity = property(opacity__get, opacity__set)
  parent = property(parent__get, parent__set)
  position = property(position__get, position__set)
  size = property(size__get, size__set)
  visible = property(visible__get, visible__set)
  width = property(width__get, width__set)
  x = property(x__get, x__set)
  y = property(y__get, y__set)
  z = property(z__get, z__set)
Instance Variables
elisa.plugins.pigment.widgets.theme.ValueWithUnit spacing = property(spacing__get, spacing__set)
amount of space between children
elisa.plugins.pigment.widgets.theme.ValueWithUnit padding = property(padding__get, padding__set)
amount of space between the first and last children and the border of the box
ALIGNMENT alignment = property(alignment__get, alignment__set)
defines where the children are positioned in the rectangular area of the box
bool navigable
Whether the box can be navigated.
    Inherited from widget.Widget
string name
the name of the widget
enum(STATE_NORMAL, STATE_PRESSED, STATE_HOVERED, STATE_SELECTED, STATE_DISABLED, STATE_CHECKED) state = property(state__get, state__set)
the present state of the widget
pgm.widget.Style style = property(style__get, style__set)
the present style of the widget
Properties

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

source code 

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.

Overrides: object.__init__
(inherited documentation)

regenerate(self)

source code 
Overrides: graph.group.Group.regenerate

clean(self)

source code 
Overrides: graph.node.Node.clean

pack_start(self, widget, expand=False)

source code 

Add widget to the box packed after any other widget packed using pack_start. Visually widget will be positioned after any other widget packed that way.

Parameters:
  • widget (elisa.plugins.pigment.widgets.widget.Widget) - widget to pack in the box
  • expand (bool) - True if widget is to be given extra space allocated to box. The extra space will be divided evenly between all widgets of box that use this option.

pack_end(self, widget, expand=False)

source code 

Add widget to the box packed after any other widget packed using pack_end. Visually widget will be positioned before any other widget packed that way.

Parameters:
  • widget (elisa.plugins.pigment.widgets.widget.Widget) - widget to pack in the box
  • expand (bool) - True if widget is to be given extra space allocated to box. The extra space will be divided evenly between all widgets of box that use this option.

remove(self, widget)

source code 
Overrides: graph.group.Group.remove

__len__(self)
(Length operator)

source code 
Overrides: graph.group.Group.__len__

set_focus(self)

source code 

Pass the focused state to the widget.

A widget accept the focus by default. This method may be overridden in specific widgets to implemented a different behaviour.

When this method returns False, the caller is notified that the focused widget hasn't changed.

Returns: bool
True if the widget or one of its descendants accepted the focus, False otherwise.
Overrides: widget.Widget.set_focus
(inherited documentation)

cycle_focus(self, reverse=False, excludes=[])

source code 

Try to pass the focus to the next child widget in a cyclic way.

Parameters:
Returns: bool
whether a child widget accepted the focus

handle_input(self, manager, event)

source code 

Handle an Elisa input event.

This method is meant to be called by the parent controller when the widget has the focus. The default implementation tries the known navigation rules and then passes the event to its parent. An event is considered handled when this method returns True.

Specific widgets may override this method to implement custom navigation.

Parameters:
  • manager - the input manager that emitted the event
  • event - the input event received
Returns: bool
True is the event was handled, False otherwise
Overrides: widget.Widget.handle_input
(inherited documentation)

Instance Variable Details

navigable

Whether the box can be navigated. Typically, a box that packs focusable widgets (i.e. not just used for graphical layout) should be navigable. False by default.
Type:
bool