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:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user