本文整理汇总了Python中gramps.gen.simple.SimpleAccess.all_tags方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleAccess.all_tags方法的具体用法?Python SimpleAccess.all_tags怎么用?Python SimpleAccess.all_tags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gramps.gen.simple.SimpleAccess
的用法示例。
在下文中一共展示了SimpleAccess.all_tags方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DBI
# 需要导入模块: from gramps.gen.simple import SimpleAccess [as 别名]
# 或者: from gramps.gen.simple.SimpleAccess import all_tags [as 别名]
#.........这里部分代码省略.........
self.sdoc.paragraph("\n")
self.sdoc.paragraph("%d rows processed in %s seconds.\n" % (self.select, time.time() - start_time))
self.stab.write(self.sdoc)
self.sdoc.paragraph("")
return _("%d rows processed in %s seconds.\n") % (self.select, time.time() - start_time)
def get_columns(self, table):
"""
Get the columns for the given table.
"""
if self.database:
retval = self.data[table.lower()]
return retval # [self.name] + retval
else:
return ["*"]
def process_table(self, table):
"""
Given a table name, process the query on the elements of the
table.
"""
# 'Person', 'Family', 'Source', 'Citation', 'Event', 'Media',
# 'Place', 'Repository', 'Note', 'Tag'
# table: a class that has .row(1, 2, 3, ...)
if self.table == "person":
self.do_query(self.sdb.all_people(), table)
elif self.table == "family":
self.do_query(self.sdb.all_families(), table)
elif self.table == "event":
self.do_query(self.sdb.all_events(), table)
elif self.table == "source":
self.do_query(self.sdb.all_sources(), table)
elif self.table == "tag":
self.do_query(self.sdb.all_tags(), table)
elif self.table == "citation":
self.do_query(self.sdb.all_citations(), table)
elif self.table == "media":
self.do_query(self.sdb.all_media(), table)
elif self.table == "place":
self.do_query(self.sdb.all_places(), table)
elif self.table == "repository":
self.do_query(self.sdb.all_repositories(), table)
elif self.table == "note":
self.do_query(self.sdb.all_notes(), table)
else:
raise AttributeError("no such table: '%s'" % self.table)
def get_tag(self, name):
tag = self.database.get_tag_from_name(name)
if tag is None:
tag = gramps.gen.lib.Tag()
tag.set_name(name)
trans_class = self.database.get_transaction_class()
with trans_class("QueryQuickview new Tag", self.database, batch=False) as trans:
self.database.add_tag(tag, trans)
return Handle("Tag", tag.handle)
def make_env(self, **kwargs):
"""
An environment with which to eval elements.
"""
retval= Environment({
_("Date"): gramps.gen.lib.date.Date,
_("Today"): gramps.gen.lib.date.Today(),
"random": random,
"re": re,