From 62f515e1d4bb0e150a72a9f0b31171c9a5b55105 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Mon, 21 Aug 2006 06:32:31 +0000 Subject: [PATCH] * src/DataViews/_PersonView.py (column_names): Remove cause of death. * src/DisplayModels/_PeopleModel.py (__init__): Update the order of marker and tooltip columns; (column_cause_of_death): remove method; (COLUMN_DEFS): Remove 'cause of death' column. * src/GrampsDb/_GrampsBSDDB.py (gramps_upgrade_10): Reset event and person view columns to the default. * src/GrampsDb/_GrampsDbBase.py (get_event_column_order): Remove cause column from the default list. (get_person_column_order): Remove cause of death column. svn: r7224 --- gramps2/ChangeLog | 11 +++++++++++ gramps2/src/DataViews/_PersonView.py | 1 - gramps2/src/DisplayModels/_PeopleModel.py | 18 ++---------------- gramps2/src/GrampsDb/_GrampsBSDDB.py | 18 ++++++++++++++++++ gramps2/src/GrampsDb/_GrampsDbBase.py | 4 ++-- 5 files changed, 33 insertions(+), 19 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 2db8c5bf9..ddaf93f38 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,15 @@ 2006-08-20 Alex Roitman + * src/DataViews/_PersonView.py (column_names): Remove cause of death. + * src/DisplayModels/_PeopleModel.py (__init__): Update the order + of marker and tooltip columns; + (column_cause_of_death): remove method; + (COLUMN_DEFS): Remove 'cause of death' column. + * src/GrampsDb/_GrampsBSDDB.py (gramps_upgrade_10): Reset event + and person view columns to the default. + * src/GrampsDb/_GrampsDbBase.py (get_event_column_order): Remove + cause column from the default list. + (get_person_column_order): Remove cause of death column. + * src/GrampsDb/_ReadGedcom.py (GedcomParser.__init__): Use config setting to determine whether to set default source. * src/Config/_GrampsConfigKeys.py: Regenerate file. diff --git a/gramps2/src/DataViews/_PersonView.py b/gramps2/src/DataViews/_PersonView.py index 747b2964e..21fc47324 100644 --- a/gramps2/src/DataViews/_PersonView.py +++ b/gramps2/src/DataViews/_PersonView.py @@ -74,7 +74,6 @@ column_names = [ _('Death Place'), _('Spouse'), _('Last Change'), - _('Cause of Death'), ] diff --git a/gramps2/src/DisplayModels/_PeopleModel.py b/gramps2/src/DisplayModels/_PeopleModel.py index b95a9ff45..6f4c12e22 100644 --- a/gramps2/src/DisplayModels/_PeopleModel.py +++ b/gramps2/src/DisplayModels/_PeopleModel.py @@ -150,8 +150,8 @@ class PeopleModel(gtk.GenericTreeModel): self.custom_color = Config.get(Config.CUSTOM_MARKER_COLOR) self.sortnames = {} - self.marker_color_column = 11 - self.tooltip_column = 12 + self.marker_color_column = 10 + self.tooltip_column = 11 self.prev_handle = None self.prev_data = None self.temp_top_path2iter = [] @@ -479,19 +479,6 @@ class PeopleModel(gtk.GenericTreeModel): return u"" - def column_cause_of_death(self, data, node): - index = data[PeopleModel._DEATH_COL] - if index != -1: - try: - local = data[PeopleModel._EVENT_COL][index] - dr = EventRef() - dr.unserialize(local) - return self.db.get_event_from_handle(dr.ref).get_cause() - except: - return u'' - else: - return u"" - def column_birth_place(self, data, node): index = data[PeopleModel._BIRTH_COL] if index != -1: @@ -611,7 +598,6 @@ class PeopleModel(gtk.GenericTreeModel): (column_death_place, None, str), (column_spouse, None, str), (column_change, None, str), - (column_cause_of_death, None, str), (column_marker_text, None, str), (column_marker_color, None, str), # the order of the above columns must match PeopleView.column_names diff --git a/gramps2/src/GrampsDb/_GrampsBSDDB.py b/gramps2/src/GrampsDb/_GrampsBSDDB.py index 69e392109..43dd9587d 100644 --- a/gramps2/src/GrampsDb/_GrampsBSDDB.py +++ b/gramps2/src/GrampsDb/_GrampsBSDDB.py @@ -1878,6 +1878,24 @@ class GrampsBSDDB(GrampsDbBase,UpdateCallback): def gramps_upgrade_10(self): print "Upgrading to DB version 10 -- this may take a while" + # Remove event column metadata, since columns have changed. + # This will reset all columns to defaults in event view + for name in (PERSON_COL_KEY,EVENT_COL_KEY): + try: + if self.UseTXN: + # Start transaction if needed + the_txn = self.env.txn_begin() + else: + the_txn = None + self.metadata.delete(name,txn=the_txn) + if self.UseTXN: + the_txn.commit() + else: + self.metadata.sync() + except KeyError: + if self.UseTXN: + the_txn.abort() + # Create one secondary index for reference_map # because every commit will require this to exist table_flags = self.open_flags() diff --git a/gramps2/src/GrampsDb/_GrampsDbBase.py b/gramps2/src/GrampsDb/_GrampsDbBase.py index 9c7bf2e4a..3da5fadda 100644 --- a/gramps2/src/GrampsDb/_GrampsDbBase.py +++ b/gramps2/src/GrampsDb/_GrampsDbBase.py @@ -1925,7 +1925,7 @@ class GrampsDbBase(GrampsDBCallback): """ default = [(1, 1, 100), (1, 2, 100), (1, 3, 150), (0, 4, 150), (1, 5, 150), (0, 6, 150), (0, 7, 100), (0, 8, 100), - (0, 9, 100)] + ] return self._get_column_order(PERSON_COL_KEY, default) def _get_columns(self, key, default): @@ -1993,7 +1993,7 @@ class GrampsDbBase(GrampsDBCallback): database's metadata. """ default = [(1, 0, 200), (1, 1, 75), (1, 2, 100), (1, 3, 150), - (1, 4, 200), (1, 5, 100), (0, 6, 100)] + (1, 4, 200), (0, 5, 100)] return self._get_columns(EVENT_COL_KEY, default) def get_repository_column_order(self):