2007-07-16 Alex Roitman <shura@gramps-project.org>

* 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.

svn: r8721
This commit is contained in:
Alex Roitman 2007-07-17 01:59:25 +00:00
parent 220dd4ed43
commit 2a41dbfd03
4 changed files with 23 additions and 26 deletions

View File

@ -1,3 +1,10 @@
2007-07-16 Alex Roitman <shura@gramps-project.org>
* 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 <pioterus@gmail.com>
* src/plugins/rel_pl.py: Update.

View File

@ -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,

View File

@ -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

View File

@ -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)