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:
parent
ffe0bdf5cc
commit
b301aa401f
@ -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>
|
||||
* src/NameDisplay.py: Rename local var id -> num
|
||||
to avoid collission with the builtin function id().
|
||||
|
@ -404,6 +404,7 @@ class PersonView(PageView.PersonNavView):
|
||||
try:
|
||||
if self.model and p:
|
||||
path = self.model.on_get_path(p.get_handle())
|
||||
|
||||
group_name = p.get_primary_name().get_group_name()
|
||||
top_name = self.dbstate.db.get_name_group_mapping(group_name)
|
||||
top_path = self.model.on_get_path(top_name)
|
||||
@ -651,7 +652,9 @@ class PersonView(PageView.PersonNavView):
|
||||
return
|
||||
for node in handle_list:
|
||||
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()
|
||||
if not self.model.is_visable(node):
|
||||
continue
|
||||
|
@ -196,7 +196,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
def _build_search_sub(self,dfilter, skip):
|
||||
self.sortnames = {}
|
||||
|
||||
ngn = NameDisplay.displayer.name_grouping_name
|
||||
ngn = NameDisplay.displayer.name_grouping_data
|
||||
nsn = NameDisplay.displayer.raw_sorted_name
|
||||
|
||||
cursor = self.db.get_person_cursor()
|
||||
@ -206,18 +206,19 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
handle, d = node
|
||||
if not (handle in skip or (dfilter and not dfilter.match(handle))):
|
||||
name_data = d[PeopleModel._NAME_COL]
|
||||
self.sortnames[handle] = nsn(name_data)
|
||||
sn = ngn(self.db, name_data)
|
||||
self.sortnames[handle] = sn
|
||||
try:
|
||||
self.temp_sname_sub[name_data[5]].append(handle)
|
||||
self.temp_sname_sub[sn].append(handle)
|
||||
except:
|
||||
self.temp_sname_sub[name_data[5]] = [handle]
|
||||
self.temp_sname_sub[sn] = [handle]
|
||||
node = cursor.next()
|
||||
cursor.close()
|
||||
|
||||
def _build_filter_sub(self,dfilter, skip):
|
||||
self.sortnames = {}
|
||||
|
||||
ngn = NameDisplay.displayer.name_grouping_name
|
||||
ngn = NameDisplay.displayer.name_grouping_data
|
||||
nsn = NameDisplay.displayer.raw_sorted_name
|
||||
|
||||
if dfilter:
|
||||
@ -229,11 +230,12 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
d = self.db.get_raw_person_data(handle)
|
||||
if not (handle in skip or (dfilter and not dfilter.match(handle))):
|
||||
name_data = d[PeopleModel._NAME_COL]
|
||||
self.sortnames[handle] = nsn(name_data)
|
||||
sn = ngn(self.db, name_data)
|
||||
self.sortnames[handle] = sn
|
||||
try:
|
||||
self.temp_sname_sub[name_data[5]].append(handle)
|
||||
self.temp_sname_sub[sn].append(handle)
|
||||
except:
|
||||
self.temp_sname_sub[name_data[5]] = [handle]
|
||||
self.temp_sname_sub[sn] = [handle]
|
||||
|
||||
def calculate_data(self, dfilter=None, skip=[]):
|
||||
"""
|
||||
|
@ -359,11 +359,22 @@ class NameDisplay:
|
||||
if pn.group_as:
|
||||
return pn.group_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)
|
||||
elif sv == Name.PTFN:
|
||||
return db.get_name_group_mapping(pn.patronymic)
|
||||
else:
|
||||
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()
|
||||
|
Loading…
Reference in New Issue
Block a user