2006-08-01 Don Allingham <don@gramps-project.org>

* src/DataViews/_PersonView.py: use grouping name
	* src/NameDisplay.py: Add grouping from data instead of just Name
	instance, handle Name.DEF
	* src/DisplayModels/_PeopleModel.py: use grouping name



svn: r7110
This commit is contained in:
Don Allingham 2006-08-01 23:50:47 +00:00
parent c6032a659f
commit e59d065ada
4 changed files with 32 additions and 10 deletions

View File

@ -1,3 +1,9 @@
2006-08-01 Don Allingham <don@gramps-project.org>
* src/DataViews/_PersonView.py: use grouping name
* src/NameDisplay.py: Add grouping from data instead of just Name
instance, handle Name.DEF
* src/DisplayModels/_PeopleModel.py: use grouping name
2006-08-01 Alex Roitman <shura@gramps-project.org> 2006-08-01 Alex Roitman <shura@gramps-project.org>
* src/NameDisplay.py: Rename local var id -> num * src/NameDisplay.py: Rename local var id -> num
to avoid collission with the builtin function id(). to avoid collission with the builtin function id().

View File

@ -404,6 +404,7 @@ class PersonView(PageView.PersonNavView):
try: try:
if self.model and p: if self.model and p:
path = self.model.on_get_path(p.get_handle()) path = self.model.on_get_path(p.get_handle())
group_name = p.get_primary_name().get_group_name() group_name = p.get_primary_name().get_group_name()
top_name = self.dbstate.db.get_name_group_mapping(group_name) top_name = self.dbstate.db.get_name_group_mapping(group_name)
top_path = self.model.on_get_path(top_name) top_path = self.model.on_get_path(top_name)
@ -651,7 +652,9 @@ class PersonView(PageView.PersonNavView):
return return
for node in handle_list: for node in handle_list:
person = self.dbstate.db.get_person_from_handle(node) person = self.dbstate.db.get_person_from_handle(node)
top = person.get_primary_name().get_group_name() pn = person.get_primary_name()
top = NameDisplay.displayer.name_grouping_name(self.db, pn)
self.model.rebuild_data() self.model.rebuild_data()
if not self.model.is_visable(node): if not self.model.is_visable(node):
continue continue

View File

@ -196,7 +196,7 @@ class PeopleModel(gtk.GenericTreeModel):
def _build_search_sub(self,dfilter, skip): def _build_search_sub(self,dfilter, skip):
self.sortnames = {} self.sortnames = {}
ngn = NameDisplay.displayer.name_grouping_name ngn = NameDisplay.displayer.name_grouping_data
nsn = NameDisplay.displayer.raw_sorted_name nsn = NameDisplay.displayer.raw_sorted_name
cursor = self.db.get_person_cursor() cursor = self.db.get_person_cursor()
@ -206,18 +206,19 @@ class PeopleModel(gtk.GenericTreeModel):
handle, d = node handle, d = node
if not (handle in skip or (dfilter and not dfilter.match(handle))): if not (handle in skip or (dfilter and not dfilter.match(handle))):
name_data = d[PeopleModel._NAME_COL] name_data = d[PeopleModel._NAME_COL]
self.sortnames[handle] = nsn(name_data) sn = ngn(self.db, name_data)
self.sortnames[handle] = sn
try: try:
self.temp_sname_sub[name_data[5]].append(handle) self.temp_sname_sub[sn].append(handle)
except: except:
self.temp_sname_sub[name_data[5]] = [handle] self.temp_sname_sub[sn] = [handle]
node = cursor.next() node = cursor.next()
cursor.close() cursor.close()
def _build_filter_sub(self,dfilter, skip): def _build_filter_sub(self,dfilter, skip):
self.sortnames = {} self.sortnames = {}
ngn = NameDisplay.displayer.name_grouping_name ngn = NameDisplay.displayer.name_grouping_data
nsn = NameDisplay.displayer.raw_sorted_name nsn = NameDisplay.displayer.raw_sorted_name
if dfilter: if dfilter:
@ -229,11 +230,12 @@ class PeopleModel(gtk.GenericTreeModel):
d = self.db.get_raw_person_data(handle) d = self.db.get_raw_person_data(handle)
if not (handle in skip or (dfilter and not dfilter.match(handle))): if not (handle in skip or (dfilter and not dfilter.match(handle))):
name_data = d[PeopleModel._NAME_COL] name_data = d[PeopleModel._NAME_COL]
self.sortnames[handle] = nsn(name_data) sn = ngn(self.db, name_data)
self.sortnames[handle] = sn
try: try:
self.temp_sname_sub[name_data[5]].append(handle) self.temp_sname_sub[sn].append(handle)
except: except:
self.temp_sname_sub[name_data[5]] = [handle] self.temp_sname_sub[sn] = [handle]
def calculate_data(self, dfilter=None, skip=[]): def calculate_data(self, dfilter=None, skip=[]):
""" """

View File

@ -359,11 +359,22 @@ class NameDisplay:
if pn.group_as: if pn.group_as:
return pn.group_as return pn.group_as
sv = pn.sort_as sv = pn.sort_as
if sv == Name.LNFN: if sv == Name.LNFN or sv == Name.DEF:
return db.get_name_group_mapping(pn.surname) return db.get_name_group_mapping(pn.surname)
elif sv == Name.PTFN: elif sv == Name.PTFN:
return db.get_name_group_mapping(pn.patronymic) return db.get_name_group_mapping(pn.patronymic)
else: else:
return db.get_name_group_mapping(pn.first_name) return db.get_name_group_mapping(pn.first_name)
def name_grouping_data(self, db, pn):
if pn[12]:
return pn[12]
sv = pn[13]
if sv == Name.LNFN or sv == Name.DEF:
return db.get_name_group_mapping(pn[5])
elif sv == Name.PTFN:
return db.get_name_group_mapping(pn[10])
else:
return db.get_name_group_mapping(pn[4])
displayer = NameDisplay() displayer = NameDisplay()