Bases: gtkmvc.observer.Observer
Two positional and two optional keyword arguments.
model will have the new instance registered as an observer. It is made available as an attribute.
view may contain signal connections loaded from XML. The handler methods have to exist in this class.
spurious denotes whether notifications in this class will be called if a property of model is set to the same value it already has.
auto_adapt denotes whether to call adapt() with no arguments as part of the view registration process.
View registration consists of connecting signal handlers, register_view() and register_adapters(), and is scheduled with the GTK main loop. It happens as soon as possible but after the constructor returns. When it starts view is available as an attribute.
Used to search self.view when adapt() is not given a widget name.
prop_name is the name of a property in the model.
Returns a string with the best match. Raises TooManyCandidatesError or ValueError when nothing is found.
Subclasses can customise this. No super call necessary. The default implementation converts prop_name to lower case and allows prefixes like entry_.
There are four ways to call this:
Take properties from the model for which adapt has not yet been called, match them to the view by name, and create adapters fitting for the respective widget type.
That information comes from gtkmvc.adapters.default. See _find_widget_match() for name patterns.
Changed in version 1.99.1: Allow incomplete auto-adaption, meaning properties for which no widget is found.
Keep track of manually created adapters for future adapt() calls.
ad is an adapter instance already connected to a widget.
Like adapt() for a single property.
prop_name is a string.
Like adapt(prop_name) but without widget name matching.
wid_name has to exist in the view.
This does nothing. Subclasses can override it to connect signals manually or modify widgets loaded from XML, like adding columns to a TreeView. No super call necessary.
view is a shortcut for self.view.