2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2005-03-08 22:55:09 +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
|
|
|
"""
|
2006-03-03 05:59:52 +05:30
|
|
|
The EditAttribute module provides the AttributeEditor class. This provides a
|
2004-02-20 06:45:37 +05:30
|
|
|
mechanism for the user to edit attribute information.
|
2002-10-20 19:55:16 +05:30
|
|
|
"""
|
|
|
|
|
|
|
|
__author__ = "Donald N. Allingham"
|
|
|
|
__version__ = "$Revision$"
|
|
|
|
|
2005-03-08 22:55:09 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Python modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2006-03-17 01:54:27 +05:30
|
|
|
from TransUtils import sgettext as _
|
2005-03-08 22:55:09 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GTK/Gnome modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import gtk.glade
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gramps modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import const
|
|
|
|
import Utils
|
2003-01-10 10:51:32 +05:30
|
|
|
import RelLib
|
2005-12-06 12:08:09 +05:30
|
|
|
import GrampsDisplay
|
2006-03-04 12:04:48 +05:30
|
|
|
from _EditSecondary import EditSecondary
|
2005-08-18 11:28:28 +05:30
|
|
|
|
2006-02-04 10:22:16 +05:30
|
|
|
from DisplayTabs import *
|
2006-02-22 05:42:52 +05:30
|
|
|
from GrampsWidgets import *
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
2006-03-03 05:59:52 +05:30
|
|
|
# EditAttribute class
|
2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2006-03-04 12:04:48 +05:30
|
|
|
class EditAttribute(EditSecondary):
|
2002-10-20 19:55:16 +05:30
|
|
|
"""
|
|
|
|
Displays a dialog that allows the user to edit an attribute.
|
|
|
|
"""
|
2005-12-23 11:05:32 +05:30
|
|
|
def __init__(self, state, uistate, track, attrib, title, data_list, callback):
|
2002-10-20 19:55:16 +05:30
|
|
|
"""
|
|
|
|
Displays the dialog box.
|
|
|
|
|
|
|
|
parent - The class that called the Address editor.
|
|
|
|
attrib - The attribute that is to be edited
|
|
|
|
title - The title of the dialog box
|
|
|
|
list - list of options for the pop down menu
|
|
|
|
"""
|
2005-08-18 11:28:28 +05:30
|
|
|
self.alist = data_list
|
2006-03-04 12:04:48 +05:30
|
|
|
EditSecondary.__init__(self, state, uistate, track, attrib, callback)
|
2006-04-01 05:16:34 +05:30
|
|
|
|
|
|
|
def attribute_list(self):
|
|
|
|
return Utils.personal_attributes
|
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, "attr_edit","gramps")
|
2006-03-02 10:02:37 +05:30
|
|
|
self.define_top_level(self.top.get_widget("attr_edit"),
|
|
|
|
self.top.get_widget('title'),
|
|
|
|
_('Attribute Editor'))
|
2006-02-22 05:42:52 +05:30
|
|
|
|
|
|
|
def _connect_signals(self):
|
2006-03-02 10:02:37 +05:30
|
|
|
self.define_cancel_button(self.top.get_widget('cancel'))
|
|
|
|
self.define_help_button(self.top.get_widget('help'),'adv-at')
|
|
|
|
self.define_ok_button(self.top.get_widget('ok'),self.save)
|
2006-02-04 10:22:16 +05:30
|
|
|
|
2006-02-22 05:42:52 +05:30
|
|
|
def _setup_fields(self):
|
|
|
|
self.value_field = MonitoredEntry(
|
|
|
|
self.top.get_widget("attr_value"),
|
2006-03-02 10:02:37 +05:30
|
|
|
self.obj.set_value, self.obj.get_value,
|
2006-02-22 05:42:52 +05:30
|
|
|
self.db.readonly)
|
|
|
|
|
2006-03-02 10:02:37 +05:30
|
|
|
self.priv = PrivacyButton(
|
|
|
|
self.top.get_widget("private"),
|
|
|
|
self.obj)
|
2006-02-22 05:42:52 +05:30
|
|
|
|
|
|
|
self.type_selector = MonitoredType(
|
|
|
|
self.top.get_widget("attr_menu"),
|
2006-04-01 05:16:34 +05:30
|
|
|
self.obj.set_type,
|
|
|
|
self.obj.get_type,
|
|
|
|
self.attribute_list(),
|
|
|
|
RelLib.Attribute.CUSTOM,
|
|
|
|
custom_values=self.alist,
|
|
|
|
)
|
2006-02-04 10:22:16 +05:30
|
|
|
|
|
|
|
def _create_tabbed_pages(self):
|
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))
|
2006-02-04 10:22:16 +05:30
|
|
|
|
2006-03-02 10:02:37 +05:30
|
|
|
self.note_tab = self._add_tab(
|
|
|
|
notebook,
|
|
|
|
NoteTab(self.dbstate, self.uistate, self.track,
|
|
|
|
self.obj.get_note_object()))
|
|
|
|
|
|
|
|
notebook.show_all()
|
|
|
|
vbox = self.top.get_widget('vbox').pack_start(notebook,True)
|
* src/SourceView.py (button_press,on_add_clicked,on_delete_clicked,
on_edit_clicked): Pass parent window to the child dialog.
* src/Sources.py (add_src_clicked): Likewise.
* src/EditSource.py (__init__): Add optional parent_window argument.
Make dialog modal and transient for its parent.
* src/gramps.glade (sourceEditor dialog): Delete unneeded handlers
for buttons.
* src/QuestionDialog.py (SaveDialog,QuestionDialog,OptionDialog,
ErrorDialog,WarningDialog,MissingMediaDialog): Set transient status
if parent is given.
* src/EventEdit.py (__init__): Make dialog modal and transient for
its parent.
* src/Witness.py: Make WittnessEditor dialog modal and transient for
its parent. Call SelectPerson with itself as a parent.
* src/SelectPerson.py (__init__): Make dialog transient for its parent.
* src/imagesel.glade: Define proper responses and delete unneeded handlers
for buttons. Make gtkFileEntry modal.
* src/dialog.glade (all dialogs): Define proper responses for buttons.
* src/EditPerson.py (on_add_aka_clicked, on_aka_update_clicked):
Call NameEdit with itself as a parent; (on_add_attr_clicked,
on_update_attr_clicked): Call AttributeEditor with itself as a parent;
(on_add_addr_clicked,on_update_addr_clicked): Call AddressEditor with
itself as a parent; (on_add_url_clicked,on_update_url_clicked): Call
UrlEditor with itself as a parent; (on_name_note_clicked,
on_ldsbap_note_clicked,on_ldsendow_note_clicked,
on_ldsseal_note_clicked): Call NoteEditor with itself as a parent.
* src/NameEdit.py (__init__): Make dialog modal and transient for
its parent.
* src/AttrEdit.py (__init__): Likewise.
* src/AddrEdit.py (__init__): Likewise.
* src/UrlEdit.py (__init__): Likewise.
* src/NoteEdit.py (__init__): Likewise.
svn: r2131
2003-09-15 09:41:30 +05:30
|
|
|
|
2005-12-23 11:05:32 +05:30
|
|
|
def build_menu_names(self, attrib):
|
|
|
|
if not attrib:
|
2004-02-20 06:45:37 +05:30
|
|
|
label = _("New Attribute")
|
|
|
|
else:
|
2005-12-23 11:05:32 +05:30
|
|
|
label = attrib.get_type()[1]
|
2004-02-20 06:45:37 +05:30
|
|
|
if not label.strip():
|
|
|
|
label = _("New Attribute")
|
|
|
|
label = "%s: %s" % (_('Attribute'),label)
|
2005-12-23 11:05:32 +05:30
|
|
|
return (label, _('Attribute 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 Attribute 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
|
|
|
|
2006-04-01 05:16:34 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# EditAttribute class
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
class EditFamilyAttribute(EditAttribute):
|
|
|
|
"""
|
|
|
|
Displays a dialog that allows the user to edit an attribute.
|
|
|
|
"""
|
|
|
|
def __init__(self, state, uistate, track, attrib, title, data_list, callback):
|
|
|
|
"""
|
|
|
|
Displays the dialog box.
|
|
|
|
|
|
|
|
parent - The class that called the Address editor.
|
|
|
|
attrib - The attribute that is to be edited
|
|
|
|
title - The title of the dialog box
|
|
|
|
list - list of options for the pop down menu
|
|
|
|
"""
|
|
|
|
EditAttribute.__init__(self, state, uistate, track, attrib, title,
|
|
|
|
data_list, callback)
|
|
|
|
|
|
|
|
def attribute_list(self):
|
|
|
|
return Utils.family_attributes
|
|
|
|
|