本文整理汇总了Python中gramps.gen.lib.Place.set_title方法的典型用法代码示例。如果您正苦于以下问题:Python Place.set_title方法的具体用法?Python Place.set_title怎么用?Python Place.set_title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gramps.gen.lib.Place
的用法示例。
在下文中一共展示了Place.set_title方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_or_create_place
# 需要导入模块: from gramps.gen.lib import Place [as 别名]
# 或者: from gramps.gen.lib.Place import set_title [as 别名]
def get_or_create_place(self,place_name):
place = None
if place_name in self.pkeys:
place = self.db.get_place_from_handle(self.pkeys[place_name])
else:
place = Place()
place.set_title(place_name)
self.db.add_place(place,self.trans)
self.db.commit_place(place,self.trans)
self.pkeys[place_name] = place.get_handle()
return place
示例2: get_or_create_place
# 需要导入模块: from gramps.gen.lib import Place [as 别名]
# 或者: from gramps.gen.lib.Place import set_title [as 别名]
def get_or_create_place(self, place_name):
"Return the requested place object tuple-packed with a new indicator."
LOG.debug("get_or_create_place: looking for: %s", place_name)
for place_handle in self.db.iter_place_handles():
place = self.db.get_place_from_handle(place_handle)
place_title = place_displayer.display(self.db, place)
if place_title == place_name:
return (0, place)
place = Place()
place.set_title(place_name)
self.db.add_place(place, self.trans)
return (1, place)
示例3: add_place_from_kml
# 需要导入模块: from gramps.gen.lib import Place [as 别名]
# 或者: from gramps.gen.lib.Place import set_title [as 别名]
def add_place_from_kml(self, menu, event, lat, lon):
"""
Add new place(s) from a kml file
1 - ask for a kml file ?
2 - Read the kml file.
3 - create the place(s) with name and title found in the kml marker.
"""
# Ask for the kml file
filtering = Gtk.FileFilter()
filtering.add_pattern("*.kml")
kml = Gtk.FileChooserDialog(
_("Select a kml file used to add places"),
action=Gtk.FileChooserAction.OPEN,
parent=self.uistate.window,
buttons=(_('_Cancel'), Gtk.ResponseType.CANCEL,
_('_Apply'), Gtk.ResponseType.OK))
mpath = HOME_DIR
kml.set_current_folder(os.path.dirname(mpath))
kml.set_filter(filtering)
status = kml.run()
if status == Gtk.ResponseType.OK:
val = kml.get_filename()
if val:
kmlfile = Kml(val)
points = kmlfile.add_points()
for place in points:
(name, coords) = place
latlong = coords.pop()
(lat, lon) = latlong
place_name = PlaceName()
place_name.set_value(name)
new_place = Place()
new_place.set_name(place_name)
new_place.set_title(name)
new_place.set_latitude(str(lat))
new_place.set_longitude(str(lon))
try:
EditPlace(self.dbstate, self.uistate, [], new_place)
except WindowActiveError:
pass
kml.destroy()