本文整理汇总了Python中gramps.gen.lib.Citation.set_page方法的典型用法代码示例。如果您正苦于以下问题:Python Citation.set_page方法的具体用法?Python Citation.set_page怎么用?Python Citation.set_page使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gramps.gen.lib.Citation
的用法示例。
在下文中一共展示了Citation.set_page方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_res_ok_clicked
# 需要导入模块: from gramps.gen.lib import Citation [as 别名]
# 或者: from gramps.gen.lib.Citation import set_page [as 别名]
def on_res_ok_clicked(self, dummy):
""" Accept changes displayed and commit to place.
Also find or create a new enclosing place from parent. """
# do the names
namelist = []
for row in self.alt_store:
if row[0] == 'P':
self.place.name = self.newplace.names[row[4]]
elif row[0] == '\u2714':
namelist.append(self.newplace.names[row[4]])
self.place.alt_names = namelist
# Lat/lon/ID/code/type
self.place.lat = self.top.get_object('latitude').get_text()
self.place.long = self.top.get_object('longitude').get_text()
self.place.gramps_id = self.top.get_object('grampsid').get_text()
self.place.code = self.top.get_object('postal').get_text()
self.place.place_type.set(self.type_combo.get_values())
# Add in URLs if wanted
if self.keepweb:
for url in self.newplace.links:
self.place.add_url(url)
# Enclose in the next level place
next_place = False
parent = None
if not self.keep_enclosure or not self.place.placeref_list:
if self.newplace.parent_ids:
# we might have a parent with geo id 'GEO12345'
parent = self.dbstate.db.get_place_from_gramps_id(
self.newplace.parent_ids[0])
if not parent and self.newplace.parent_names:
# make one, will have to be examined/cleaned later
parent = Place()
parent.title = ', '.join(self.newplace.parent_names)
name = PlaceName()
name.value = parent.title
parent.name = name
parent.gramps_id = self.newplace.parent_ids[0]
with DbTxn(_("Add Place (%s)") % parent.title,
self.dbstate.db) as trans:
self.dbstate.db.add_place(parent, trans)
next_place = True
if parent:
if located_in(self.dbstate.db, parent.handle,
self.place.handle):
# attempting to create a place loop, not good!
ErrorDialog(_('Place cycle detected'),
msg2=_("The place you chose is enclosed in the"
" place you are workin on!\n"
"Please cancel and choose another "
"place."),
parent=self.uistate.window)
return
# check to see if we already have the enclosing place
already_there = False
for pref in self.place.placeref_list:
if parent.handle == pref.ref:
already_there = True
break
if not already_there:
placeref = PlaceRef()
placeref.set_reference_handle(parent.handle)
self.place.set_placeref_list([placeref])
# Add in Citation/Source if wanted
if self.addcitation and self.newplace.geoid:
src_hndl = self.find_or_make_source()
cit = Citation()
cit.set_reference_handle(src_hndl)
cit.set_page("GeoNames ID: %s" %
self.newplace.geoid.replace('GEO', ''))
with DbTxn(_("Add Citation (%s)") % "GeoNames",
self.dbstate.db) as trans:
self.dbstate.db.add_citation(cit, trans)
self.place.add_citation(cit.handle)
# We're finally ready to commit the updated place
with DbTxn(_("Edit Place (%s)") % self.place.title,
self.dbstate.db) as trans:
self.dbstate.db.commit_place(self.place, trans)
# Jump to enclosing place to clean it if necessary
if next_place:
self.set_active('Place', parent.handle)
self.place = parent
# if geoparse fails, leave us at main view
if self.newplace.parent_ids and \
self.geoparse(self.newplace.parent_ids[0],
_(", ").join(self.newplace.parent_names),
self.newplace.parent_ids,
self.newplace.parent_names):
# geoparse worked, lets put up the results view
self.gui.get_child().remove(self.mainwin)
self.gui.get_child().add(self.results_win)
self.res_gui()
return
self.reset_main()
if self.gui.get_child().get_child() == self.results_win:
self.gui.get_child().remove(self.results_win)
self.gui.get_child().add(self.mainwin)