2006-02-03 21:19:59 +05:30
|
|
|
|
|
|
|
import gtk
|
|
|
|
import logging
|
|
|
|
log = logging.getLogger(".")
|
|
|
|
|
|
|
|
from _ListCursor import ListCursor
|
|
|
|
|
|
|
|
from _FastModel import FastModel
|
2007-10-08 22:11:39 +05:30
|
|
|
import gen.lib
|
2006-02-03 21:19:59 +05:30
|
|
|
|
|
|
|
|
|
|
|
class PersonListModel(FastModel):
|
2008-02-24 19:25:55 +05:30
|
|
|
"""Provide a fast model interface to the Person table.
|
2006-02-03 21:19:59 +05:30
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self,db):
|
|
|
|
FastModel.__init__(self,db)
|
|
|
|
|
|
|
|
def _get_table(self,db):
|
|
|
|
return db.surnames
|
|
|
|
|
|
|
|
def _get_cursor(self,db):
|
|
|
|
return ListCursor(db.surnames.cursor())
|
|
|
|
|
|
|
|
def _get_object_class(self,db):
|
2007-10-08 22:11:39 +05:30
|
|
|
return gen.lib.Person
|
2006-02-03 21:19:59 +05:30
|
|
|
|
|
|
|
def _get_length(self,db):
|
|
|
|
return self._table.stat()['ndata']
|
|
|
|
|
|
|
|
def on_get_flags(self):
|
|
|
|
return gtk.TREE_MODEL_LIST_ONLY|gtk.TREE_MODEL_ITERS_PERSIST
|