diff --git a/ChangeLog b/ChangeLog index 81379dc35..8e7762152 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-07-16 Alex Roitman + * src/GrampsDb/_GrampsBSDDB.py (convert_notes_13): Convert text + field into a note on upgrade. + * src/RelLib/_SourceRef.py (__init__): Remove text attribute; + (set_text,get_text): Remove methods. + * src/RelLib/_NoteType.py (SOURCE_TEXT): Add new type. + 2007-07-16 Piotr Czubaszek * src/plugins/rel_pl.py: Update. diff --git a/src/GrampsDb/_GrampsBSDDB.py b/src/GrampsDb/_GrampsBSDDB.py index 122873456..dcb35c1f0 100644 --- a/src/GrampsDb/_GrampsBSDDB.py +++ b/src/GrampsDb/_GrampsBSDDB.py @@ -1878,7 +1878,7 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback): def gramps_upgrade_13(self): """ - First upgrade in 2.3/2.4 branch. + First upgrade in 2.3/3.0 branch. We assume that the data is at least from 2.2.x. """ print "Upgrading to DB version 13..." @@ -2071,7 +2071,15 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback): (note_list, note_handles) = self.convert_notes_13('Note', note, nttype=NoteType.SOURCEREF, private=priv) - new_obj = (date, priv, note_list, conf, ref, page, text) + # Also we lose the text field and make it a note + handle = str(self.create_id()) + gramps_id = self.find_next_note_gramps_id() + note_tuple = (handle, gramps_id, text, Note.FLOWED, + (NoteType.SOURCE_TEXT, '', ), self.change_13, + (-1, '', ), priv) + self.commit_13(note_tuple, NOTE_KEY, self.note_map, []) + note_list += handle + new_obj = (date, priv, note_list, conf, ref, page) elif name == 'Attribute': (priv, source_list, note, the_type, value) = obj (note_list, note_handles) = self.convert_notes_13('Note', note, diff --git a/src/RelLib/_NoteType.py b/src/RelLib/_NoteType.py index a492bdddd..1ddbdce79 100644 --- a/src/RelLib/_NoteType.py +++ b/src/RelLib/_NoteType.py @@ -66,6 +66,7 @@ class NoteType(GrampsType): CHILDREF = 19 PERSONNAME = 20 # other common types + SOURCE_TEXT = 21 # this is used for verbatim source text in SourceRef _CUSTOM = CUSTOM @@ -78,6 +79,7 @@ class NoteType(GrampsType): (GENERAL, _("General"), "General"), (RESEARCH, _("Research"), "Research"), (TRANSCRIPT, _("Transcript"), "Transcript"), + (SOURCE_TEXT, _("Source text"), "Source text"), ] _DATAMAPIGNORE = [ @@ -132,4 +134,3 @@ class NoteType(GrampsType): except ValueError: pass return ignlist - \ No newline at end of file diff --git a/src/RelLib/_SourceRef.py b/src/RelLib/_SourceRef.py index 5ebb44b96..b717e2cbb 100644 --- a/src/RelLib/_SourceRef.py +++ b/src/RelLib/_SourceRef.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2006 Donald N. Allingham +# Copyright (C) 2000-2007 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -64,11 +64,9 @@ class SourceRef(SecondaryObject, DateBase, PrivacyBase, NoteBase, RefBase): if source: self.confidence = source.confidence self.page = source.page - self.text = source.text else: self.confidence = SourceRef.CONF_NORMAL self.page = "" - self.text = "" def serialize(self): """ @@ -79,14 +77,14 @@ class SourceRef(SecondaryObject, DateBase, PrivacyBase, NoteBase, RefBase): NoteBase.serialize(self), self.confidence, RefBase.serialize(self), - self.page, self.text) + self.page) def unserialize(self, data): """ Converts a serialized tuple of data to an object """ (date, privacy, note, - self.confidence, ref, self.page, self.text) = data + self.confidence, ref, self.page) = data DateBase.unserialize(self, date) PrivacyBase.unserialize(self, privacy) NoteBase.unserialize(self, note) @@ -100,16 +98,7 @@ class SourceRef(SecondaryObject, DateBase, PrivacyBase, NoteBase, RefBase): @return: Returns the list of all textual attributes of the object. @rtype: list """ - return [self.page, self.text] - - def get_text_data_child_list(self): - """ - Returns the list of child objects that may carry textual data. - - @return: Returns the list of child objects that may carry textual data. - @rtype: list - """ - return [self.note] + return [self.page] def get_referenced_handles(self): """ @@ -140,14 +129,6 @@ class SourceRef(SecondaryObject, DateBase, PrivacyBase, NoteBase, RefBase): """gets the page indicator of the SourceRef""" return self.page - def set_text(self, text): - """sets the text related to the SourceRef""" - self.text = text - - def get_text(self): - """returns the text related to the SourceRef""" - return self.text - def are_equal(self, other): """deprecated function - use are_equal instead""" warn( "Use is_equal instead of are_equal", DeprecationWarning, 2)