本文整理汇总了Python中gramps.gen.lib.Place.add_placeref方法的典型用法代码示例。如果您正苦于以下问题:Python Place.add_placeref方法的具体用法?Python Place.add_placeref怎么用?Python Place.add_placeref使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gramps.gen.lib.Place
的用法示例。
在下文中一共展示了Place.add_placeref方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __add_place
# 需要导入模块: from gramps.gen.lib import Place [as 别名]
# 或者: from gramps.gen.lib.Place import add_placeref [as 别名]
def __add_place(self, parent, plat, plon):
"""
Add a new place using longitude and latitude of location centered
on the map
"""
self.select_fct.close()
new_place = Place()
new_place.set_latitude(str(plat))
new_place.set_longitude(str(plon))
if parent:
if isinstance(parent, Place):
placeref = PlaceRef()
placeref.ref = parent
new_place.add_placeref(placeref)
else:
found = None
for place in self.dbstate.db.iter_places():
found = place
if place.name.get_value() == parent:
break
placeref = PlaceRef()
placeref.ref = found.get_handle()
new_place.add_placeref(placeref)
try:
EditPlace(self.dbstate, self.uistate, [], new_place)
self.add_marker(None, None, plat, plon, None, True, 0)
except WindowActiveError:
pass
示例2: __add_place
# 需要导入模块: from gramps.gen.lib import Place [as 别名]
# 或者: from gramps.gen.lib.Place import add_placeref [as 别名]
def __add_place(self, parent, plat, plon):
"""
Add a new place using longitude and latitude of location centered
on the map
"""
self.select_fct.close()
new_place = Place()
new_place.set_latitude(str(plat))
new_place.set_longitude(str(plon))
if parent:
placeref = PlaceRef()
placeref.ref = parent
new_place.add_placeref(placeref)
try:
EditPlace(self.dbstate, self.uistate, [], new_place)
self.add_marker(None, None, plat, plon, None, True, 0)
except WindowActiveError:
pass
示例3: __add_place
# 需要导入模块: from gramps.gen.lib import Place [as 别名]
# 或者: from gramps.gen.lib.Place import add_placeref [as 别名]
def __add_place(self, parent, plat, plon):
"""
Add a new place using longitude and latitude of location centered
on the map
"""
self.select_fct.close()
new_place = Place()
new_place.set_latitude(str(plat))
new_place.set_longitude(str(plon))
if parent:
if isinstance(parent, Place):
placeref = PlaceRef()
placeref.ref = parent
new_place.add_placeref(placeref)
elif isinstance(parent, gi.overrides.Gtk.TreeModelRow):
# We are here because we selected a place from geocoding
# parent[0] : country
# parent[1] : state
# parent[2] : town
# parent[3] : name
value = PlaceSelection.untag_text(parent[2], 1)
plname = PlaceName()
plname.set_value(value)
handle = self.place_exists(value)
if handle:
# The town already exists. We create a place with name
placeref = PlaceRef()
placeref.ref = handle
new_place.add_placeref(placeref)
value = PlaceSelection.untag_text(parent[3], 1)
plname.set_value(value)
new_place.set_name(plname)
else:
found = None
for place in self.dbstate.db.iter_places():
found = place
if place.name.get_value() == parent:
break
placeref = PlaceRef()
placeref.ref = found.get_handle()
new_place.add_placeref(placeref)
try:
EditPlace(self.dbstate, self.uistate, [], new_place)
self.add_marker(None, None, plat, plon, None, True, 0)
except WindowActiveError:
pass