next up previous contents
Next: Class StaticContainerAdapter Up: Module adapters Previous: Class Adapter   Contents

Class UserClassAdapter

This class handles the communication between a widget and a class instance (possibly observable) that is a property inside the model. The value to be shown is taken and stored by using a getter and a setter. getter and setter can be: names of user class methods, bound or unbound methods of the user class, or a function that will receive the user class instance and possible arguments whose number depends on whether it is a getter or a setter.

Class UserClassAdapter derives directly from class Adapter and redefines the constructor as follow.

  def __init__(self, model, prop_name,
               getter, setter, 
               prop_read=None, prop_write=None,                   
               value_error=None):

Where getter and setter are two new required parameters, and all the other are unchanged.

getter
can be a string holding the name of the user class method, a bound or unbound method of the user class, or a function that will receive the user class instance. The function or method is required to return the value to be read into the user class.

setter
can be a string holding the name of the user class method, a bound or unbound method of the user class, or a function that will receive the user class instance and a value for setting.


next up previous contents
Next: Class StaticContainerAdapter Up: Module adapters Previous: Class Adapter   Contents
Roberto Cavada 2008-08-26