Changing the way of how formatted Notes are stored:

remove 'Markup' optional parameter from gen.lib.note.Note.get() method.


svn: r10288
This commit is contained in:
Zsolt Foldvari 2008-03-13 10:44:22 +00:00
parent 50ab0b0651
commit 2642641b84
7 changed files with 7 additions and 46 deletions

View File

@ -25,7 +25,6 @@
#
#-------------------------------------------------------------------------
import logging
import re
log = logging.getLogger(".")
#-------------------------------------------------------------------------

View File

@ -387,7 +387,7 @@ class EditNote(EditPrimary):
if self.obj:
self.empty = False
self.flow_changed(self.obj.get_format())
buffer_.set_text(self.obj.get(markup=True))
buffer_.set_text(self.obj.get())
else:
self.empty = True

View File

@ -400,7 +400,7 @@ class GrampsDbXmlWriter(UpdateCallback):
ntype = escxml(note.get_type().xml_str())
format = note.get_format()
text = note.get(markup=True)
text = note.get()
self.g.write(' type="%s"' % ntype)
if format != note.FLOWED:

View File

@ -1064,7 +1064,7 @@ class NoteEntry(ObjEntry):
return self.db.get_note_from_handle(handle)
def get_label(self, note):
txt = " ".join(note.get(markup=False).split())
txt = " ".join(note.get().split())
if len(txt) > 35:
txt = txt[:35]+"..."
else:

View File

@ -915,8 +915,8 @@ class MergePeople:
print "Deleted empty family %s" % family_handle
def merge_notes(self, note1, note2):
t1 = note1.get(markup=True)
t2 = note2.get(markup=True)
t1 = note1.get()
t2 = note2.get()
if not t2:
return note1
elif not t1:

View File

@ -659,7 +659,7 @@ class GuiNoteOption(gtk.HBox):
"""
if note:
note_id = note.get_gramps_id()
txt = " ".join(note.get(markup=False).split())
txt = " ".join(note.get().split())
if len(txt) > 35:
txt = txt[:35]+"..."
else:

View File

@ -29,7 +29,6 @@ Note class for GRAMPS.
# standard python modules
#
#-------------------------------------------------------------------------
import re
from types import InstanceType
#-------------------------------------------------------------------------
@ -41,8 +40,6 @@ from gen.lib.primaryobj import BasicPrimaryObject
from gen.lib.notetype import NoteType
from gen.lib.markertype import MarkerType
#ROOT_START_TAG = '<gramps>'
#-------------------------------------------------------------------------
#
# Class for notes used throughout the majority of GRAMPS objects
@ -107,39 +104,15 @@ class Note(BasicPrimaryObject):
"""
self.text = text
def get(self, markup=False):
def get(self):
"""
Return the text string associated with the note.
@param markup: If note should be returned with markup or plain text
@type markup: boolean
@returns: Returns the text string defining the note contents.
@rtype: str
"""
text = self.text
#
# if not markup and text.startswith(ROOT_START_TAG):
# text = self.delete_tags(text)
return text
#
# def delete_tags(self, markup_text):
# """
# Create a plain text version of the note text by removing all pango
# markup tags.
#
# @param markup_text: Pango style markup text
# @type markup_text: str
# @return: Plain text
# @rtype: str
# """
# text = re.sub(r'(<.*?>)', '', markup_text)
#
# text = text.replace('&amp;', '&')
# text = text.replace('&lt;', '<')
# text = text.replace('&gt;', '>')
#
# return text
def append(self, text):
"""
@ -188,14 +161,3 @@ class Note(BasicPrimaryObject):
@rtype: str
"""
return self.type
if __name__ == "__main__":
import hotshot
prof = hotshot.Profile("note.profile")
f = open("notetest3_10.txt")
note = Note(f.read())
for i in range(100000):
prof.runcall(note.get)
prof.close()