next up previous
Next: The main code Up: The implementation without glade Previous: The view

The controller

The controller is the same that has been used for the glade-based version, a part from a further signal connection that is performed to connect the button clicked event to class method self.on_button_clicked. For this reason, class MyControllerNoGLade is derived from class MyController to reduce typing.

 
# This is file ctrl_no_glade.py
from ctrl_glade import MyController

class MyControllerNoGlade (MyController):

def __init__(self, model):
MyController.__init__(self, model)
return

def registerView(self, view):
MyController.registerView(self, view)

# connects the signals:
self.view['button'].connect('clicked', self.on_button_clicked)
return

pass # end of class



Roberto Cavada 2004-06-11