2002-10-20 14:25:16 +00:00
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2007-02-20 00:39:10 +00:00
|
|
|
# Copyright (C) 2000-2007 Donald N. Allingham
|
2002-10-20 14:25:16 +00:00
|
|
|
#
|
|
|
|
# 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-12 18:45:07 +00:00
|
|
|
|
|
|
|
# $Id$
|
|
|
|
|
2002-10-20 14:25:16 +00:00
|
|
|
"""
|
2006-03-03 00:29:52 +00:00
|
|
|
The EditAddress module provides the EditAddress class. This provides a
|
2002-10-20 14:25:16 +00:00
|
|
|
mechanism for the user to edit address information.
|
|
|
|
"""
|
|
|
|
|
2004-09-19 15:17:57 +00:00
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Python modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2006-04-06 22:02:46 +00:00
|
|
|
from gettext import gettext as _
|
2004-09-19 15:17:57 +00:00
|
|
|
|
2002-10-20 14:25:16 +00:00
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GTK/Gnome modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2008-02-18 23:48:35 +00:00
|
|
|
import gtk
|
2008-02-18 20:07:09 +00:00
|
|
|
from gtk import glade
|
2002-10-20 14:25:16 +00:00
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gramps modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import const
|
2006-11-26 04:39:34 +00:00
|
|
|
import Config
|
2006-03-04 06:34:48 +00:00
|
|
|
from _EditSecondary import EditSecondary
|
2007-10-08 16:41:39 +00:00
|
|
|
from gen.lib import NoteType
|
2002-10-20 14:25:16 +00:00
|
|
|
|
2006-05-05 00:39:11 +00:00
|
|
|
from DisplayTabs import SourceEmbedList, NoteTab
|
2008-02-18 20:07:09 +00:00
|
|
|
from GrampsWidgets import MonitoredDate, MonitoredEntry, PrivacyButton
|
2005-12-06 06:38:09 +00:00
|
|
|
|
2002-10-20 14:25:16 +00:00
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
2006-03-03 00:29:52 +00:00
|
|
|
# EditAddress class
|
2002-10-20 14:25:16 +00:00
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2006-03-04 06:34:48 +00:00
|
|
|
class EditAddress(EditSecondary):
|
2002-10-20 14:25:16 +00:00
|
|
|
"""
|
|
|
|
Displays a dialog that allows the user to edit an address.
|
|
|
|
"""
|
2006-11-26 04:39:34 +00:00
|
|
|
|
2007-02-20 00:39:10 +00:00
|
|
|
WIDTH_KEY = Config.ADDRESS_WIDTH
|
|
|
|
HEIGHT_KEY = Config.ADDRESS_HEIGHT
|
2006-11-26 04:39:34 +00:00
|
|
|
|
2005-12-23 05:35:32 +00:00
|
|
|
def __init__(self, dbstate, uistate, track, addr, callback):
|
2002-10-20 14:25:16 +00:00
|
|
|
"""
|
|
|
|
Displays the dialog box.
|
|
|
|
|
|
|
|
parent - The class that called the Address editor.
|
|
|
|
addr - The address that is to be edited
|
|
|
|
"""
|
2006-03-21 22:12:39 +00:00
|
|
|
EditSecondary.__init__(self, dbstate, uistate, track, addr, callback)
|
* src/AddrEdit.py, src/AttrEdit.py, src/EditPerson.py,
src/EditSource.py, src/EventEdit.py, src/ImageSelect.py,
src/Marriage.py, src/NameEdit.py, src/NoteEdit.py,
src/Sources.py, src/UrlEdit.py, src/Witness.py:
Register windows opened for existing objects. Prevent editing
same object twice.
svn: r2905
2004-02-24 05:37:06 +00:00
|
|
|
|
2006-03-02 04:32:37 +00:00
|
|
|
def _local_init(self):
|
2008-02-18 20:07:09 +00:00
|
|
|
self.top = glade.XML(const.GLADE_FILE, "addr_edit","gramps")
|
2006-04-23 22:18:01 +00:00
|
|
|
self.set_window(self.top.get_widget("addr_edit"),
|
|
|
|
self.top.get_widget("title"),
|
|
|
|
_('Address Editor'))
|
2002-10-20 14:25:16 +00:00
|
|
|
|
2006-02-22 00:12:52 +00:00
|
|
|
def _setup_fields(self):
|
|
|
|
self.addr_start = MonitoredDate(
|
2007-03-24 00:30:14 +00:00
|
|
|
self.top.get_widget("date_entry"),
|
2006-02-22 00:12:52 +00:00
|
|
|
self.top.get_widget("date_stat"),
|
2006-03-02 04:32:37 +00:00
|
|
|
self.obj.get_date_object(),
|
2006-05-06 03:14:13 +00:00
|
|
|
self.uistate,
|
|
|
|
self.track,
|
|
|
|
self.db.readonly)
|
2006-02-22 00:12:52 +00:00
|
|
|
|
|
|
|
self.street = MonitoredEntry(
|
2006-03-02 04:32:37 +00:00
|
|
|
self.top.get_widget("street"), self.obj.set_street,
|
|
|
|
self.obj.get_street, self.db.readonly)
|
2002-10-20 14:25:16 +00:00
|
|
|
|
2006-02-22 00:12:52 +00:00
|
|
|
self.city = MonitoredEntry(
|
2006-03-02 04:32:37 +00:00
|
|
|
self.top.get_widget("city"), self.obj.set_city,
|
|
|
|
self.obj.get_city, self.db.readonly)
|
2003-11-12 18:45:07 +00:00
|
|
|
|
2006-02-22 00:12:52 +00:00
|
|
|
self.state = MonitoredEntry(
|
2006-03-02 04:32:37 +00:00
|
|
|
self.top.get_widget("state"), self.obj.set_state,
|
|
|
|
self.obj.get_state, self.db.readonly)
|
2006-02-04 23:29:44 +00:00
|
|
|
|
2006-02-22 00:12:52 +00:00
|
|
|
self.country = MonitoredEntry(
|
2006-03-02 04:32:37 +00:00
|
|
|
self.top.get_widget("country"), self.obj.set_country,
|
|
|
|
self.obj.get_country, self.db.readonly)
|
2006-02-22 00:12:52 +00:00
|
|
|
|
|
|
|
self.postal = MonitoredEntry(
|
2006-03-02 04:32:37 +00:00
|
|
|
self.top.get_widget("postal"), self.obj.set_postal_code,
|
|
|
|
self.obj.get_postal_code, self.db.readonly)
|
2006-02-22 00:12:52 +00:00
|
|
|
|
|
|
|
self.phone = MonitoredEntry(
|
2006-03-02 04:32:37 +00:00
|
|
|
self.top.get_widget("phone"), self.obj.set_phone,
|
|
|
|
self.obj.get_phone, self.db.readonly)
|
2006-02-22 00:12:52 +00:00
|
|
|
|
|
|
|
self.priv = PrivacyButton(self.top.get_widget("private"),
|
2006-03-02 04:32:37 +00:00
|
|
|
self.obj, self.db.readonly)
|
2006-02-22 00:12:52 +00:00
|
|
|
|
|
|
|
def _connect_signals(self):
|
2006-03-02 04:32:37 +00:00
|
|
|
self.define_help_button(self.top.get_widget('help'),'adv-ad')
|
|
|
|
self.define_cancel_button(self.top.get_widget('cancel'))
|
|
|
|
self.define_ok_button(self.top.get_widget('ok'),self.save)
|
|
|
|
|
2006-02-04 23:29:44 +00:00
|
|
|
def _create_tabbed_pages(self):
|
|
|
|
"""
|
2008-02-24 13:55:55 +00:00
|
|
|
Create the notebook tabs and inserts them into the main
|
2006-02-04 23:29:44 +00:00
|
|
|
window.
|
|
|
|
"""
|
|
|
|
|
2006-03-02 04:32:37 +00:00
|
|
|
notebook = gtk.Notebook()
|
|
|
|
|
|
|
|
self.srcref_list = self._add_tab(
|
|
|
|
notebook,
|
2006-10-09 02:45:26 +00:00
|
|
|
SourceEmbedList(self.dbstate,self.uistate,self.track,self.obj))
|
2006-03-02 04:32:37 +00:00
|
|
|
|
|
|
|
self.note_tab = self._add_tab(
|
|
|
|
notebook,
|
|
|
|
NoteTab(self.dbstate, self.uistate, self.track,
|
2007-05-07 20:41:16 +00:00
|
|
|
self.obj.get_note_list(),
|
|
|
|
notetype=NoteType.ADDRESS))
|
2004-02-20 01:15:37 +00:00
|
|
|
|
2007-01-16 07:12:10 +00:00
|
|
|
self._setup_notebook_tabs( notebook)
|
2006-03-02 04:32:37 +00:00
|
|
|
notebook.show_all()
|
|
|
|
self.top.get_widget('vbox').pack_start(notebook,True)
|
2002-10-20 14:25:16 +00:00
|
|
|
|
2008-02-24 13:55:55 +00:00
|
|
|
def build_menu_names(self, obj):
|
2005-12-23 05:35:32 +00:00
|
|
|
return (_('Address'),_('Address Editor'))
|
2004-02-20 01:15:37 +00:00
|
|
|
|
2006-03-02 04:32:37 +00:00
|
|
|
def save(self,*obj):
|
2002-10-20 14:25:16 +00:00
|
|
|
"""
|
|
|
|
Called when the OK button is pressed. Gets data from the
|
|
|
|
form and updates the Address data structure.
|
|
|
|
"""
|
2006-03-02 04:32:37 +00:00
|
|
|
if self.callback:
|
|
|
|
self.callback(self.obj)
|
2006-04-23 22:43:36 +00:00
|
|
|
self.close()
|