2 The Kiwi FrameWork

This section introduces the Kiwi framework, and shows the use cases that each of the main classes were designed for. Throughout this guide, I'll be showing code examples that are included in the distribution (in the examples/ directory); just install Kiwi and you are ready to run them. To start off with, I'll show a very simple Kiwi application that saves information defined in a graphical form. This app is included in Kiwi/examples/Person/person.py. Note that this app uses the glade file Person.glade.

This application (17 lines) renders an interface to edit personal data, transparently saving and loading it. A quick glance at the code:

  1. We define Person, a class to hold our application information
  2. unpickle_model() loads (creating, if it didn't exist) a Person instance.
  3. We create a GladeProxy instance, which loads an interface from a glade definition file and attaches it to the Person instance.
  4. We run the application; changes in the interface reflect transparently on the person instance.
  5. Upon exiting the mainloop, the window closes and we save the person. It is ready to be edited the next time we run the program.

This example is a summary of many Kiwi features; it exemplifies the Proxy class, which is one of the more featureful parts of the framework. This guide will take you gradually through the different classes in Kiwi, and the next section begins by describing the general Kiwi architecture.



Subsections