本文整理匯總了Python中gramps.gen.lib.Family.add_note方法的典型用法代碼示例。如果您正苦於以下問題:Python Family.add_note方法的具體用法?Python Family.add_note怎麽用?Python Family.add_note使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gramps.gen.lib.Family
的用法示例。
在下文中一共展示了Family.add_note方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from gramps.gen.lib import Family [as 別名]
# 或者: from gramps.gen.lib.Family import add_note [as 別名]
#.........這裏部分代碼省略.........
if not birth:
birth = self.create_event(EventType.BIRTH)
birth_ref = EventRef()
birth_ref.set_reference_handle(birth.get_handle())
child.set_birth_ref(birth_ref)
birth.set_place_handle(self.current_child_birthplace_handle)
self.db.commit_event(birth,self.trans)
if self.current_child_source_handle:
child.add_citation(self.current_child_source_handle)
self.db.commit_person(child,self.trans)
else:
break
self.current_mode = None
return None
def read_children_birthplace_line(self,line,fields):
cbp = self.get_or_create_place(self.decode(fields[1]))
if cbp:
self.current_child_birthplace_handle = cbp.get_handle()
return None
def read_children_source_line(self,line,fields):
csrc = self.get_or_create_source(self.decode(fields[1]))
self.current_child_source_handle = csrc.handle
return None
def read_family_comment(self,line,fields):
if not self.current_family:
LOG.warning("Unknown family of child in line %d!" % self.lineno)
return None
n = Note()
n.set(line)
self.db.add_note(n,self.trans)
self.current_family.add_note(n.handle)
self.db.commit_family(self.current_family,self.trans)
return None
def _read_notes_lines(self, note_tag):
note_txt = ""
while True:
line = self.get_next_line()
if line is None:
break
fields = line.split(" ")
if fields[0] == "end" and fields[1] == note_tag:
break
elif fields[0] == "beg":
continue
else:
if note_txt:
note_txt = note_txt + "\n" + line
else:
note_txt = note_txt + line
if note_txt:
n = Note()
n.set(note_txt)
self.db.add_note(n,self.trans)
return n.handle
return None
def read_person_notes_lines(self,line,fields):
(idx,person) = self.parse_person(fields,1,None,None)
note_handle = self._read_notes_lines( fields[0])
if note_handle: