2007-10-18 Benny Malengier <benny.malengier@gramps-project.org>

* src/DisplayModels/_BaseModel.py: remove comments
	* src/DisplayModels/_NoteModel.py: show all notes again in note view


svn: r9208
This commit is contained in:
Benny Malengier 2007-10-18 20:49:45 +00:00
parent 4a6723072e
commit f050646e31
3 changed files with 19 additions and 72 deletions

View File

@ -1,3 +1,7 @@
2007-10-18 Benny Malengier <benny.malengier@gramps-project.org>
* src/DisplayModels/_BaseModel.py: remove comments
* src/DisplayModels/_NoteModel.py: show all notes again in note view
2007-10-17 Benny Malengier <benny.malengier@gramps-project.org>
* src/GrampsDbUtils/_WriteGedcom.py: bug get_phon must be get_phone

View File

@ -223,7 +223,6 @@ class BaseModel(gtk.GenericTreeModel):
def _rebuild_search(self,ignore=None):
""" function called when view must be build, given a search text
in the top search bar
Remark: this method is overridden in NoteModel !
"""
self.total = 0
if self.db.is_open():
@ -243,7 +242,6 @@ class BaseModel(gtk.GenericTreeModel):
def _rebuild_filter(self, ignore=None):
""" function called when view must be build, given filter options
in the filter sidebar
Remark: this method is overridden in NoteModel !
"""
self.total = 0
if self.db.is_open():
@ -262,18 +260,18 @@ class BaseModel(gtk.GenericTreeModel):
self.node_map.clear_map()
def add_row_by_handle(self,handle):
if not self.search or (self.search and self.search.match(handle)):
if not self.search or (self.search and self.search.match(handle)):
data = self.map(handle)
data = self.map(handle)
key = locale.strxfrm(self.sort_func(data))
self.sort_data.append((key,handle))
self.sort_data.sort(reverse=self.reverse)
self.node_map.set_path_map([ x[1] for x in self.sort_data ])
self.sort_data.sort(reverse=self.reverse)
self.node_map.set_path_map([ x[1] for x in self.sort_data ])
index = self.node_map.get_path(handle)
if index != None:
node = self.get_iter(index)
self.row_inserted(index, node)
index = self.node_map.get_path(handle)
if index != None:
node = self.get_iter(index)
self.row_inserted(index, node)
def delete_row_by_handle(self,handle):
index = self.node_map.get_path(handle)
@ -295,15 +293,15 @@ class BaseModel(gtk.GenericTreeModel):
self.row_changed(index,node)
def on_get_flags(self):
'''returns the GtkTreeModelFlags for this particular type of model'''
return gtk.TREE_MODEL_LIST_ONLY | gtk.TREE_MODEL_ITERS_PERSIST
'''returns the GtkTreeModelFlags for this particular type of model'''
return gtk.TREE_MODEL_LIST_ONLY | gtk.TREE_MODEL_ITERS_PERSIST
def on_get_n_columns(self):
return 1
def on_get_path(self, node):
'''returns the tree path (a tuple of indices at the various
levels) for a particular node.'''
'''returns the tree path (a tuple of indices at the various
levels) for a particular node.'''
return self.node_map.get_path(node)
def on_get_column_type(self,index):
@ -327,7 +325,7 @@ class BaseModel(gtk.GenericTreeModel):
return u''
def on_iter_next(self, node):
'''returns the next node at this level of the tree'''
'''returns the next node at this level of the tree'''
return self.node_map.find_next_handle(node)
def on_iter_children(self,node):
@ -337,7 +335,7 @@ class BaseModel(gtk.GenericTreeModel):
return None
def on_iter_has_child(self, node):
'''returns true if this node has children'''
'''returns true if this node has children'''
if node == None:
return len(self.node_map) > 0
return False
@ -353,5 +351,5 @@ class BaseModel(gtk.GenericTreeModel):
return None
def on_iter_parent(self, node):
'''returns the parent of this node'''
'''returns the parent of this node'''
return None

View File

@ -81,61 +81,6 @@ class NoteModel(BaseModel):
BaseModel.__init__(self, db, scol, order,
search=search, skip=skip, sort_map=sort_map)
def __unattached_note(self, handle):
""" function that returns true if note is not attached to another
object
"""
if handle :
return len([x for x in self.db.find_backlink_handles(handle)]) == 0
return False
def _rebuild_search(self,ignore=None):
""" function called when view must be build, given a search text
in the top search bar
Remark: this method is overrides BaseModel as only unattached notes
must be shown
"""
self.total = 0
if self.db.is_open():
if self.search and self.search.text:
dlist = [h for h in self.sort_keys()\
if self.search.match(h) and \
h not in self.skip and h != ignore and \
self.__unattached_note(h)]
else:
dlist = [h for h in self.sort_keys() \
if h not in self.skip and h != ignore and \
self.__unattached_note(h)]
self.displayed = len(dlist)
self.node_map.set_path_map(dlist)
else:
self.displayed = 0
self.node_map.clear_map()
def _rebuild_filter(self, ignore=None):
""" function called when view must be build, given filter options
in the filter sidebar
Remark: this method is overrides BaseModel as only unattached notes
must be shown
"""
self.total = 0
if self.db.is_open():
if self.search:
dlist = self.search.apply(self.db,
[ k for k in self.sort_keys()\
if k != ignore and \
self.__unattached_note(k)])
else:
dlist = [ k for k in self.sort_keys() \
if k != ignore and \
self.__unattached_note(k)]
self.displayed = len(dlist)
self.node_map.set_path_map(dlist)
else:
self.displayed = 0
self.node_map.clear_map()
def on_get_n_columns(self):
return len(self.fmap)+1