Package gazpacho :: Module widgetadaptor :: Class WidgetAdaptor
[frames | no frames]

Type WidgetAdaptor

BaseWidgetAdaptor --+
                    |
           object --+
                    |
                   WidgetAdaptor

Known Subclasses:
ContainerAdaptor

Base class for all widget adaptors

A widget adaptor is the main class of a library plugin. There is a widget adaptor for every widget in the library that needs to do anything special upon certain events in Gazpacho. See this class virtual methods for examples of such special events.

The rest of widgets (e.g. regular widgets) use just an instance of this base class, which provides the basic functionality.

Check gazpacho/widgets/base/base.py for examples of widget adaptors.
Method Summary
  button_release(self, context, widget, event)
Called when a button release event occurs in the widget.
  create(self, context, interactive)
Called when creating a widget, it should return an instance of self.type
  fill_empty(self, context, widget)
After the widget is created this function is called to put one or more placeholders in it.
  get_children(self, context, widget)
To get the list of children for a widget, overridable by subclasses
  get_default(self)
  get_default_prop_value(self, prop, parent_type)
This is responsible for accessing the default value of a property.
  is_toplevel(self)
Return true if it's a toplevel, False otherwise
  list_signals(self)
Return a list of signals
  load(self, context, widget)
Build a gadget from a widget
  motion_notify(self, context, widget, event)
Called when the mouse is moved on the widget.
  post_create(self, context, widget, interactive)
Called after all initialization is done in the creation process.
  replace_child(self, context, old_widget, new_widget, parent_widget)
Called when the user clicks on a placeholder having a palette icon selected.
  save(self, context, widget)
Prepares the widget to be saved.

Instance Variable Summary
  cursor: @ivar pixbuf
  default: default widget as created in gobject.new().
  default_child: for packing properties we need to save the default child too
  editor_name: Name displayed in the editor
  generic_name: generic_name is used to create default widget names
  icon:  
  library:  
NoneType name: Optional identifier of adaptor, GType name of type will be used if not specified
  palette_name: palette_name is used in the palette
  tooltip: the tooltip is shown in the palette
NoneType type: GTK type for this widget.
  type_name: type_name is used when saving the xml

Method Details

button_release(self, context, widget, event)

Called when a button release event occurs in the widget.

Note that if the widget is a windowless widget the event is actually produced in its first parent with a gdk window so you will probably want to translate the event coordinates.

create(self, context, interactive=True)

Called when creating a widget, it should return an instance of self.type

fill_empty(self, context, widget)

After the widget is created this function is called to put one or more placeholders in it. Only useful for container widgets

get_children(self, context, widget)

To get the list of children for a widget, overridable by subclasses

get_default_prop_value(self, prop, parent_type)

This is responsible for accessing the default value of a property. And what we consider default is the value assigned to an object immediatelly after it's called gobject.new. parent_name is used for packing properties
Parameters:
prop - a property
parent_type - parent gtype

is_toplevel(self)

Returns:
True if it's a toplevel, False otherwise

list_signals(self)

Returns:
a list of signals

load(self, context, widget)

Build a gadget from a widget

The loading is a two step process: first we get the widget tree from gazpacho.loader or libglade and then we create the gadgets from that widget tree. This function is responsable of the second step of this loading process

motion_notify(self, context, widget, event)

Called when the mouse is moved on the widget.

Note that if the widget is a windowless widget the event is actually produced in its first parent with a gdk window so you will probably want to translate the event coordinates.

post_create(self, context, widget, interactive=True)

Called after all initialization is done in the creation process.

It takes care of creating the gadgets associated with internal children. It's also the place to set sane defaults, e.g. set the size of a window.

replace_child(self, context, old_widget, new_widget, parent_widget)

Called when the user clicks on a placeholder having a palette icon selected. It replaced a placeholder for the new widget.

It's also called in the reverse direction (replacing a widget for a placeholder) when removing a widget or undoing a create operation.

save(self, context, widget)

Prepares the widget to be saved. Basically this mean setting all the gazpacho.widgets for internal children so the filewriter can iterate through them and write them correctly.

Instance Variable Details

cursor

@ivar pixbuf

default

default widget as created in gobject.new(). It is used to decide if any property has changed

default_child

for packing properties we need to save the default child too

editor_name

Name displayed in the editor

generic_name

generic_name is used to create default widget names

icon

library

name

Optional identifier of adaptor, GType name of type will be used if not specified
Type:
NoneType
Value:
None                                                                  

palette_name

palette_name is used in the palette

tooltip

the tooltip is shown in the palette

type

GTK type for this widget. Used to create widgets with gobject.new()
Type:
NoneType
Value:
None                                                                  

type_name

type_name is used when saving the xml

Generated by Epydoc 2.1 on Mon Jan 29 16:46:04 2007 http://epydoc.sf.net