Class v.c.g.a.c.StaticContainerAdapter(UserClassAdapter):

Part of vmc.contrib.gtkmvc.adapters.containers View In Hierarchy

This class can be used to bound a set of widgets to a property that is a container, like a tuple, a list or a map, or in general a class that implements __getitem__ and __setitem__ methods.

From the other hand, the set of widgets can be a list provided by the user, or a container widget like a Box, a notebook, etc. Widgets will be linked by their position when the property is list-like, or by their name when the property is map-like.

This class supports only properties that are static containers, i.e. those containers that do not change their length dynamically. If the container grows up in length, no change will occur in the view-side.
Method __init__ Creates a new adapter that handles setting of value of a
Method connect_widget Called when the widget is instantiated, and the adapter is
Method update_model Updates the value of property at given index. If idx is
Method update_widget Forces the widget at given index to be updated from the

Inherited from UserClassAdapter:

Method _resolve_to_func This method resolves whatever is passed: a string, a
Method _get_observer_src This is the code for a method after_change observer
Method _get_property Private method that returns the value currently stored
Method _set_property Private method that sets the value currently of the property

Inherited from Adapter (via UserClassAdapter):

Method _connect_model Used internally to connect the property into the model, and
Method _add_method Private service to add a new method to the instance,
Method _read_property Returns the (possibly transformed) value that is stored
Method _write_property Sets the value of property. Given val is transformed
Method _cast_value Casts given val to given totype. Raises TypeError if not able to cast.
def __init__(self, model, prop_name, prop_read=None, prop_write=None, value_error=None):

Creates a new adapter that handles setting of value of a model single model property when a corresponding widgets set is changed and viceversa when the property is also observable.

This class handles only assignments to properties. For other kinds of setting (e.g. user-defined classes used as observable properties, containers, etc.) use other types of Adapters derived from this class.

prop_name is the model's property name (as a string). It is possible to use a dotted notation to identify a property contained into a hierarchy of models. For example 'a.b.c' identifies property 'c' into model 'b' inside model 'a', where model 'a' is an attribute of given top level model. Last name must be an observable or non-observable attribute, and previous names (if specified) must all refer to instances of class Model. First name from the left must be the name of a model instance inside the given model.

prop_{write,read} are two optional functions that apply custom modifications to the value of the property before setting and reading it. Both take a value and must return a transformed value whose type must be compatible with the type of the property.

value_error can be a function (or a method) to be called when a ValueError exception occurs while trying to set a wrong value for the property inside the model. The function will receive: the adapter, the property name and the value coming from the widget that offended the model.
def connect_widget(self, wid, getters=None, setters=None, signals=None, arg=None):
Called when the widget is instantiated, and the adapter is ready to connect the widgets inside it (if a container) or each widget if wid is a list of widgets. getters and setters can be None, a function or a list or a map of functions. signals can be None, a signal name, or a list or a map of signal names. When maps are used, keys can be widgets or widget names. The length of the possible lists or maps must be lesser or equal to the number of widgets that will be connected.
def update_model(self, idx=None):
Updates the value of property at given index. If idx is None, all controlled indices will be updated. This method should be called directly by the user in very unusual conditions.
def update_widget(self, idx=None):
Forces the widget at given index to be updated from the property value. If index is not given, all controlled widgets will be updated. This method should be called directly by the user when the property is not observable, or in very unusual conditions.
def _get_idx_from_widget(self, wid):
Given a widget, returns the corresponding index for the model. Returned value can be either an integer or a string
def _get_widget_from_idx(self, idx):
Given an index, returns the corresponding widget for the view. Given index can be either an integer or a string
def _read_widget(self, idx):
Returns the value currently stored into the widget, after transforming it accordingly to possibly specified function.
def _write_widget(self, val, idx):
Writes value into the widget. If specified, user setter is invoked.
def __handle_par(self, name, par):
Undocumented
def _on_wid_changed(self, wid):
Called when the widget is changed
def _on_prop_changed(self, instance, meth_name, res, args, kwargs):
Called by the observation code, we are interested in __setitem__
API Documentation for vodafone-mobile-connect-card-driver-for-linux, generated by pydoctor at 2008-01-10 13:06:31.