This page contains the Support Package documentation.
Bases: type
This is a meta-class that provides auto-property support. The idea is to allow programmers to define some properties which will be automatically connected to auto-generated code which handles access to those properties. How can you use this meta-class? First, ‘__metaclass__ = PropertyMeta’ must be class member of the class you want to make the automatic properties handling. Second, ‘__properties__’ must be a map containing the properties names as keys, values will be initial values for properties. That’s all: after the instantiation, your class will contain all properties you named inside ‘__properties__’. Each of them will be also associated to a couple of automatically-generated functions which get and set the property value inside a generated member variable. About names: suppose the property is called ‘x’. The generated variable (which keeps the real value of the property x) is called _prop_x. The getter is called get_prop_x(self), and the setter is called ‘set_prop_x(self, value)’.
Customization: The base implementation of getter is to return the value stored in the variable associated to the property. The setter simply sets its value. Programmers can override basic behaviour for getters or setters simply by defining their getters and setters (see at the names convention above). The customized function can lie everywhere in the user classes hierarchy. Every overridden function will not be generated by the metaclass.
To supply your own methods is good for few methods, but can result in a very unconfortable way for many methods. In this case you can extend the meta-class, and override methods get_[gs]etter_source with your implementation (this can be probably made better). An example is provided in meta-class PropertyMetaVerbose below.
class constructor
Returns a function wich is a getter for a property. prop_name is the name off the property.
user_getter is an optional function doing the work. If specified, that function will be called instead of getting the attribute whose name is in ‘prop_name’.
If user_getter is specified with a False value for getter_takes_name (default), than the method is used to get the value of the property. If True is specified for getter_takes_name, then the user_getter is called by passing the property name (i.e. it is considered a general method which receive the property name whose value has to be returned.)
Bases: gtkmvc.support.metaclasses.PropertyMeta
Classes instantiated by this meta-class must provide a method named notify_property_change(self, prop_name, old, new)
Bases: gtkmvc.support.metaclasses.ObservablePropertyMeta
This class provides multithreading support for accesing properties, through a locking mechanism. It is assumed a lock is owned by the class that uses it. A Lock object called _prop_lock is assumed to be a member of the using class. see for example class ModelMT
This decorator makes decorators behave well wrt to decorated functions names, doc, etc.
Differently from good_decorator, this accepts decorators possibly receiving arguments and keyword arguments.
This decorato can be used indifferently with class methods and functions.