2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2005-01-11 09:47:53 +05:30
|
|
|
# Copyright (C) 2000-2005 Donald N. Allingham
|
2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
|
2003-11-13 00:15:07 +05:30
|
|
|
# $Id$
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# python modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import pickle
|
2005-01-11 09:47:53 +05:30
|
|
|
from gettext import gettext as _
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GTK/Gnome modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import gobject
|
|
|
|
import gtk
|
|
|
|
import gtk.glade
|
2003-11-19 23:30:58 +05:30
|
|
|
import gnome
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gramps modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import const
|
|
|
|
import Utils
|
|
|
|
import Sources
|
|
|
|
import ImageSelect
|
2005-01-01 09:57:15 +05:30
|
|
|
import NameDisplay
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Constants
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
pycode_tgts = [('url', 0, 0)]
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# EditPlace
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
class EditPlace:
|
|
|
|
|
2003-11-19 23:30:58 +05:30
|
|
|
def __init__(self,parent,place,func=None,parent_window=None):
|
2004-02-26 09:04:19 +05:30
|
|
|
self.parent = parent
|
2004-07-28 07:59:07 +05:30
|
|
|
if place.get_handle():
|
|
|
|
if self.parent.child_windows.has_key(place.get_handle()):
|
|
|
|
self.parent.child_windows[place.get_handle()].present(None)
|
2004-02-26 09:04:19 +05:30
|
|
|
return
|
|
|
|
else:
|
2004-07-28 07:59:07 +05:30
|
|
|
self.win_key = place.get_handle()
|
2004-02-26 09:04:19 +05:30
|
|
|
else:
|
|
|
|
self.win_key = self
|
2005-01-01 09:57:15 +05:30
|
|
|
self.name_display = NameDisplay.displayer.display
|
2002-10-20 19:55:16 +05:30
|
|
|
self.place = place
|
|
|
|
self.db = parent.db
|
2004-02-26 09:04:19 +05:30
|
|
|
self.child_windows = {}
|
2002-10-20 19:55:16 +05:30
|
|
|
self.callback = func
|
2004-02-14 11:10:30 +05:30
|
|
|
self.path = parent.db.get_save_path()
|
2002-10-20 19:55:16 +05:30
|
|
|
self.not_loaded = 1
|
|
|
|
self.ref_not_loaded = 1
|
|
|
|
self.lists_changed = 0
|
|
|
|
if place:
|
2004-02-14 11:10:30 +05:30
|
|
|
self.srcreflist = place.get_source_references()
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
|
|
|
self.srcreflist = []
|
|
|
|
|
2003-08-17 07:44:33 +05:30
|
|
|
self.top_window = gtk.glade.XML(const.placesFile,"placeEditor","gramps")
|
2003-03-06 11:42:51 +05:30
|
|
|
self.top = self.top_window.get_widget("placeEditor")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.iconlist = self.top_window.get_widget('iconlist')
|
2003-03-05 11:31:31 +05:30
|
|
|
title_label = self.top_window.get_widget('title')
|
2003-03-06 11:42:51 +05:30
|
|
|
|
|
|
|
Utils.set_titles(self.top,title_label,_('Place Editor'))
|
2003-03-05 11:31:31 +05:30
|
|
|
|
2004-05-14 04:15:51 +05:30
|
|
|
self.glry = ImageSelect.Gallery(place, self.db.commit_place, self.path,
|
|
|
|
self.iconlist, self.db, self,self.top)
|
2005-02-20 06:32:15 +05:30
|
|
|
|
|
|
|
mode = not self.parent.db.readonly
|
2002-10-20 19:55:16 +05:30
|
|
|
self.title = self.top_window.get_widget("place_title")
|
2005-02-20 06:32:15 +05:30
|
|
|
self.title.set_editable(mode)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.city = self.top_window.get_widget("city")
|
2005-02-20 06:32:15 +05:30
|
|
|
self.city.set_editable(mode)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.parish = self.top_window.get_widget("parish")
|
2005-02-20 06:32:15 +05:30
|
|
|
self.parish.set_editable(mode)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.county = self.top_window.get_widget("county")
|
2005-02-20 06:32:15 +05:30
|
|
|
self.county.set_editable(mode)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.state = self.top_window.get_widget("state")
|
2005-02-20 06:32:15 +05:30
|
|
|
self.state.set_editable(mode)
|
2003-12-09 11:30:51 +05:30
|
|
|
self.phone = self.top_window.get_widget("phone")
|
2005-02-20 06:32:15 +05:30
|
|
|
self.phone.set_editable(mode)
|
2003-12-09 11:30:51 +05:30
|
|
|
self.postal = self.top_window.get_widget("postal")
|
2005-02-20 06:32:15 +05:30
|
|
|
self.postal.set_editable(mode)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.country = self.top_window.get_widget("country")
|
2005-02-20 06:32:15 +05:30
|
|
|
self.country.set_editable(mode)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.longitude = self.top_window.get_widget("longitude")
|
2005-02-20 06:32:15 +05:30
|
|
|
self.longitude.set_editable(mode)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.latitude = self.top_window.get_widget("latitude")
|
2005-02-20 06:32:15 +05:30
|
|
|
self.latitude.set_editable(mode)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.note = self.top_window.get_widget("place_note")
|
2005-02-20 06:32:15 +05:30
|
|
|
self.note.set_editable(mode)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
self.web_list = self.top_window.get_widget("web_list")
|
|
|
|
self.web_url = self.top_window.get_widget("web_url")
|
|
|
|
self.web_go = self.top_window.get_widget("web_go")
|
2003-05-09 09:02:15 +05:30
|
|
|
self.web_edit = self.top_window.get_widget("web_edit")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.web_description = self.top_window.get_widget("url_des")
|
|
|
|
|
2004-08-24 09:18:15 +05:30
|
|
|
self.top_window.get_widget('changed').set_text(place.get_change_display())
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
# event display
|
2005-02-20 06:32:15 +05:30
|
|
|
self.web_model = gtk.ListStore(str,str)
|
|
|
|
self.build_columns(self.web_list, [(_('Path'),150),
|
|
|
|
(_('Description'),150)])
|
2002-10-20 19:55:16 +05:30
|
|
|
self.web_list.set_model(self.web_model)
|
2005-02-20 06:32:15 +05:30
|
|
|
self.web_list.get_selection().connect('changed',
|
|
|
|
self.on_web_list_select_row)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-05-09 09:02:15 +05:30
|
|
|
self.loc_edit = self.top_window.get_widget("loc_edit")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.loc_list = self.top_window.get_widget("loc_list")
|
|
|
|
self.loc_city = self.top_window.get_widget("loc_city")
|
|
|
|
self.loc_county = self.top_window.get_widget("loc_county")
|
|
|
|
self.loc_state = self.top_window.get_widget("loc_state")
|
2003-12-09 11:30:51 +05:30
|
|
|
self.loc_postal = self.top_window.get_widget("loc_postal")
|
|
|
|
self.loc_phone = self.top_window.get_widget("loc_phone")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.loc_parish = self.top_window.get_widget("loc_parish")
|
|
|
|
self.loc_country = self.top_window.get_widget("loc_country")
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
self.ulist = place.get_url_list()[:]
|
2002-10-20 19:55:16 +05:30
|
|
|
self.llist = place.get_alternate_locations()[:]
|
|
|
|
|
2005-02-20 06:32:15 +05:30
|
|
|
self.loc_model = gtk.ListStore(str,str,str,str)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.build_columns(self.loc_list, [(_('City'),150), (_('County'),100),
|
|
|
|
(_('State'),100), (_('Country'),50)])
|
|
|
|
self.loc_list.set_model(self.loc_model)
|
2003-05-09 08:55:51 +05:30
|
|
|
self.loc_sel = self.loc_list.get_selection()
|
|
|
|
self.loc_sel.connect('changed',self.on_loc_list_select_row)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
self.title.set_text(place.get_title())
|
|
|
|
mloc = place.get_main_location()
|
|
|
|
self.city.set_text(mloc.get_city())
|
|
|
|
self.county.set_text(mloc.get_county())
|
|
|
|
self.state.set_text(mloc.get_state())
|
2003-12-09 11:30:51 +05:30
|
|
|
self.phone.set_text(mloc.get_phone())
|
|
|
|
self.postal.set_text(mloc.get_postal_code())
|
2002-10-20 19:55:16 +05:30
|
|
|
self.parish.set_text(mloc.get_parish())
|
|
|
|
self.country.set_text(mloc.get_country())
|
|
|
|
self.longitude.set_text(place.get_longitude())
|
|
|
|
self.latitude.set_text(place.get_latitude())
|
|
|
|
self.refinfo = self.top_window.get_widget("refinfo")
|
|
|
|
self.slist = self.top_window.get_widget("slist")
|
2003-11-13 00:15:07 +05:30
|
|
|
self.sources_label = self.top_window.get_widget("sourcesPlaceEdit")
|
|
|
|
self.names_label = self.top_window.get_widget("namesPlaceEdit")
|
|
|
|
self.notes_label = self.top_window.get_widget("notesPlaceEdit")
|
|
|
|
self.gallery_label = self.top_window.get_widget("galleryPlaceEdit")
|
|
|
|
self.inet_label = self.top_window.get_widget("inetPlaceEdit")
|
|
|
|
self.refs_label = self.top_window.get_widget("refsPlaceEdit")
|
2003-12-16 06:07:47 +05:30
|
|
|
self.flowed = self.top_window.get_widget("place_flowed")
|
|
|
|
self.preform = self.top_window.get_widget("place_preform")
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
self.note_buffer = self.note.get_buffer()
|
2004-02-14 11:10:30 +05:30
|
|
|
if place.get_note():
|
|
|
|
self.note_buffer.set_text(place.get_note())
|
2003-11-13 00:15:07 +05:30
|
|
|
Utils.bold_label(self.notes_label)
|
2004-02-14 11:10:30 +05:30
|
|
|
if place.get_note_format() == 1:
|
2003-12-16 06:07:47 +05:30
|
|
|
self.preform.set_active(1)
|
|
|
|
else:
|
|
|
|
self.flowed.set_active(1)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-02-20 06:32:15 +05:30
|
|
|
self.flowed.set_sensitive(mode)
|
|
|
|
self.preform.set_sensitive(mode)
|
|
|
|
|
2004-02-21 11:41:59 +05:30
|
|
|
if self.place.get_media_list():
|
2003-12-12 11:06:38 +05:30
|
|
|
Utils.bold_label(self.gallery_label)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.top_window.signal_autoconnect({
|
|
|
|
"on_switch_page" : self.on_switch_page,
|
2004-02-23 08:15:36 +05:30
|
|
|
"on_addphoto_clicked" : self.glry.on_add_media_clicked,
|
|
|
|
"on_selectphoto_clicked" : self.glry.on_select_media_clicked,
|
|
|
|
"on_deletephoto_clicked" : self.glry.on_delete_media_clicked,
|
|
|
|
"on_edit_photo_clicked" : self.glry.on_edit_media_clicked,
|
2002-10-20 19:55:16 +05:30
|
|
|
"on_edit_properties_clicked": self.glry.popup_change_description,
|
|
|
|
"on_add_url_clicked" : self.on_add_url_clicked,
|
|
|
|
"on_delete_url_clicked" : self.on_delete_url_clicked,
|
|
|
|
"on_update_url_clicked" : self.on_update_url_clicked,
|
|
|
|
"on_add_loc_clicked" : self.on_add_loc_clicked,
|
|
|
|
"on_delete_loc_clicked" : self.on_delete_loc_clicked,
|
|
|
|
"on_update_loc_clicked" : self.on_update_loc_clicked,
|
|
|
|
"on_web_go_clicked" : self.on_web_go_clicked,
|
2004-02-26 09:04:19 +05:30
|
|
|
"on_help_clicked" : self.on_help_clicked,
|
|
|
|
"on_delete_event" : self.on_delete_event,
|
|
|
|
"on_cancel_clicked" : self.close,
|
|
|
|
"on_apply_clicked" : self.on_place_apply_clicked,
|
2002-10-20 19:55:16 +05:30
|
|
|
})
|
|
|
|
|
2005-02-20 06:32:15 +05:30
|
|
|
self.sourcetab = Sources.SourceTab(
|
|
|
|
self.srcreflist,self,
|
|
|
|
self.top_window,self.top,self.slist,
|
|
|
|
self.top_window.get_widget('add_src'),
|
|
|
|
self.top_window.get_widget('edit_src'),
|
|
|
|
self.top_window.get_widget('del_src'),
|
|
|
|
self.parent.db.readonly)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-02-20 06:32:15 +05:30
|
|
|
if self.place.get_handle() == None or self.parent.db.readonly:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.top_window.get_widget("add_photo").set_sensitive(0)
|
|
|
|
self.top_window.get_widget("delete_photo").set_sensitive(0)
|
|
|
|
|
|
|
|
self.web_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
|
|
|
|
pycode_tgts,gtk.gdk.ACTION_COPY)
|
|
|
|
self.web_list.drag_source_set(gtk.gdk.BUTTON1_MASK,
|
|
|
|
pycode_tgts, gtk.gdk.ACTION_COPY)
|
|
|
|
self.web_list.connect('drag_data_get',
|
|
|
|
self.url_source_drag_data_get)
|
|
|
|
self.web_list.connect('drag_data_received',
|
|
|
|
self.url_dest_drag_data_received)
|
|
|
|
|
2005-02-20 06:32:15 +05:30
|
|
|
for name in ['del_name','add_name','sel_photo','add_url','del_url']:
|
|
|
|
self.top_window.get_widget(name).set_sensitive(mode)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.redraw_url_list()
|
|
|
|
self.redraw_location_list()
|
2003-11-13 00:15:07 +05:30
|
|
|
self.display_references()
|
2003-11-19 23:30:58 +05:30
|
|
|
if parent_window:
|
|
|
|
self.top.set_transient_for(parent_window)
|
2004-02-26 09:04:19 +05:30
|
|
|
self.add_itself_to_menu()
|
2005-02-17 04:19:54 +05:30
|
|
|
self.top_window.get_widget('ok').set_sensitive(not self.db.readonly)
|
2004-02-26 09:04:19 +05:30
|
|
|
self.top.show()
|
|
|
|
|
|
|
|
def on_delete_event(self,obj,b):
|
2004-08-11 09:12:38 +05:30
|
|
|
self.glry.close()
|
2004-02-26 09:04:19 +05:30
|
|
|
self.close_child_windows()
|
|
|
|
self.remove_itself_from_menu()
|
|
|
|
|
|
|
|
def close(self,obj):
|
2004-08-11 09:12:38 +05:30
|
|
|
self.glry.close()
|
2004-02-26 09:04:19 +05:30
|
|
|
self.close_child_windows()
|
|
|
|
self.remove_itself_from_menu()
|
2002-11-30 05:15:12 +05:30
|
|
|
self.top.destroy()
|
2003-11-19 23:30:58 +05:30
|
|
|
|
2004-02-26 09:04:19 +05:30
|
|
|
def close_child_windows(self):
|
|
|
|
for child_window in self.child_windows.values():
|
|
|
|
child_window.close(None)
|
|
|
|
self.child_windows = {}
|
|
|
|
|
|
|
|
def add_itself_to_menu(self):
|
|
|
|
self.parent.child_windows[self.win_key] = self
|
|
|
|
if not self.place.get_title():
|
|
|
|
label = _("New Place")
|
|
|
|
else:
|
|
|
|
label = self.place.get_title()
|
|
|
|
if not label.strip():
|
|
|
|
label = _("New Place")
|
|
|
|
label = "%s: %s" % (_('Place'),label)
|
|
|
|
self.parent_menu_item = gtk.MenuItem(label)
|
|
|
|
self.parent_menu_item.set_submenu(gtk.Menu())
|
|
|
|
self.parent_menu_item.show()
|
|
|
|
self.parent.winsmenu.append(self.parent_menu_item)
|
|
|
|
self.winsmenu = self.parent_menu_item.get_submenu()
|
|
|
|
self.menu_item = gtk.MenuItem(_('Place Editor'))
|
|
|
|
self.menu_item.connect("activate",self.present)
|
|
|
|
self.menu_item.show()
|
|
|
|
self.winsmenu.append(self.menu_item)
|
|
|
|
|
|
|
|
def remove_itself_from_menu(self):
|
|
|
|
del self.parent.child_windows[self.win_key]
|
|
|
|
self.menu_item.destroy()
|
|
|
|
self.winsmenu.destroy()
|
|
|
|
self.parent_menu_item.destroy()
|
|
|
|
|
|
|
|
def present(self,obj):
|
|
|
|
self.top.present()
|
|
|
|
|
2003-11-19 23:30:58 +05:30
|
|
|
def on_help_clicked(self,obj):
|
|
|
|
"""Display the relevant portion of GRAMPS manual"""
|
2003-12-02 09:57:23 +05:30
|
|
|
gnome.help_display('gramps-manual','gramps-edit-complete')
|
2003-11-19 23:30:58 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def build_columns(self,tree,list):
|
|
|
|
cnum = 0
|
|
|
|
for name in list:
|
|
|
|
renderer = gtk.CellRendererText()
|
|
|
|
column = gtk.TreeViewColumn(name[0],renderer,text=cnum)
|
|
|
|
column.set_min_width(name[1])
|
|
|
|
cnum = cnum + 1
|
|
|
|
tree.append_column(column)
|
|
|
|
|
|
|
|
def url_dest_drag_data_received(self,widget,context,x,y,sel_data,info,time):
|
|
|
|
if sel_data and sel_data.data:
|
|
|
|
exec 'data = %s' % sel_data.data
|
|
|
|
exec 'mytype = "%s"' % data[0]
|
|
|
|
exec 'place = "%s"' % data[1]
|
2004-07-28 07:59:07 +05:30
|
|
|
if place == self.place.get_handle() or mytype != 'url':
|
2002-10-20 19:55:16 +05:30
|
|
|
return
|
|
|
|
foo = pickle.loads(data[2]);
|
|
|
|
self.ulist.append(foo)
|
|
|
|
self.lists_changed = 1
|
|
|
|
self.redraw_url_list()
|
|
|
|
|
|
|
|
def url_source_drag_data_get(self,widget, context, sel_data, info, time):
|
2003-06-14 06:28:38 +05:30
|
|
|
|
|
|
|
ev = self.web_model.get_selected_objects()[0]
|
2002-10-20 19:55:16 +05:30
|
|
|
bits_per = 8; # we're going to pass a string
|
|
|
|
pickled = pickle.dumps(ev);
|
2004-07-28 07:59:07 +05:30
|
|
|
data = str(('url',self.place.get_handle(),pickled));
|
2002-10-20 19:55:16 +05:30
|
|
|
sel_data.set(sel_data.target, bits_per, data)
|
|
|
|
|
|
|
|
def update_lists(self):
|
2004-02-14 11:10:30 +05:30
|
|
|
self.place.set_url_list(self.ulist)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.place.set_alternate_locations(self.llist)
|
|
|
|
|
|
|
|
def redraw_url_list(self):
|
|
|
|
length = Utils.redraw_list(self.ulist,self.web_model,disp_url)
|
|
|
|
if length > 0:
|
|
|
|
self.web_go.set_sensitive(1)
|
2003-05-09 09:02:15 +05:30
|
|
|
self.web_edit.set_sensitive(1)
|
2003-11-13 00:15:07 +05:30
|
|
|
Utils.bold_label(self.inet_label)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2003-05-09 09:02:15 +05:30
|
|
|
self.web_edit.set_sensitive(0)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.web_go.set_sensitive(0)
|
|
|
|
self.web_url.set_text("")
|
|
|
|
self.web_description.set_text("")
|
2003-11-13 00:15:07 +05:30
|
|
|
Utils.unbold_label(self.inet_label)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def redraw_location_list(self):
|
|
|
|
Utils.redraw_list(self.llist,self.loc_model,disp_loc)
|
2003-05-09 09:02:15 +05:30
|
|
|
if len(self.llist) > 0:
|
|
|
|
self.loc_edit.set_sensitive(1)
|
2003-11-13 00:15:07 +05:30
|
|
|
Utils.bold_label(self.names_label)
|
2003-05-09 09:02:15 +05:30
|
|
|
else:
|
|
|
|
self.loc_edit.set_sensitive(0)
|
2003-11-13 00:15:07 +05:30
|
|
|
Utils.unbold_label(self.names_label)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_web_go_clicked(self,obj):
|
|
|
|
text = obj.get()
|
|
|
|
if text != "":
|
2004-09-01 20:41:10 +05:30
|
|
|
gnome.url_show(text)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def set(self,field,getf,setf):
|
2003-12-17 10:53:16 +05:30
|
|
|
text = unicode(field.get_text())
|
2002-10-20 19:55:16 +05:30
|
|
|
if text != getf():
|
|
|
|
setf(text)
|
|
|
|
|
2004-02-26 09:04:19 +05:30
|
|
|
def on_place_apply_clicked(self,obj):
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-12-17 21:36:36 +05:30
|
|
|
note = unicode(self.note_buffer.get_text(self.note_buffer.get_start_iter(),
|
|
|
|
self.note_buffer.get_end_iter(),gtk.FALSE))
|
2003-12-16 06:07:47 +05:30
|
|
|
format = self.preform.get_active()
|
2004-02-26 09:04:19 +05:30
|
|
|
mloc = self.place.get_main_location()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
self.set(self.city,mloc.get_city,mloc.set_city)
|
|
|
|
self.set(self.parish,mloc.get_parish,mloc.set_parish)
|
|
|
|
self.set(self.state,mloc.get_state,mloc.set_state)
|
2003-12-09 11:30:51 +05:30
|
|
|
self.set(self.phone,mloc.get_phone,mloc.set_phone)
|
|
|
|
self.set(self.postal,mloc.get_postal_code,mloc.set_postal_code)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.set(self.county,mloc.get_county,mloc.set_county)
|
|
|
|
self.set(self.country,mloc.get_country,mloc.set_country)
|
|
|
|
self.set(self.title,self.place.get_title,self.place.set_title)
|
|
|
|
self.set(self.longitude,self.place.get_longitude,
|
|
|
|
self.place.set_longitude)
|
|
|
|
self.set(self.latitude,self.place.get_latitude,
|
|
|
|
self.place.set_latitude)
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if self.lists_changed:
|
|
|
|
self.place.set_source_reference_list(self.srcreflist)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if note != self.place.get_note():
|
|
|
|
self.place.set_note(note)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if format != self.place.get_note_format():
|
|
|
|
self.place.set_note_format(format)
|
2003-12-16 06:07:47 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.update_lists()
|
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
trans = self.db.transaction_begin()
|
2004-08-30 09:20:33 +05:30
|
|
|
if self.place.get_handle():
|
|
|
|
self.db.commit_place(self.place,trans)
|
|
|
|
else:
|
|
|
|
self.db.add_place(self.place,trans)
|
2004-08-13 10:04:07 +05:30
|
|
|
self.db.transaction_commit(trans,_("Edit Place (%s)") % self.place.get_title())
|
2004-03-30 10:20:24 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
if self.callback:
|
|
|
|
self.callback(self.place)
|
|
|
|
|
2004-02-26 09:04:19 +05:30
|
|
|
self.close(obj)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def on_switch_page(self,obj,a,page):
|
2003-06-12 07:47:52 +05:30
|
|
|
if page == 4 and self.not_loaded:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.not_loaded = 0
|
|
|
|
self.glry.load_images()
|
2003-06-12 07:47:52 +05:30
|
|
|
elif page == 6 and self.ref_not_loaded:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.ref_not_loaded = 0
|
|
|
|
self.display_references()
|
2003-12-17 21:36:36 +05:30
|
|
|
text = unicode(self.note_buffer.get_text(self.note_buffer.get_start_iter(),
|
|
|
|
self.note_buffer.get_end_iter(),gtk.FALSE))
|
2003-11-13 00:15:07 +05:30
|
|
|
if text:
|
|
|
|
Utils.bold_label(self.notes_label)
|
|
|
|
else:
|
|
|
|
Utils.unbold_label(self.notes_label)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_update_url_clicked(self,obj):
|
|
|
|
import UrlEdit
|
2004-08-20 17:41:56 +05:30
|
|
|
store,node = self.web_list.get_selection().get_selected()
|
|
|
|
if node:
|
|
|
|
row = store.get_path(node)
|
2003-05-09 08:55:51 +05:30
|
|
|
url = self.ulist[row[0]]
|
|
|
|
if url:
|
2002-10-20 19:55:16 +05:30
|
|
|
name = _("Internet Address Editor for %s") % self.place.get_title()
|
|
|
|
else:
|
|
|
|
name = _("Internet Address Editor")
|
2003-06-12 08:50:05 +05:30
|
|
|
UrlEdit.UrlEditor(self,name,url,self.url_edit_callback)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_update_loc_clicked(self,obj):
|
|
|
|
import LocEdit
|
2003-05-09 08:55:51 +05:30
|
|
|
|
2004-08-20 17:41:56 +05:30
|
|
|
store,node = self.loc_sel.get_selected()
|
|
|
|
if node:
|
|
|
|
row = store.get_path(node)
|
2003-05-09 08:55:51 +05:30
|
|
|
loc = self.llist[row[0]]
|
2003-12-07 10:24:40 +05:30
|
|
|
LocEdit.LocationEditor(self,loc,self.top)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_delete_url_clicked(self,obj):
|
|
|
|
if Utils.delete_selected(obj,self.ulist):
|
|
|
|
self.lists_changed = 1
|
|
|
|
self.redraw_url_list()
|
|
|
|
|
|
|
|
def on_delete_loc_clicked(self,obj):
|
|
|
|
if Utils.delete_selected(obj,self.llist):
|
|
|
|
self.lists_changed = 1
|
|
|
|
self.redraw_location_list()
|
|
|
|
|
|
|
|
def on_add_url_clicked(self,obj):
|
|
|
|
import UrlEdit
|
|
|
|
if self.place:
|
|
|
|
name = _("Internet Address Editor for %s") % self.place.get_title()
|
|
|
|
else:
|
|
|
|
name = _("Internet Address Editor")
|
2003-06-12 08:50:05 +05:30
|
|
|
UrlEdit.UrlEditor(self,name,None,self.url_edit_callback)
|
|
|
|
|
|
|
|
def url_edit_callback(self,url):
|
|
|
|
self.redraw_url_list()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_add_loc_clicked(self,obj):
|
|
|
|
import LocEdit
|
2003-12-07 10:24:40 +05:30
|
|
|
LocEdit.LocationEditor(self,None,self.top)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_web_list_select_row(self,obj):
|
2004-08-20 17:41:56 +05:30
|
|
|
store,node = obj.get_selected()
|
|
|
|
if not node:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.web_url.set_text("")
|
|
|
|
self.web_go.set_sensitive(0)
|
|
|
|
self.web_description.set_text("")
|
|
|
|
else:
|
2004-08-20 17:41:56 +05:30
|
|
|
row = store.get_path(node)
|
2002-10-20 19:55:16 +05:30
|
|
|
url = self.ulist[row[0]]
|
|
|
|
path = url.get_path()
|
|
|
|
self.web_url.set_text(path)
|
|
|
|
self.web_go.set_sensitive(1)
|
|
|
|
self.web_description.set_text(url.get_description())
|
|
|
|
|
2003-05-09 08:55:51 +05:30
|
|
|
def on_loc_list_select_row(self,obj):
|
2004-08-20 17:41:56 +05:30
|
|
|
store,node = self.loc_sel.get_selected()
|
|
|
|
if not node:
|
2003-05-09 08:55:51 +05:30
|
|
|
self.loc_city.set_text('')
|
|
|
|
self.loc_county.set_text('')
|
|
|
|
self.loc_state.set_text('')
|
2003-12-09 11:30:51 +05:30
|
|
|
self.loc_postal.set_text('')
|
|
|
|
self.loc_phone.set_text('')
|
2003-05-09 08:55:51 +05:30
|
|
|
self.loc_parish.set_text('')
|
|
|
|
self.loc_country.set_text('')
|
|
|
|
else:
|
2004-08-20 17:41:56 +05:30
|
|
|
row = store.get_path(node)
|
2003-05-09 08:55:51 +05:30
|
|
|
loc = self.llist[row[0]]
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-05-09 08:55:51 +05:30
|
|
|
self.loc_city.set_text(loc.get_city())
|
|
|
|
self.loc_county.set_text(loc.get_county())
|
|
|
|
self.loc_state.set_text(loc.get_state())
|
2003-12-09 11:30:51 +05:30
|
|
|
self.loc_postal.set_text(loc.get_postal_code())
|
|
|
|
self.loc_phone.set_text(loc.get_phone())
|
2003-05-09 08:55:51 +05:30
|
|
|
self.loc_parish.set_text(loc.get_parish())
|
|
|
|
self.loc_country.set_text(loc.get_country())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def display_references(self):
|
|
|
|
pevent = []
|
|
|
|
fevent = []
|
2005-01-11 09:39:52 +05:30
|
|
|
mlist = []
|
2002-10-20 19:55:16 +05:30
|
|
|
msg = ""
|
2004-08-13 10:04:07 +05:30
|
|
|
for key in self.db.get_person_handles(sort_handles=False):
|
2004-08-07 10:46:57 +05:30
|
|
|
p = self.db.get_person_from_handle(key)
|
2004-07-28 07:59:07 +05:30
|
|
|
for event_handle in [p.get_birth_handle(), p.get_death_handle()] + p.get_event_list():
|
* src/AddSpouse.py, src/ChooseParents.py, src/EditPerson.py,
src/EditPlace.py, src/EditSource.py, src/EventEdit.py,
src/FamilyView.py, src/GenericFilter.py,
src/Marriage.py, src/PedView.py, src/PeopleModel.py,
src/PlaceView.py, src/RelLib.py, src/SelectChild.py,
src/Sort.py, src/SourceView.py, src/SubstKeywords.py,
src/WriteGedcom.py, src/WriteXML.py, src/plugins/AncestorReport.py,
src/plugins/Ancestors.py, src/plugins/ChangeTypes.py,
src/plugins/DescendReport.py, src/plugins/DetDescendantReport.py,
src/plugins/EventCmp.py, src/plugins/FamilyGroup.py,
src/plugins/FanChart.py, src/plugins/FtmStyleAncestors.py,
src/plugins/FtmStyleDescendants.py, src/plugins/GraphViz.py,
src/plugins/IndivComplete.py, src/plugins/IndivSummary.py,
src/plugins/Merge.py, src/plugins/RelCalc.py, src/plugins/RelGraph.py,
src/plugins/Summary.py, src/plugins/TimeLine.py, src/plugins/Verify.py,
src/plugins/WebPage.py, src/plugins/WriteCD.py,
src/plugins/WritePkg.py, src/plugins/DetAncestralReport.py:
Use get_event_from_handle (not find_ ).
svn: r3462
2004-08-22 00:26:01 +05:30
|
|
|
event = self.db.get_event_from_handle(event_handle)
|
2005-01-11 09:39:52 +05:30
|
|
|
if event and event.get_place_handle() == self.place.get_handle():
|
2002-10-20 19:55:16 +05:30
|
|
|
pevent.append((p,event))
|
2004-08-13 10:04:07 +05:30
|
|
|
for family_handle in self.db.get_family_handles():
|
2004-08-11 09:12:38 +05:30
|
|
|
f = self.db.get_family_from_handle(family_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
for event_handle in f.get_event_list():
|
* src/AddSpouse.py, src/ChooseParents.py, src/EditPerson.py,
src/EditPlace.py, src/EditSource.py, src/EventEdit.py,
src/FamilyView.py, src/GenericFilter.py,
src/Marriage.py, src/PedView.py, src/PeopleModel.py,
src/PlaceView.py, src/RelLib.py, src/SelectChild.py,
src/Sort.py, src/SourceView.py, src/SubstKeywords.py,
src/WriteGedcom.py, src/WriteXML.py, src/plugins/AncestorReport.py,
src/plugins/Ancestors.py, src/plugins/ChangeTypes.py,
src/plugins/DescendReport.py, src/plugins/DetDescendantReport.py,
src/plugins/EventCmp.py, src/plugins/FamilyGroup.py,
src/plugins/FanChart.py, src/plugins/FtmStyleAncestors.py,
src/plugins/FtmStyleDescendants.py, src/plugins/GraphViz.py,
src/plugins/IndivComplete.py, src/plugins/IndivSummary.py,
src/plugins/Merge.py, src/plugins/RelCalc.py, src/plugins/RelGraph.py,
src/plugins/Summary.py, src/plugins/TimeLine.py, src/plugins/Verify.py,
src/plugins/WebPage.py, src/plugins/WriteCD.py,
src/plugins/WritePkg.py, src/plugins/DetAncestralReport.py:
Use get_event_from_handle (not find_ ).
svn: r3462
2004-08-22 00:26:01 +05:30
|
|
|
event = self.db.get_event_from_handle(event_handle)
|
2005-01-11 09:39:52 +05:30
|
|
|
if event and event.get_place_handle() == self.place.get_handle():
|
2002-10-20 19:55:16 +05:30
|
|
|
fevent.append((f,event))
|
2005-01-11 09:39:52 +05:30
|
|
|
for media_handle in self.db.get_media_object_handles():
|
2005-01-16 09:30:35 +05:30
|
|
|
obj = self.db.get_object_from_handle(media_handle)
|
|
|
|
if obj and obj.get_place_handle() == self.place.get_handle():
|
2005-01-11 09:39:52 +05:30
|
|
|
mlist.append(object)
|
|
|
|
|
2003-11-13 00:15:07 +05:30
|
|
|
any = 0
|
2002-10-20 19:55:16 +05:30
|
|
|
if len(pevent) > 0:
|
2003-11-13 00:15:07 +05:30
|
|
|
any = 1
|
2002-10-20 19:55:16 +05:30
|
|
|
msg = msg + _("People") + "\n"
|
|
|
|
msg = msg + "_________________________\n\n"
|
|
|
|
t = _("%s [%s]: event %s\n")
|
|
|
|
|
|
|
|
for e in pevent:
|
2005-01-11 09:39:52 +05:30
|
|
|
msg = msg + ( t % (self.name_display(e[0]),e[0].get_gramps_id(),_(e[1].get_name())))
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
if len(fevent) > 0:
|
2003-11-13 00:15:07 +05:30
|
|
|
any = 1
|
2002-10-20 19:55:16 +05:30
|
|
|
msg = msg + "\n%s\n" % _("Families")
|
|
|
|
msg = msg + "_________________________\n\n"
|
|
|
|
t = _("%s [%s]: event %s\n")
|
|
|
|
|
|
|
|
for e in fevent:
|
2004-07-28 07:59:07 +05:30
|
|
|
father = e[0].get_father_handle()
|
|
|
|
mother = e[0].get_mother_handle()
|
2002-10-20 19:55:16 +05:30
|
|
|
if father and mother:
|
2004-01-21 01:33:50 +05:30
|
|
|
fname = _("%(father)s and %(mother)s") % {
|
2005-01-11 09:39:52 +05:30
|
|
|
"father" : self.name_display( self.db.get_person_from_handle( father)),
|
|
|
|
"mother" : self.name_display( self.db.get_person_from_handle( mother)) }
|
2002-10-20 19:55:16 +05:30
|
|
|
elif father:
|
2005-01-11 09:39:52 +05:30
|
|
|
fname = self.name_display( self.db.get_person_from_handle( father))
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2005-01-11 09:39:52 +05:30
|
|
|
fname = self.name_display( self.db.get_person_from_handle( mother))
|
|
|
|
|
|
|
|
msg = msg + ( t % (fname,e[0].get_gramps_id(),_(e[1].get_name())))
|
|
|
|
|
|
|
|
if len(mlist) > 0:
|
|
|
|
any = 1
|
|
|
|
msg = msg + "\n%s\n" % _("Media Objects")
|
|
|
|
msg = msg + "_________________________\n\n"
|
|
|
|
t = _("%s [%s]\n")
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-01-11 09:39:52 +05:30
|
|
|
for o in mlist:
|
|
|
|
msg = msg + ( t % (o.get_description(),o.get_gramps_id()))
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
self.refinfo.get_buffer().set_text(msg)
|
2003-11-13 00:15:07 +05:30
|
|
|
if any:
|
|
|
|
Utils.bold_label(self.refs_label)
|
|
|
|
|
|
|
|
self.ref_not_loaded = 0
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# disp_url
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
def disp_url(url):
|
|
|
|
return [url.get_path(),url.get_description()]
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# disp_loc
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
def disp_loc(loc):
|
|
|
|
return [loc.get_city(),loc.get_county(),loc.get_state(),loc.get_country()]
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# DeletePlaceQuery
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
class DeletePlaceQuery:
|
|
|
|
|
|
|
|
def __init__(self,place,db,update):
|
|
|
|
self.db = db
|
|
|
|
self.place = place
|
|
|
|
self.update = update
|
|
|
|
|
|
|
|
def query_response(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
trans = self.db.transaction_begin()
|
2004-03-30 10:20:24 +05:30
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
self.db.remove_place(self.place.get_handle(),trans)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
for key in self.db.get_person_handles(sort_handles=False):
|
2004-08-07 10:46:57 +05:30
|
|
|
p = self.db.get_person_from_handle(key)
|
2004-07-28 07:59:07 +05:30
|
|
|
for event_handle in [p.get_birth_handle(), p.get_death_handle()] + p.get_event_list():
|
* src/AddSpouse.py, src/ChooseParents.py, src/EditPerson.py,
src/EditPlace.py, src/EditSource.py, src/EventEdit.py,
src/FamilyView.py, src/GenericFilter.py,
src/Marriage.py, src/PedView.py, src/PeopleModel.py,
src/PlaceView.py, src/RelLib.py, src/SelectChild.py,
src/Sort.py, src/SourceView.py, src/SubstKeywords.py,
src/WriteGedcom.py, src/WriteXML.py, src/plugins/AncestorReport.py,
src/plugins/Ancestors.py, src/plugins/ChangeTypes.py,
src/plugins/DescendReport.py, src/plugins/DetDescendantReport.py,
src/plugins/EventCmp.py, src/plugins/FamilyGroup.py,
src/plugins/FanChart.py, src/plugins/FtmStyleAncestors.py,
src/plugins/FtmStyleDescendants.py, src/plugins/GraphViz.py,
src/plugins/IndivComplete.py, src/plugins/IndivSummary.py,
src/plugins/Merge.py, src/plugins/RelCalc.py, src/plugins/RelGraph.py,
src/plugins/Summary.py, src/plugins/TimeLine.py, src/plugins/Verify.py,
src/plugins/WebPage.py, src/plugins/WriteCD.py,
src/plugins/WritePkg.py, src/plugins/DetAncestralReport.py:
Use get_event_from_handle (not find_ ).
svn: r3462
2004-08-22 00:26:01 +05:30
|
|
|
event = self.db.get_event_from_handle(event_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
if event and event.get_place_handle() == self.place.get_handle():
|
|
|
|
event.set_place_handle(None)
|
2004-03-30 10:20:24 +05:30
|
|
|
self.db.commit_event(event,trans)
|
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
for fid in self.db.get_family_handles():
|
2004-08-11 09:12:38 +05:30
|
|
|
f = self.db.get_family_from_handle(fid)
|
2004-07-28 07:59:07 +05:30
|
|
|
for event_handle in f.get_event_list():
|
* src/AddSpouse.py, src/ChooseParents.py, src/EditPerson.py,
src/EditPlace.py, src/EditSource.py, src/EventEdit.py,
src/FamilyView.py, src/GenericFilter.py,
src/Marriage.py, src/PedView.py, src/PeopleModel.py,
src/PlaceView.py, src/RelLib.py, src/SelectChild.py,
src/Sort.py, src/SourceView.py, src/SubstKeywords.py,
src/WriteGedcom.py, src/WriteXML.py, src/plugins/AncestorReport.py,
src/plugins/Ancestors.py, src/plugins/ChangeTypes.py,
src/plugins/DescendReport.py, src/plugins/DetDescendantReport.py,
src/plugins/EventCmp.py, src/plugins/FamilyGroup.py,
src/plugins/FanChart.py, src/plugins/FtmStyleAncestors.py,
src/plugins/FtmStyleDescendants.py, src/plugins/GraphViz.py,
src/plugins/IndivComplete.py, src/plugins/IndivSummary.py,
src/plugins/Merge.py, src/plugins/RelCalc.py, src/plugins/RelGraph.py,
src/plugins/Summary.py, src/plugins/TimeLine.py, src/plugins/Verify.py,
src/plugins/WebPage.py, src/plugins/WriteCD.py,
src/plugins/WritePkg.py, src/plugins/DetAncestralReport.py:
Use get_event_from_handle (not find_ ).
svn: r3462
2004-08-22 00:26:01 +05:30
|
|
|
event = self.db.get_event_from_handle(event_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
if event and event.get_place_handle() == self.place.get_handle():
|
|
|
|
event.set_place_handle(None)
|
2004-03-30 10:20:24 +05:30
|
|
|
self.db.commit_event(event,trans)
|
2002-10-21 06:48:07 +05:30
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
self.db.transaction_commit(trans,_("Delete Place (%s)") % self.place.get_title())
|
2004-08-30 09:20:33 +05:30
|
|
|
self.update(self.place.get_handle())
|