2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2006-02-04 03:33:53 +05:30
|
|
|
# Copyright (C) 2000-2006 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
|
|
|
"""
|
2006-03-03 05:59:52 +05:30
|
|
|
The EditAddress module provides the EditAddress class. This provides a
|
2002-10-20 19:55:16 +05:30
|
|
|
mechanism for the user to edit address information.
|
|
|
|
"""
|
|
|
|
|
2004-09-19 20:47:57 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Python modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2006-04-07 03:32:46 +05:30
|
|
|
from gettext import gettext as _
|
2004-09-19 20:47:57 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GTK/Gnome modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import gtk.glade
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gramps modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import const
|
2006-03-04 12:04:48 +05:30
|
|
|
from _EditSecondary import EditSecondary
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2006-02-05 04:59:44 +05:30
|
|
|
from DisplayTabs import *
|
2006-02-22 05:42:52 +05:30
|
|
|
from GrampsWidgets import *
|
2005-12-06 12:08:09 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
2006-03-03 05:59:52 +05:30
|
|
|
# EditAddress class
|
2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2006-03-04 12:04:48 +05:30
|
|
|
class EditAddress(EditSecondary):
|
2002-10-20 19:55:16 +05:30
|
|
|
"""
|
|
|
|
Displays a dialog that allows the user to edit an address.
|
|
|
|
"""
|
2005-12-23 11:05:32 +05:30
|
|
|
def __init__(self, dbstate, uistate, track, addr, callback):
|
2002-10-20 19:55:16 +05:30
|
|
|
"""
|
|
|
|
Displays the dialog box.
|
|
|
|
|
|
|
|
parent - The class that called the Address editor.
|
|
|
|
addr - The address that is to be edited
|
|
|
|
"""
|
2006-03-22 03:42:39 +05:30
|
|
|
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 11:07:06 +05:30
|
|
|
|
2006-03-02 10:02:37 +05:30
|
|
|
def _local_init(self):
|
2006-01-17 10:33:30 +05:30
|
|
|
self.top = gtk.glade.XML(const.gladeFile, "addr_edit","gramps")
|
2006-03-02 10:02:37 +05:30
|
|
|
self.define_top_level(self.top.get_widget("addr_edit"),
|
|
|
|
self.top.get_widget("title"),
|
|
|
|
_('Address Editor'))
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2006-02-22 05:42:52 +05:30
|
|
|
def _setup_fields(self):
|
|
|
|
self.addr_start = MonitoredDate(
|
|
|
|
self.top.get_widget("address_start"),
|
|
|
|
self.top.get_widget("date_stat"),
|
2006-03-02 10:02:37 +05:30
|
|
|
self.obj.get_date_object(),
|
2006-02-22 05:42:52 +05:30
|
|
|
self.window, self.db.readonly)
|
|
|
|
|
|
|
|
self.street = MonitoredEntry(
|
2006-03-02 10:02:37 +05:30
|
|
|
self.top.get_widget("street"), self.obj.set_street,
|
|
|
|
self.obj.get_street, self.db.readonly)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2006-02-22 05:42:52 +05:30
|
|
|
self.city = MonitoredEntry(
|
2006-03-02 10:02:37 +05:30
|
|
|
self.top.get_widget("city"), self.obj.set_city,
|
|
|
|
self.obj.get_city, self.db.readonly)
|
2003-11-13 00:15:07 +05:30
|
|
|
|
2006-02-22 05:42:52 +05:30
|
|
|
self.state = MonitoredEntry(
|
2006-03-02 10:02:37 +05:30
|
|
|
self.top.get_widget("state"), self.obj.set_state,
|
|
|
|
self.obj.get_state, self.db.readonly)
|
2006-02-05 04:59:44 +05:30
|
|
|
|
2006-02-22 05:42:52 +05:30
|
|
|
self.country = MonitoredEntry(
|
2006-03-02 10:02:37 +05:30
|
|
|
self.top.get_widget("country"), self.obj.set_country,
|
|
|
|
self.obj.get_country, self.db.readonly)
|
2006-02-22 05:42:52 +05:30
|
|
|
|
|
|
|
self.postal = MonitoredEntry(
|
2006-03-02 10:02:37 +05:30
|
|
|
self.top.get_widget("postal"), self.obj.set_postal_code,
|
|
|
|
self.obj.get_postal_code, self.db.readonly)
|
2006-02-22 05:42:52 +05:30
|
|
|
|
|
|
|
self.phone = MonitoredEntry(
|
2006-03-02 10:02:37 +05:30
|
|
|
self.top.get_widget("phone"), self.obj.set_phone,
|
|
|
|
self.obj.get_phone, self.db.readonly)
|
2006-02-22 05:42:52 +05:30
|
|
|
|
|
|
|
self.priv = PrivacyButton(self.top.get_widget("private"),
|
2006-03-02 10:02:37 +05:30
|
|
|
self.obj, self.db.readonly)
|
2006-02-22 05:42:52 +05:30
|
|
|
|
|
|
|
def _connect_signals(self):
|
2006-03-02 10:02:37 +05:30
|
|
|
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-05 04:59:44 +05:30
|
|
|
def _create_tabbed_pages(self):
|
|
|
|
"""
|
|
|
|
Creates the notebook tabs and inserts them into the main
|
|
|
|
window.
|
|
|
|
"""
|
|
|
|
|
2006-03-02 10:02:37 +05:30
|
|
|
notebook = gtk.Notebook()
|
|
|
|
|
|
|
|
self.srcref_list = self._add_tab(
|
|
|
|
notebook,
|
|
|
|
SourceEmbedList(self.dbstate,self.uistate, self.track,
|
|
|
|
self.obj.source_list))
|
|
|
|
|
|
|
|
self.note_tab = self._add_tab(
|
|
|
|
notebook,
|
|
|
|
NoteTab(self.dbstate, self.uistate, self.track,
|
|
|
|
self.obj.get_note_object()))
|
2004-02-20 06:45:37 +05:30
|
|
|
|
2006-03-02 10:02:37 +05:30
|
|
|
notebook.show_all()
|
|
|
|
self.top.get_widget('vbox').pack_start(notebook,True)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-12-23 11:05:32 +05:30
|
|
|
def build_menu_names(self,obj):
|
|
|
|
return (_('Address'),_('Address Editor'))
|
2004-02-20 06:45:37 +05:30
|
|
|
|
2006-03-02 10:02:37 +05:30
|
|
|
def save(self,*obj):
|
2002-10-20 19:55:16 +05:30
|
|
|
"""
|
|
|
|
Called when the OK button is pressed. Gets data from the
|
|
|
|
form and updates the Address data structure.
|
|
|
|
"""
|
2006-03-02 10:02:37 +05:30
|
|
|
if self.callback:
|
|
|
|
self.callback(self.obj)
|
2005-12-23 11:05:32 +05:30
|
|
|
self.close_window(obj)
|
2002-10-20 19:55:16 +05:30
|
|
|
|