2005-08-09 10:11:20 +05:30
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2007-06-28 11:11:40 +05:30
|
|
|
# Copyright (C) 2000-2007 Donald N. Allingham
|
2009-11-07 18:34:45 +05:30
|
|
|
# Copyright (C) 2008 Gary Burton
|
|
|
|
# Copyright (C) 2009 Nick Hall
|
2005-08-09 10:11:20 +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.
|
|
|
|
#
|
2009-11-07 18:34:45 +05:30
|
|
|
# This program is distributed in the hope that it will be useful,
|
2005-08-09 10:11:20 +05:30
|
|
|
# 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
|
|
|
|
#
|
|
|
|
|
|
|
|
# $Id$
|
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
"""
|
2009-11-07 18:34:45 +05:30
|
|
|
Provide the person view.
|
2007-01-09 10:02:07 +05:30
|
|
|
"""
|
|
|
|
|
2009-11-07 18:34:45 +05:30
|
|
|
#-------------------------------------------------------------------------
|
2005-08-09 10:11:20 +05:30
|
|
|
#
|
2009-11-07 18:34:45 +05:30
|
|
|
# GTK/Gnome modules
|
2005-08-09 10:11:20 +05:30
|
|
|
#
|
2009-11-07 18:34:45 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import gtk
|
2005-08-09 10:11:20 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
2009-11-07 18:34:45 +05:30
|
|
|
# set up logging
|
2005-08-09 10:11:20 +05:30
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2009-11-07 18:34:45 +05:30
|
|
|
import logging
|
|
|
|
_LOG = logging.getLogger(".gui.personview")
|
2005-08-09 10:11:20 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
2009-11-07 18:34:45 +05:30
|
|
|
# gramps modules
|
2005-08-09 10:11:20 +05:30
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2007-10-08 22:11:39 +05:30
|
|
|
import gen.lib
|
2010-01-09 21:46:52 +05:30
|
|
|
from gui.views.listview import ListView, LISTTREE
|
2009-11-08 22:11:49 +05:30
|
|
|
from gui.views.treemodels import PeopleModel
|
2005-08-09 10:11:20 +05:30
|
|
|
import Utils
|
2010-01-14 09:38:04 +05:30
|
|
|
from gen.display.name import displayer as name_displayer
|
2008-02-18 15:39:50 +05:30
|
|
|
from QuestionDialog import ErrorDialog, QuestionDialog
|
2006-03-01 10:38:11 +05:30
|
|
|
import Errors
|
2009-11-07 18:34:45 +05:30
|
|
|
import Bookmarks
|
2009-10-08 06:42:51 +05:30
|
|
|
import config
|
2009-11-07 18:34:45 +05:30
|
|
|
from DdTargets import DdTargets
|
2009-12-15 11:26:12 +05:30
|
|
|
from gui.editors import EditPerson
|
2006-08-05 10:11:56 +05:30
|
|
|
from Filters.SideBar import PersonSidebarFilter
|
2009-11-07 18:34:45 +05:30
|
|
|
from gen.plug import CATEGORY_QR_PERSON
|
2005-08-09 10:11:20 +05:30
|
|
|
|
2009-11-07 18:34:45 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# internationalization
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2010-01-18 10:12:17 +05:30
|
|
|
from gen.ggettext import sgettext as _
|
2009-11-07 18:34:45 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# PersonView
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
class PersonView(ListView):
|
2007-01-09 10:02:07 +05:30
|
|
|
"""
|
2009-11-07 18:34:45 +05:30
|
|
|
PersonView class, derived from the ListView
|
2007-01-09 10:02:07 +05:30
|
|
|
"""
|
2009-11-07 18:34:45 +05:30
|
|
|
COLUMN_NAMES = [
|
|
|
|
_('Name'),
|
|
|
|
_('ID'),
|
|
|
|
_('Gender'),
|
|
|
|
_('Birth Date'),
|
|
|
|
_('Birth Place'),
|
|
|
|
_('Death Date'),
|
|
|
|
_('Death Place'),
|
|
|
|
_('Spouse'),
|
|
|
|
_('Last Changed'),
|
|
|
|
]
|
|
|
|
|
|
|
|
ADD_MSG = _("Add a new person")
|
|
|
|
EDIT_MSG = _("Edit the selected person")
|
|
|
|
DEL_MSG = _("Delete the selected person")
|
|
|
|
FILTER_TYPE = "Person"
|
|
|
|
QR_CATEGORY = CATEGORY_QR_PERSON
|
2005-08-09 10:11:20 +05:30
|
|
|
|
2010-01-11 00:49:33 +05:30
|
|
|
def __init__(self, dbstate, uistate, nav_group=0):
|
2007-01-09 10:02:07 +05:30
|
|
|
"""
|
2009-11-07 18:34:45 +05:30
|
|
|
Create the Person View
|
2007-01-09 10:02:07 +05:30
|
|
|
"""
|
2009-11-07 18:34:45 +05:30
|
|
|
signal_map = {
|
|
|
|
'person-add' : self.row_add,
|
|
|
|
'person-update' : self.row_update,
|
|
|
|
'person-delete' : self.row_delete,
|
|
|
|
'person-rebuild' : self.object_build,
|
|
|
|
}
|
2006-05-02 09:20:46 +05:30
|
|
|
|
2009-11-07 18:34:45 +05:30
|
|
|
ListView.__init__(
|
|
|
|
self, _('People'), dbstate, uistate,
|
|
|
|
PersonView.COLUMN_NAMES, len(PersonView.COLUMN_NAMES),
|
2009-11-08 22:11:49 +05:30
|
|
|
PeopleModel,
|
2009-11-07 18:34:45 +05:30
|
|
|
signal_map, dbstate.db.get_bookmarks(),
|
2010-01-11 00:49:33 +05:30
|
|
|
Bookmarks.PersonBookmarks, nav_group,
|
2009-11-07 18:34:45 +05:30
|
|
|
multiple=True,
|
|
|
|
filter_class=PersonSidebarFilter,
|
|
|
|
markup=True)
|
|
|
|
|
2006-05-02 09:20:46 +05:30
|
|
|
self.func_list = {
|
2009-11-07 18:34:45 +05:30
|
|
|
'<CONTROL>J' : self.jump,
|
|
|
|
'<CONTROL>BackSpace' : self.key_delete,
|
2006-05-02 09:20:46 +05:30
|
|
|
}
|
2006-07-11 03:16:46 +05:30
|
|
|
|
2009-11-07 18:34:45 +05:30
|
|
|
config.connect("interface.filter", self.filter_toggle)
|
2010-01-09 21:46:52 +05:30
|
|
|
|
|
|
|
def type_list(self):
|
|
|
|
"""
|
|
|
|
set the listtype, this governs eg keybinding
|
|
|
|
"""
|
|
|
|
return LISTTREE
|
|
|
|
|
2009-11-07 18:34:45 +05:30
|
|
|
def column_ord_setfunc(self, clist):
|
|
|
|
self.dbstate.db.set_person_column_order(clist)
|
2006-12-19 07:59:47 +05:30
|
|
|
|
2009-11-07 18:34:45 +05:30
|
|
|
def navigation_type(self):
|
2010-01-11 00:49:33 +05:30
|
|
|
return 'Person'
|
2006-12-19 07:59:47 +05:30
|
|
|
|
2009-11-07 18:34:45 +05:30
|
|
|
def get_bookmarks(self):
|
|
|
|
"""
|
|
|
|
Return the bookmark object
|
|
|
|
"""
|
|
|
|
return self.dbstate.db.get_bookmarks()
|
2006-12-19 07:59:47 +05:30
|
|
|
|
2009-11-07 18:34:45 +05:30
|
|
|
def drag_info(self):
|
|
|
|
"""
|
|
|
|
Specify the drag type for a single selection
|
|
|
|
"""
|
|
|
|
return DdTargets.PERSON_LINK
|
2005-08-11 22:49:03 +05:30
|
|
|
|
2009-11-07 18:34:45 +05:30
|
|
|
def drag_list_info(self):
|
|
|
|
"""
|
|
|
|
Specify the drag type for a multiple selected rows
|
|
|
|
"""
|
|
|
|
return DdTargets.PERSON_LINK_LIST
|
2006-03-06 05:09:20 +05:30
|
|
|
|
2009-11-07 18:34:45 +05:30
|
|
|
def column_order(self):
|
|
|
|
"""
|
|
|
|
returns a tuple indicating the column order
|
|
|
|
"""
|
|
|
|
return self.dbstate.db.get_person_column_order()
|
2006-03-06 05:09:20 +05:30
|
|
|
|
2009-11-07 18:34:45 +05:30
|
|
|
def exact_search(self):
|
|
|
|
"""
|
|
|
|
Returns a tuple indicating columns requiring an exact search
|
|
|
|
"""
|
|
|
|
return (2,) # Gender ('female' contains the string 'male')
|
2005-08-11 05:23:24 +05:30
|
|
|
|
2005-08-09 10:11:20 +05:30
|
|
|
def get_stock(self):
|
2005-08-11 05:23:24 +05:30
|
|
|
"""
|
2009-11-07 18:34:45 +05:30
|
|
|
Use the gramps-person stock icon
|
2005-08-11 05:23:24 +05:30
|
|
|
"""
|
2005-08-09 10:11:20 +05:30
|
|
|
return 'gramps-person'
|
2009-11-14 22:47:34 +05:30
|
|
|
|
|
|
|
def get_viewtype_stock(self):
|
|
|
|
"""Type of view in category
|
|
|
|
"""
|
|
|
|
return 'gramps-tree-group'
|
2005-08-09 10:11:20 +05:30
|
|
|
|
|
|
|
def ui_definition(self):
|
2005-08-11 05:23:24 +05:30
|
|
|
"""
|
2009-11-07 18:34:45 +05:30
|
|
|
Defines the UI string for UIManager
|
2005-08-11 05:23:24 +05:30
|
|
|
"""
|
2005-08-09 10:11:20 +05:30
|
|
|
return '''<ui>
|
|
|
|
<menubar name="MenuBar">
|
2007-02-06 10:49:16 +05:30
|
|
|
<menu action="FileMenu">
|
|
|
|
<placeholder name="LocalExport">
|
|
|
|
<menuitem action="ExportTab"/>
|
|
|
|
</placeholder>
|
|
|
|
</menu>
|
2006-04-27 03:18:13 +05:30
|
|
|
<menu action="BookMenu">
|
|
|
|
<placeholder name="AddEditBook">
|
|
|
|
<menuitem action="AddBook"/>
|
|
|
|
<menuitem action="EditBook"/>
|
|
|
|
</placeholder>
|
|
|
|
</menu>
|
2005-08-09 10:11:20 +05:30
|
|
|
<menu action="GoMenu">
|
|
|
|
<placeholder name="CommonGo">
|
|
|
|
<menuitem action="Back"/>
|
|
|
|
<menuitem action="Forward"/>
|
|
|
|
<separator/>
|
|
|
|
<menuitem action="HomePerson"/>
|
|
|
|
<separator/>
|
|
|
|
</placeholder>
|
|
|
|
</menu>
|
|
|
|
<menu action="EditMenu">
|
|
|
|
<placeholder name="CommonEdit">
|
|
|
|
<menuitem action="Add"/>
|
|
|
|
<menuitem action="Edit"/>
|
|
|
|
<menuitem action="Remove"/>
|
|
|
|
</placeholder>
|
2006-02-10 06:40:52 +05:30
|
|
|
<menuitem action="SetActive"/>
|
2006-03-06 05:09:20 +05:30
|
|
|
<menuitem action="ColumnEdit"/>
|
2006-06-01 09:06:59 +05:30
|
|
|
<menuitem action="FilterEdit"/>
|
2006-05-25 09:38:05 +05:30
|
|
|
<placeholder name="Merge">
|
|
|
|
<menuitem action="CmpMerge"/>
|
|
|
|
<menuitem action="FastMerge"/>
|
|
|
|
</placeholder>
|
2005-08-09 10:11:20 +05:30
|
|
|
</menu>
|
|
|
|
</menubar>
|
|
|
|
<toolbar name="ToolBar">
|
|
|
|
<placeholder name="CommonNavigation">
|
|
|
|
<toolitem action="Back"/>
|
|
|
|
<toolitem action="Forward"/>
|
|
|
|
<toolitem action="HomePerson"/>
|
|
|
|
</placeholder>
|
|
|
|
<placeholder name="CommonEdit">
|
|
|
|
<toolitem action="Add"/>
|
|
|
|
<toolitem action="Edit"/>
|
|
|
|
<toolitem action="Remove"/>
|
|
|
|
</placeholder>
|
|
|
|
</toolbar>
|
2005-08-12 08:05:27 +05:30
|
|
|
<popup name="Popup">
|
|
|
|
<menuitem action="Back"/>
|
|
|
|
<menuitem action="Forward"/>
|
|
|
|
<menuitem action="HomePerson"/>
|
|
|
|
<separator/>
|
2006-05-02 02:58:31 +05:30
|
|
|
<menuitem action="OpenAllNodes"/>
|
|
|
|
<menuitem action="CloseAllNodes"/>
|
|
|
|
<separator/>
|
2005-08-12 08:05:27 +05:30
|
|
|
<menuitem action="Add"/>
|
|
|
|
<menuitem action="Edit"/>
|
|
|
|
<menuitem action="Remove"/>
|
2007-05-07 09:09:46 +05:30
|
|
|
<separator/>
|
2007-08-30 01:07:58 +05:30
|
|
|
<menu name="QuickReport" action="QuickReport">
|
|
|
|
<menuitem action="Dummy"/>
|
2007-07-27 09:21:54 +05:30
|
|
|
</menu>
|
2005-08-12 08:05:27 +05:30
|
|
|
</popup>
|
2005-08-09 10:11:20 +05:30
|
|
|
</ui>'''
|
|
|
|
|
2009-11-07 18:34:45 +05:30
|
|
|
def get_handle_from_gramps_id(self, gid):
|
|
|
|
obj = self.dbstate.db.get_person_from_gramps_id(gid)
|
|
|
|
if obj:
|
|
|
|
return obj.get_handle()
|
2007-01-21 04:19:09 +05:30
|
|
|
else:
|
2009-11-07 18:34:45 +05:30
|
|
|
return None
|
2005-08-11 05:23:24 +05:30
|
|
|
|
2009-11-07 18:34:45 +05:30
|
|
|
def _column_editor(self, obj):
|
2005-08-11 05:23:24 +05:30
|
|
|
"""
|
2009-11-07 18:34:45 +05:30
|
|
|
returns a tuple indicating the column order
|
2005-08-11 05:23:24 +05:30
|
|
|
"""
|
2009-11-07 18:34:45 +05:30
|
|
|
import ColumnOrder
|
2006-05-10 09:32:45 +05:30
|
|
|
|
2009-11-07 18:34:45 +05:30
|
|
|
ColumnOrder.ColumnOrder(
|
|
|
|
_('Select Person Columns'),
|
|
|
|
self.uistate,
|
|
|
|
self.dbstate.db.get_person_column_order(),
|
|
|
|
PersonView.COLUMN_NAMES,
|
|
|
|
self.set_column_order)
|
2005-08-19 18:14:44 +05:30
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
def add(self, obj):
|
2007-10-08 22:11:39 +05:30
|
|
|
person = gen.lib.Person()
|
2006-11-06 06:11:13 +05:30
|
|
|
|
|
|
|
# attempt to get the current surname
|
2009-11-07 18:34:45 +05:30
|
|
|
(model, pathlist) = self.selection.get_selected_rows()
|
2006-11-06 06:11:13 +05:30
|
|
|
name = u""
|
2009-11-07 18:34:45 +05:30
|
|
|
if len(pathlist) == 1:
|
|
|
|
path = pathlist[0]
|
2006-11-06 06:11:13 +05:30
|
|
|
if len(path) == 1:
|
2010-01-09 16:40:32 +05:30
|
|
|
name = model.on_get_iter(path).name
|
2006-11-06 06:11:13 +05:30
|
|
|
else:
|
2009-11-07 18:34:45 +05:30
|
|
|
node = model.on_get_iter(path)
|
2010-01-09 16:40:32 +05:30
|
|
|
name = model.on_iter_parent(node).name
|
2009-11-07 18:34:45 +05:30
|
|
|
|
2006-03-01 10:38:11 +05:30
|
|
|
try:
|
2006-11-06 06:11:13 +05:30
|
|
|
person.get_primary_name().set_surname(name)
|
2006-03-04 10:54:16 +05:30
|
|
|
EditPerson(self.dbstate, self.uistate, [], person)
|
2006-03-01 10:38:11 +05:30
|
|
|
except Errors.WindowActiveError:
|
|
|
|
pass
|
2005-08-09 10:11:20 +05:30
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
def edit(self, obj):
|
2009-11-07 18:34:45 +05:30
|
|
|
for handle in self.selected_handles():
|
|
|
|
person = self.dbstate.db.get_person_from_handle(handle)
|
2006-03-01 10:38:11 +05:30
|
|
|
try:
|
2006-05-12 04:35:12 +05:30
|
|
|
EditPerson(self.dbstate, self.uistate, [], person)
|
2006-03-01 10:38:11 +05:30
|
|
|
except Errors.WindowActiveError:
|
|
|
|
pass
|
2005-08-09 10:11:20 +05:30
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
def remove(self, obj):
|
2009-11-07 18:34:45 +05:30
|
|
|
for sel in self.selected_handles():
|
2007-01-09 10:02:07 +05:30
|
|
|
person = self.dbstate.db.get_person_from_handle(sel)
|
|
|
|
self.active_person = person
|
2007-06-28 11:11:40 +05:30
|
|
|
name = name_displayer.display(person)
|
2005-08-09 10:11:20 +05:30
|
|
|
|
|
|
|
msg = _('Deleting the person will remove the person '
|
|
|
|
'from the database.')
|
2007-01-09 10:02:07 +05:30
|
|
|
msg = "%s %s" % (msg, Utils.data_recover_msg)
|
2008-02-18 15:39:50 +05:30
|
|
|
QuestionDialog(_('Delete %s?') % name,
|
2007-10-07 08:49:35 +05:30
|
|
|
msg,
|
|
|
|
_('_Delete Person'),
|
2005-08-09 10:11:20 +05:30
|
|
|
self.delete_person_response)
|
|
|
|
|
|
|
|
def delete_person_response(self):
|
2007-01-31 10:20:12 +05:30
|
|
|
"""
|
|
|
|
Deletes the person from the database.
|
|
|
|
"""
|
|
|
|
# set the busy cursor, so the user knows that we are working
|
|
|
|
self.uistate.set_busy_cursor(True)
|
|
|
|
|
|
|
|
# create the transaction
|
2005-08-11 05:23:24 +05:30
|
|
|
trans = self.dbstate.db.transaction_begin()
|
2005-08-09 10:11:20 +05:30
|
|
|
|
2007-01-31 10:20:12 +05:30
|
|
|
# create name to save
|
|
|
|
person = self.active_person
|
2007-06-28 11:11:40 +05:30
|
|
|
active_name = _("Delete Person (%s)") % name_displayer.display(person)
|
2007-01-20 22:51:45 +05:30
|
|
|
|
2007-01-31 10:20:12 +05:30
|
|
|
# delete the person from the database
|
2009-12-21 09:48:31 +05:30
|
|
|
self.dbstate.db.delete_person_from_database(person, trans)
|
2006-11-11 02:57:08 +05:30
|
|
|
|
2007-01-31 10:20:12 +05:30
|
|
|
# remove the person from the list
|
2005-08-09 10:11:20 +05:30
|
|
|
self.remove_from_person_list(person)
|
|
|
|
|
2007-01-31 10:20:12 +05:30
|
|
|
# commit the transaction
|
|
|
|
self.dbstate.db.transaction_commit(trans, active_name)
|
|
|
|
|
|
|
|
# select the previously active person, turn off the busy cursor
|
2010-01-11 00:49:33 +05:30
|
|
|
history = self.uistate.get_history(self.navigation_type(),
|
2010-01-12 04:07:18 +05:30
|
|
|
self.navigation_group())
|
|
|
|
history.back()
|
2007-01-31 10:20:12 +05:30
|
|
|
self.uistate.set_busy_cursor(False)
|
2005-08-09 10:11:20 +05:30
|
|
|
|
2007-01-09 10:02:07 +05:30
|
|
|
def remove_from_person_list(self, person):
|
2005-08-09 10:11:20 +05:30
|
|
|
"""Remove the selected person from the list. A person object is
|
|
|
|
expected, not an ID"""
|
2010-01-09 16:40:32 +05:30
|
|
|
node = self.model.get_node(person.get_handle())
|
|
|
|
path = self.model.on_get_path(node)
|
2007-01-09 10:02:07 +05:30
|
|
|
(col, row) = path
|
2005-08-09 10:11:20 +05:30
|
|
|
if row > 0:
|
2007-01-09 10:02:07 +05:30
|
|
|
self.selection.select_path((col, row-1))
|
2005-08-20 03:40:35 +05:30
|
|
|
elif row == 0 and self.model.on_get_iter(path):
|
|
|
|
self.selection.select_path(path)
|
2005-08-09 10:11:20 +05:30
|
|
|
|
2009-11-07 18:34:45 +05:30
|
|
|
def dummy_report(self, obj):
|
|
|
|
""" For the xml UI definition of popup to work, the submenu
|
|
|
|
Quick Report must have an entry in the xml
|
|
|
|
As this submenu will be dynamically built, we offer a dummy action
|
2008-01-17 14:44:40 +05:30
|
|
|
"""
|
2009-11-07 18:34:45 +05:30
|
|
|
pass
|
|
|
|
|
|
|
|
def define_actions(self):
|
2008-01-17 14:44:40 +05:30
|
|
|
"""
|
2009-11-07 18:34:45 +05:30
|
|
|
Required define_actions function for PageView. Builds the action
|
|
|
|
group information required. We extend beyond the normal here,
|
|
|
|
since we want to have more than one action group for the PersonView.
|
|
|
|
Most PageViews really won't care about this.
|
2007-02-06 10:49:16 +05:30
|
|
|
|
2009-11-07 18:34:45 +05:30
|
|
|
Special action groups for Forward and Back are created to allow the
|
|
|
|
handling of navigation buttons. Forward and Back allow the user to
|
|
|
|
advance or retreat throughout the history, and we want to have these
|
|
|
|
be able to toggle these when you are at the end of the history or
|
|
|
|
at the beginning of the history.
|
2007-02-06 10:49:16 +05:30
|
|
|
"""
|
2009-11-07 18:34:45 +05:30
|
|
|
|
|
|
|
ListView.define_actions(self)
|
|
|
|
|
|
|
|
self.all_action = gtk.ActionGroup(self.title + "/PersonAll")
|
|
|
|
self.edit_action = gtk.ActionGroup(self.title + "/PersonEdit")
|
|
|
|
|
|
|
|
self.all_action.add_actions([
|
|
|
|
('FilterEdit', None, _('Person Filter Editor'), None, None,
|
|
|
|
self.filter_editor),
|
|
|
|
('OpenAllNodes', None, _("Expand all Nodes"), None, None,
|
|
|
|
self.open_all_nodes),
|
|
|
|
('Edit', gtk.STOCK_EDIT, _("action|_Edit..."), "<control>Return",
|
|
|
|
_("Edit the selected person"), self.edit),
|
|
|
|
('CloseAllNodes', None, _("Collapse all Nodes"), None, None,
|
|
|
|
self.close_all_nodes),
|
|
|
|
('QuickReport', None, _("Quick View"), None, None, None),
|
|
|
|
('Dummy', None, ' ', None, None, self.dummy_report),
|
|
|
|
])
|
|
|
|
|
|
|
|
self.edit_action.add_actions(
|
|
|
|
[
|
|
|
|
('Add', gtk.STOCK_ADD, _("_Add..."), "<control>Insert",
|
|
|
|
_("Add a new person"), self.add),
|
|
|
|
('Remove', gtk.STOCK_REMOVE, _("_Remove"), "<control>Delete",
|
|
|
|
_("Remove the Selected Person"), self.remove),
|
|
|
|
('ColumnEdit', gtk.STOCK_PROPERTIES, _('_Column Editor...'), None,
|
|
|
|
None, self._column_editor),
|
|
|
|
('CmpMerge', None, _('Compare and _Merge...'), None, None,
|
|
|
|
self.cmp_merge),
|
|
|
|
('FastMerge', None, _('_Fast Merge...'), None, None,
|
|
|
|
self.fast_merge),
|
|
|
|
('ExportTab', None, _('Export View...'), None, None, self.export),
|
|
|
|
])
|
|
|
|
|
|
|
|
self._add_action_group(self.edit_action)
|
|
|
|
self._add_action_group(self.all_action)
|
|
|
|
|
|
|
|
def enable_action_group(self, obj):
|
|
|
|
ListView.enable_action_group(self, obj)
|
|
|
|
self.all_action.set_visible(True)
|
|
|
|
self.edit_action.set_visible(False)
|
|
|
|
self.edit_action.set_sensitive(not self.dbstate.db.readonly)
|
2008-02-19 01:37:09 +05:30
|
|
|
|
2009-11-07 18:34:45 +05:30
|
|
|
def disable_action_group(self):
|
|
|
|
ListView.disable_action_group(self)
|
|
|
|
|
|
|
|
self.all_action.set_visible(False)
|
|
|
|
self.edit_action.set_visible(False)
|
|
|
|
|
|
|
|
def cmp_merge(self, obj):
|
2010-01-23 21:01:50 +05:30
|
|
|
mlist = self.selected_handles()
|
2009-11-07 18:34:45 +05:30
|
|
|
|
|
|
|
if len(mlist) != 2:
|
|
|
|
ErrorDialog(
|
|
|
|
_("Cannot merge people"),
|
|
|
|
_("Exactly two people must be selected to perform a merge. "
|
|
|
|
"A second person can be selected by holding down the "
|
|
|
|
"control key while clicking on the desired person."))
|
2008-02-19 01:37:09 +05:30
|
|
|
else:
|
2009-11-07 18:34:45 +05:30
|
|
|
import Merge
|
2010-01-23 21:01:50 +05:30
|
|
|
person1 = self.dbstate.db.get_person_from_handle(mlist[0])
|
|
|
|
person2 = self.dbstate.db.get_person_from_handle(mlist[1])
|
2009-11-07 18:34:45 +05:30
|
|
|
if person1 and person2:
|
|
|
|
Merge.PersonCompare(self.dbstate, self.uistate, person1,
|
|
|
|
person2, self.build_tree)
|
|
|
|
else:
|
|
|
|
ErrorDialog(
|
|
|
|
_("Cannot merge people"),
|
|
|
|
_("Exactly two people must be selected to perform a "
|
|
|
|
"merge. A second person can be selected by holding "
|
|
|
|
"down the control key while clicking on the desired "
|
|
|
|
"person."))
|
2007-07-27 09:21:54 +05:30
|
|
|
|
2009-11-07 18:34:45 +05:30
|
|
|
def fast_merge(self, obj):
|
2010-01-23 21:01:50 +05:30
|
|
|
mlist = self.selected_handles()
|
2009-11-07 18:34:45 +05:30
|
|
|
|
|
|
|
if len(mlist) != 2:
|
|
|
|
ErrorDialog(
|
|
|
|
_("Cannot merge people"),
|
|
|
|
_("Exactly two people must be selected to perform a merge. "
|
|
|
|
"A second person can be selected by holding down the "
|
|
|
|
"control key while clicking on the desired person."))
|
|
|
|
else:
|
|
|
|
import Merge
|
|
|
|
|
2010-01-23 21:01:50 +05:30
|
|
|
person1 = self.dbstate.db.get_person_from_handle(mlist[0])
|
|
|
|
person2 = self.dbstate.db.get_person_from_handle(mlist[1])
|
2009-11-07 18:34:45 +05:30
|
|
|
if person1 and person2:
|
|
|
|
Merge.MergePeopleUI(self.dbstate, self.uistate, person1,
|
|
|
|
person2, self.build_tree)
|
|
|
|
else:
|
|
|
|
ErrorDialog(
|
|
|
|
_("Cannot merge people"),
|
|
|
|
_("Exactly two people must be selected to perform a merge. "
|
|
|
|
"A second person can be selected by holding down the "
|
|
|
|
"control key while clicking on the desired person."))
|