Next: Controllers
Up: Details of implementation
Previous: Models, Controllers and Views
Contents
Models
Models must be used to hold the data of the application. They
can be connected to observers (like Controllers) by a mechanism
detailed by section 5.5. It is important to note that apart
from during the registration phase, the model does not know that
there exists a set observers connected to it.
All the code strictly related to the data of the application (i.e. not
related to any view of those data) will live in the model class.
There exist several model classes that users can derive their own
classes:
- gtkmvc.Model
- Standard model class. The derived class does not
multiple-derive from gobject classes, and there are not methods in
the class that run from threads different from the PyGTK main loop
thread. This is the base model class most likely users will derive
their own models.
- gtkmvc.ModelMT
- Multi-threading model used as the previous
class Model, but to be used in all cases when the PyGTK main loop
runs in a thread that is different from the thread running the
model. This is the typical case of a model that needs to perform
asynchronous operations that requires much time to complete, and
that can be ran on a different thread making the GUI still
responsive to the user actions. When the model's thread changes an
observable property, corresponding notifications will be
transparently delivered to the observers through their own thread.
- gtkmvc.TreeStoreModel
- To be used as a base model class that
derives both from Model and gtk.TreeStore.
- gtkmvc.TreeStoreModelMT
- To be used as a base model class that
derives both from ModelMT and gtk.TreeStore.
- gtkmvc.ListStoreModel
- To be used as a base model class that
derives both from Model and gtk.ListStore.
- gtkmvc.ListStoreModelMT
- To be used as a base model class that
derives both from ModelMT and gtk.ListStore.
- gtkmvc.TextBufferModel
- To be used as a base model class that
derives both from Model and gtk.TextBuffer.
- gtkmvc.TextBufferModelMT
- To be used as a base model class that
derives both from ModelMT and gtk.TextBuffer.
Next: Controllers
Up: Details of implementation
Previous: Models, Controllers and Views
Contents
Roberto Cavada
2008-08-26