Package kiwi :: Package ui :: Module proxy :: Class Proxy
[frames | no frames]

Class Proxy


A Proxy is a class that 'attaches' an instance to an interface's widgets, and transparently manipulates that instance's attributes as the user alters the content of the widgets.

The Proxy takes the widget list and detects what widgets are to be attached to the model by looking if it is a KiwiWidget and if it has the model-attribute set.
Method Summary
  add_widget(self, name, widget)
Adds a new widget to the proxy
  new_model(*args, **kwargs)
  proxy_updated(self, widget, attribute, value)
This is a hook that is called whenever the proxy updates the model.
  remove_widget(self, name)
Removes a widget from the proxy
  set_model(self, model, relax_type)
Updates the model instance of the proxy.
  update(self, attribute, value, block)
Generic frontend function to update the contentss of a widget based on its model attribute name using the internal update functions.
  update_many(self, attributes, value, block)
Like update but takes a sequence of attributes

Property Summary
  model

Method Details

add_widget(self, name, widget)

Adds a new widget to the proxy
Parameters:
name - name of the widget
widget - widget, must be a gtk.Widget subclass

proxy_updated(self, widget, attribute, value)

This is a hook that is called whenever the proxy updates the model. Implement it in the inherited class to perform actions that should be done each time the user changes something in the interface. This hook by default does nothing.
Parameters:
widget -
attribute -
value -

remove_widget(self, name)

Removes a widget from the proxy
Parameters:
name - the name of the widget to remove

set_model(self, model, relax_type=False)

Updates the model instance of the proxy. Allows a proxy interface to change model without the need to destroy and recreate the UI (which would cause flashing, at least)
Parameters:
model -
relax_type -

update(self, attribute, value=<class kiwi.ValueUnset at 0x402877dc>, block=False)

Generic frontend function to update the contentss of a widget based on its model attribute name using the internal update functions.
Parameters:
attribute - the name of the attribute whose widget we wish to updated. If accessing a radiobutton, specify its group name.
value - specifies the value to set in the widget. If unspecified, it defaults to the current model's value (through an accessor, if it exists, or getattr).
block - defines if we are to block cascading proxy updates triggered by this update. You should use block if you are calling update on *the same attribute that is currently being updated*. This means if you have hooked to a signal of the widget associated to that attribute, and you call update() for the *same attribute*, use block=True. And pray. 8). If block is set to False, the normal update mechanism will occur (the model being updated in the end, hopefully).

update_many(self, attributes, value=<class kiwi.ValueUnset at 0x402877dc>, block=False)

Like update but takes a sequence of attributes
Parameters:
attributes - sequence of attributes to update
value - see update
block - see update

Generated by Epydoc 2.1 on Fri Mar 23 15:56:54 2007 http://epydoc.sf.net