diff --git a/ChangeLog b/ChangeLog index 0237120e2..f1d79fb42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-08-01 Don Allingham + * 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 * src/NameDisplay.py: Rename local var id -> num to avoid collission with the builtin function id(). diff --git a/src/DataViews/_PersonView.py b/src/DataViews/_PersonView.py index 3cd6bedae..31e1af417 100644 --- a/src/DataViews/_PersonView.py +++ b/src/DataViews/_PersonView.py @@ -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 diff --git a/src/DisplayModels/_PeopleModel.py b/src/DisplayModels/_PeopleModel.py index 9fc10222c..5877b01d8 100644 --- a/src/DisplayModels/_PeopleModel.py +++ b/src/DisplayModels/_PeopleModel.py @@ -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=[]): """ diff --git a/src/NameDisplay.py b/src/NameDisplay.py index 6c04d84d8..a0d2f89ba 100644 --- a/src/NameDisplay.py +++ b/src/NameDisplay.py @@ -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()