A View is always associated to a Controller (that gets with its constructor call). When the view is created, it register itself to the controller by calling method Controller.registerView.
A View is also associated to a set of widgets. In general, this set can be organized as a set of trees of widgets. Each tree can be optionally be generated by using the Glade application (see section 5.1).
The View contructor is quite much complicated:
def __init__(self, controller, glade_filename=None, glade_top_widget_name=None, parent_view=None, register=True)
The View class also can be considered a map, that associates widget names to the corresponding widget objects. If file test.glade contains a Button you called start_button from within Glade, you can create the view and use it as follows:
from gtkmvc.view import View class MyView (View): def __init__(self, controller): View.__init__(self, controller, ``test.glade'') return pass m = MyModel() c = MyController(m) v = MyView(c) v['start_button'] # this returns a gtk.Button object
Instead of using only Glade files, sometimes the derived views create a set of widgets on the fly. If these widgets must be accessed later, they can be associated simply by (continuing the code above):
v['vbox_widget'] = gtk.VBox() ...
Typically the creation on the fly of new widgets is performed by the derived view contructor, that will delay the view registration.
Another important mechanism provided by the class View is the signal autoconnection. By using Glade users can associate to widget signals functions and methods to be called when associated events happen. When performs the registration, the View searches inside the corresponding Controller instance for methods to associate with signals, and all methods found are automatically connected.