2004-08-29 01:19:34 +05:30
|
|
|
#
|
2002-10-20 19:55:16 +05:30
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2005-01-09 04:05:04 +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-10-13 07:25:56 +05:30
|
|
|
# $Id$
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Standard python modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import os
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# internationalization
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2003-08-17 07:44:33 +05:30
|
|
|
from gettext import gettext as _
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GTK/Gnome modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import gobject
|
|
|
|
import gtk
|
2003-02-13 10:45:39 +05:30
|
|
|
import gnome
|
2002-10-20 19:55:16 +05:30
|
|
|
import gnome.ui
|
|
|
|
import gtk.glade
|
2003-10-06 07:12:55 +05:30
|
|
|
import gtk.gdk
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gramps modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2003-01-12 10:52:21 +05:30
|
|
|
import RelLib
|
2004-07-31 00:26:49 +05:30
|
|
|
import GrampsBSDDB
|
2003-01-12 10:52:21 +05:30
|
|
|
import PedView
|
|
|
|
import MediaView
|
|
|
|
import PlaceView
|
|
|
|
import FamilyView
|
|
|
|
import SourceView
|
2003-10-05 01:32:38 +05:30
|
|
|
import PeopleView
|
2004-04-28 09:36:25 +05:30
|
|
|
import GenericFilter
|
2002-10-20 19:55:16 +05:30
|
|
|
import DisplayTrace
|
|
|
|
import const
|
|
|
|
import Plugins
|
2005-01-05 10:32:19 +05:30
|
|
|
import PluginMgr
|
2002-10-20 19:55:16 +05:30
|
|
|
import Utils
|
|
|
|
import Bookmarks
|
2005-01-06 22:58:31 +05:30
|
|
|
import GrampsKeys
|
2002-10-20 19:55:16 +05:30
|
|
|
import GrampsCfg
|
|
|
|
import EditPerson
|
2004-04-10 09:08:48 +05:30
|
|
|
import DbPrompter
|
2004-05-18 12:30:34 +05:30
|
|
|
import TipOfDay
|
2004-06-21 10:40:27 +05:30
|
|
|
import ArgHandler
|
2004-07-09 23:49:47 +05:30
|
|
|
import Exporter
|
2004-11-19 09:29:53 +05:30
|
|
|
import RelImage
|
2004-11-29 10:45:41 +05:30
|
|
|
import RecentFiles
|
2005-01-01 09:57:15 +05:30
|
|
|
import NameDisplay
|
2004-04-10 09:08:48 +05:30
|
|
|
|
2004-05-08 10:18:59 +05:30
|
|
|
from QuestionDialog import *
|
|
|
|
|
2004-12-20 04:25:41 +05:30
|
|
|
from bsddb import db
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2002-12-29 11:14:35 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Constants
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2003-03-12 08:32:08 +05:30
|
|
|
_HOMEPAGE = "http://gramps.sourceforge.net"
|
|
|
|
_MAILLIST = "http://sourceforge.net/mail/?group_id=25770"
|
2003-01-10 19:22:32 +05:30
|
|
|
_BUGREPORT = "http://sourceforge.net/tracker/?group_id=25770&atid=385137"
|
|
|
|
|
2003-08-26 09:15:41 +05:30
|
|
|
PERSON_VIEW = 0
|
|
|
|
FAMILY_VIEW1 = 1
|
|
|
|
FAMILY_VIEW2 = 2
|
|
|
|
PEDIGREE_VIEW = 3
|
|
|
|
SOURCE_VIEW = 4
|
|
|
|
PLACE_VIEW = 5
|
|
|
|
MEDIA_VIEW = 6
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Main GRAMPS class
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
class Gramps:
|
|
|
|
|
2003-05-17 09:44:13 +05:30
|
|
|
def __init__(self,args):
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-06-23 10:24:33 +05:30
|
|
|
try:
|
|
|
|
self.program = gnome.program_init('gramps',const.version,
|
|
|
|
gnome.libgnome_module_info_get(),
|
|
|
|
args, const.popt_table)
|
|
|
|
except:
|
|
|
|
self.program = gnome.program_init('gramps',const.version)
|
2003-03-31 07:03:40 +05:30
|
|
|
self.program.set_property('app-libdir','%s/lib' % const.prefixdir)
|
|
|
|
self.program.set_property('app-datadir','%s/share/gramps' % const.prefixdir)
|
|
|
|
self.program.set_property('app-sysconfdir','%s/etc' % const.prefixdir)
|
|
|
|
self.program.set_property('app-prefix', const.prefixdir)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.parents_index = 0
|
|
|
|
self.active_person = None
|
|
|
|
self.bookmarks = None
|
|
|
|
self.c_details = 6
|
2003-05-21 23:36:41 +05:30
|
|
|
self.cl = 0
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
2003-08-14 09:21:19 +05:30
|
|
|
self.history = []
|
2003-08-17 21:37:06 +05:30
|
|
|
self.mhistory = []
|
2003-08-14 09:21:19 +05:30
|
|
|
self.hindex = -1
|
2003-08-17 09:31:52 +05:30
|
|
|
|
2004-07-31 00:26:49 +05:30
|
|
|
self.db = GrampsBSDDB.GrampsBSDDB()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-07-15 08:24:04 +05:30
|
|
|
GrampsCfg.loadConfig()
|
2004-06-10 05:29:03 +05:30
|
|
|
|
2005-01-06 22:58:31 +05:30
|
|
|
if GrampsKeys.get_betawarn() == 0:
|
2004-06-10 05:29:03 +05:30
|
|
|
WarningDialog(_("Use at your own risk"),
|
|
|
|
_("This is an unstable development version of GRAMPS. "
|
|
|
|
"It is intended as a technology preview. Do not trust your "
|
|
|
|
"family database to this development version. This version may "
|
|
|
|
"contain bugs which could corrupt your database."))
|
2005-01-06 22:58:31 +05:30
|
|
|
GrampsKeys.save_betawarn(1)
|
|
|
|
GrampsKeys.sync()
|
2004-06-10 05:29:03 +05:30
|
|
|
|
2005-01-05 10:32:19 +05:30
|
|
|
self.RelClass = PluginMgr.relationship_class
|
2004-02-16 02:58:31 +05:30
|
|
|
self.relationship = self.RelClass(self.db)
|
2004-05-28 09:34:04 +05:30
|
|
|
self.gtop = gtk.glade.XML(const.gladeFile, "gramps", "gramps")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.init_interface()
|
|
|
|
|
2004-06-21 10:40:27 +05:30
|
|
|
ArgHandler.ArgHandler(self,args)
|
|
|
|
|
2004-06-22 04:52:55 +05:30
|
|
|
# Don't show main window until ArgHandler is done.
|
2004-06-22 04:54:51 +05:30
|
|
|
# This prevents a window from annoyingly popping up when
|
|
|
|
# the command line args are sufficient to operate without it.
|
2005-01-06 22:58:31 +05:30
|
|
|
GrampsKeys.client.notify_add("/apps/gramps/researcher",
|
2004-08-07 10:46:57 +05:30
|
|
|
self.researcher_key_update)
|
2005-01-06 22:58:31 +05:30
|
|
|
GrampsKeys.client.notify_add("/apps/gramps/interface/statusbar",
|
2004-08-07 10:46:57 +05:30
|
|
|
self.statusbar_key_update)
|
2005-01-06 22:58:31 +05:30
|
|
|
GrampsKeys.client.notify_add("/apps/gramps/interface/toolbar",
|
2004-08-07 10:46:57 +05:30
|
|
|
self.toolbar_key_update)
|
2005-01-06 22:58:31 +05:30
|
|
|
GrampsKeys.client.notify_add("/apps/gramps/interface/toolbar-on",
|
2004-08-07 10:46:57 +05:30
|
|
|
self.toolbar_on_key_update)
|
2005-01-06 22:58:31 +05:30
|
|
|
GrampsKeys.client.notify_add("/apps/gramps/interface/filter",
|
2004-08-07 10:46:57 +05:30
|
|
|
self.filter_key_update)
|
2005-01-06 22:58:31 +05:30
|
|
|
GrampsKeys.client.notify_add("/apps/gramps/interface/view",
|
2004-08-07 10:46:57 +05:30
|
|
|
self.sidebar_key_update)
|
2005-01-06 22:58:31 +05:30
|
|
|
GrampsKeys.client.notify_add("/apps/gramps/interface/familyview",
|
2004-08-07 10:46:57 +05:30
|
|
|
self.familyview_key_update)
|
2005-01-06 22:58:31 +05:30
|
|
|
GrampsKeys.client.notify_add("/apps/gramps/preferences/name-format",
|
2004-08-07 10:46:57 +05:30
|
|
|
self.familyview_key_update)
|
2005-01-06 22:58:31 +05:30
|
|
|
GrampsKeys.client.notify_add("/apps/gramps/preferences/date-format",
|
2004-08-07 10:46:57 +05:30
|
|
|
self.date_format_key_update)
|
2004-06-22 04:54:51 +05:30
|
|
|
self.topWindow.show()
|
2004-08-29 11:15:40 +05:30
|
|
|
|
2005-01-06 22:58:31 +05:30
|
|
|
if GrampsKeys.get_usetips():
|
2005-01-26 02:55:15 +05:30
|
|
|
TipOfDay.TipOfDay(self)
|
2004-05-18 12:30:34 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
self.db.set_researcher(GrampsCfg.get_researcher())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-07-20 07:57:55 +05:30
|
|
|
def date_format_key_update(self,client,cnxn_id,entry,data):
|
|
|
|
GrampsCfg.set_calendar_date_format()
|
|
|
|
self.familyview_key_update(client,cnxn_id,entry,data)
|
|
|
|
|
|
|
|
def researcher_key_update(self,client,cnxn_id,entry,data):
|
2005-01-06 22:58:31 +05:30
|
|
|
self.db.set_person_id_prefix(GrampsKeys.get_person_id_prefix())
|
|
|
|
self.db.set_family_id_prefix(GrampsKeys.get_family_id_prefix())
|
|
|
|
self.db.set_source_id_prefix(GrampsKeys.get_source_id_prefix())
|
|
|
|
self.db.set_object_id_prefix(GrampsKeys.get_object_id_prefix())
|
|
|
|
self.db.set_place_id_prefix(GrampsKeys.get_place_id_prefix())
|
|
|
|
self.db.set_event_id_prefix(GrampsKeys.get_event_id_prefix())
|
2004-07-15 08:24:04 +05:30
|
|
|
|
2004-07-20 07:57:55 +05:30
|
|
|
def statusbar_key_update(self,client,cnxn_id,entry,data):
|
2003-10-16 22:13:07 +05:30
|
|
|
self.modify_statusbar()
|
2004-07-20 07:57:55 +05:30
|
|
|
|
|
|
|
def toolbar_key_update(self,client,cnxn_id,entry,data):
|
2005-01-09 04:05:04 +05:30
|
|
|
the_style = GrampsKeys.get_toolbar()
|
|
|
|
if the_style == -1:
|
|
|
|
self.toolbar.unset_style()
|
|
|
|
else:
|
|
|
|
self.toolbar.set_style(the_style)
|
2004-07-20 07:57:55 +05:30
|
|
|
|
|
|
|
def toolbar_on_key_update(self,client,cnxn_id,entry,data):
|
2005-01-06 22:58:31 +05:30
|
|
|
is_on = GrampsKeys.get_toolbar_on()
|
2004-07-20 07:57:55 +05:30
|
|
|
self.toolbar_btn.set_active(is_on)
|
|
|
|
self.enable_toolbar(is_on)
|
|
|
|
|
|
|
|
def filter_key_update(self,client,cnxn_id,entry,data):
|
2005-01-06 22:58:31 +05:30
|
|
|
is_on = GrampsKeys.get_filter()
|
2004-07-20 07:57:55 +05:30
|
|
|
self.filter_btn.set_active(is_on)
|
|
|
|
self.enable_filter(is_on)
|
|
|
|
|
|
|
|
def sidebar_key_update(self,client,cnxn_id,entry,data):
|
2005-01-06 22:58:31 +05:30
|
|
|
is_on = GrampsKeys.get_view()
|
2004-07-20 07:57:55 +05:30
|
|
|
self.sidebar_btn.set_active(is_on)
|
|
|
|
self.enable_sidebar(is_on)
|
|
|
|
|
|
|
|
def familyview_key_update(self,client,cnxn_id,entry,data):
|
2003-08-27 09:16:27 +05:30
|
|
|
self.family_view.init_interface()
|
2003-11-14 10:42:38 +05:30
|
|
|
self.update_display(1)
|
|
|
|
self.goto_active_person()
|
2003-10-16 10:12:21 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def init_interface(self):
|
|
|
|
"""Initializes the GLADE interface, and gets references to the
|
|
|
|
widgets that it will need.
|
|
|
|
"""
|
2003-07-27 09:20:57 +05:30
|
|
|
|
2003-03-14 11:16:02 +05:30
|
|
|
self.topWindow = self.gtop.get_widget("gramps")
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2002-11-17 04:52:33 +05:30
|
|
|
self.report_button = self.gtop.get_widget("reports")
|
|
|
|
self.tool_button = self.gtop.get_widget("tools")
|
2002-11-17 10:36:43 +05:30
|
|
|
self.remove_button = self.gtop.get_widget("removebtn")
|
|
|
|
self.edit_button = self.gtop.get_widget("editbtn")
|
* src/gramps.glade: Remove hot keys from toolbar buttons.
Add editing items under Edit menu.
* src/gramps_main.py: Enable/disable new menu items.
* NEWS, configure, configure.in, gramps.spec, doc/gramps.1,
doc/gramps-manual/C/gramps-manual-C.omf,
doc/gramps-manual/C/gramps-manual.xml: merge with 0.9.5 branch.
* Version 0.9.5: the "Fix me up" release.
* src/gramps_main.py (delete_person_response, merge_update):
Add remove_from_history and redraw_histmenu() calls before deleting
the person.
* doc/gramps.1.in, doc/gramps.1, doc/gramps-manual/C/gramps-manual.xml,
doc/gramps-manual/C/gramps-manual.omf, gramps.spec: New version.
* configure.in: Fix version and release numbers for 0.9.5-1.
* NEWS: Update for a 0.9.5 release.
svn: r2222
2003-10-10 09:26:19 +05:30
|
|
|
self.remove_item = self.gtop.get_widget("remove_item")
|
|
|
|
self.edit_item = self.gtop.get_widget("edit_item")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.sidebar = self.gtop.get_widget('side_event')
|
|
|
|
self.filterbar = self.gtop.get_widget('filterbar')
|
2002-11-17 04:52:33 +05:30
|
|
|
|
|
|
|
self.tool_button.set_sensitive(0)
|
|
|
|
self.report_button.set_sensitive(0)
|
2002-11-17 10:36:43 +05:30
|
|
|
self.remove_button.set_sensitive(0)
|
|
|
|
self.edit_button.set_sensitive(0)
|
* src/gramps.glade: Remove hot keys from toolbar buttons.
Add editing items under Edit menu.
* src/gramps_main.py: Enable/disable new menu items.
* NEWS, configure, configure.in, gramps.spec, doc/gramps.1,
doc/gramps-manual/C/gramps-manual-C.omf,
doc/gramps-manual/C/gramps-manual.xml: merge with 0.9.5 branch.
* Version 0.9.5: the "Fix me up" release.
* src/gramps_main.py (delete_person_response, merge_update):
Add remove_from_history and redraw_histmenu() calls before deleting
the person.
* doc/gramps.1.in, doc/gramps.1, doc/gramps-manual/C/gramps-manual.xml,
doc/gramps-manual/C/gramps-manual.omf, gramps.spec: New version.
* configure.in: Fix version and release numbers for 0.9.5-1.
* NEWS: Update for a 0.9.5 release.
svn: r2222
2003-10-10 09:26:19 +05:30
|
|
|
self.remove_item.set_sensitive(0)
|
|
|
|
self.edit_item.set_sensitive(0)
|
2002-11-17 04:52:33 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
set_panel(self.sidebar)
|
|
|
|
set_panel(self.gtop.get_widget('side_people'))
|
|
|
|
set_panel(self.gtop.get_widget('side_family'))
|
|
|
|
set_panel(self.gtop.get_widget('side_pedigree'))
|
|
|
|
set_panel(self.gtop.get_widget('side_sources'))
|
|
|
|
set_panel(self.gtop.get_widget('side_places'))
|
|
|
|
set_panel(self.gtop.get_widget('side_media'))
|
|
|
|
|
|
|
|
self.sidebar_btn = self.gtop.get_widget("sidebar1")
|
|
|
|
self.filter_btn = self.gtop.get_widget("filter1")
|
2003-10-17 10:35:20 +05:30
|
|
|
self.toolbar_btn = self.gtop.get_widget("toolbar2")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.statusbar = self.gtop.get_widget("statusbar")
|
2002-11-10 06:08:58 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.filter_list = self.gtop.get_widget("filter_list")
|
2004-03-25 09:34:35 +05:30
|
|
|
self.views = self.gtop.get_widget("views")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.merge_button= self.gtop.get_widget("merge")
|
|
|
|
self.canvas = self.gtop.get_widget("canvas1")
|
|
|
|
self.toolbar = self.gtop.get_widget("toolbar1")
|
2003-10-17 10:35:20 +05:30
|
|
|
self.toolbardock = self.gtop.get_widget("dockitem2")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.filter_text = self.gtop.get_widget('filter')
|
|
|
|
self.qual_label = self.gtop.get_widget("qual")
|
|
|
|
self.child_type = self.gtop.get_widget("childtype")
|
|
|
|
self.spouse_tab = self.gtop.get_widget("lab_or_list")
|
|
|
|
self.pref_spouse = self.gtop.get_widget("pref_spouse")
|
|
|
|
self.multi_spouse= self.gtop.get_widget("multi_spouse")
|
|
|
|
self.spouse_pref = self.gtop.get_widget("prefrel")
|
|
|
|
self.spouse_edit = self.gtop.get_widget("edit_sp")
|
|
|
|
self.spouse_del = self.gtop.get_widget("delete_sp")
|
|
|
|
self.spouse_combo= self.gtop.get_widget("spouse_combo")
|
|
|
|
self.spouse_tab = self.gtop.get_widget("spouse_tab")
|
2004-05-19 11:43:36 +05:30
|
|
|
self.undolabel = self.gtop.get_widget('undolabel')
|
2004-05-20 10:11:55 +05:30
|
|
|
self.redolabel = self.gtop.get_widget('redolabel')
|
2004-11-29 10:45:41 +05:30
|
|
|
self.open_recent = self.gtop.get_widget('open_recent1')
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
self.db.set_undo_callback(self.undo_callback)
|
|
|
|
self.db.set_redo_callback(self.redo_callback)
|
2003-10-17 10:35:20 +05:30
|
|
|
|
2003-01-12 05:13:24 +05:30
|
|
|
self.child_model = gtk.ListStore(
|
|
|
|
gobject.TYPE_INT, gobject.TYPE_STRING, gobject.TYPE_STRING,
|
|
|
|
gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING,
|
|
|
|
gobject.TYPE_STRING,
|
|
|
|
)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
self.build_plugin_menus()
|
|
|
|
self.init_filters()
|
|
|
|
|
2004-11-29 10:45:41 +05:30
|
|
|
self.build_recent_menu()
|
|
|
|
|
2005-01-09 04:05:04 +05:30
|
|
|
the_style = GrampsKeys.get_toolbar()
|
|
|
|
if the_style == -1:
|
|
|
|
self.toolbar.unset_style()
|
|
|
|
else:
|
|
|
|
self.toolbar.set_style(the_style)
|
2003-03-27 08:46:09 +05:30
|
|
|
self.views.set_show_tabs(0)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-01-12 10:52:21 +05:30
|
|
|
self.family_view = FamilyView.FamilyView(self)
|
2003-10-05 01:32:38 +05:30
|
|
|
self.people_view = PeopleView.PeopleView(self)
|
|
|
|
|
2003-08-25 19:30:26 +05:30
|
|
|
self.pedigree_view = PedView.PedigreeView(self,
|
2003-01-12 05:13:24 +05:30
|
|
|
self.canvas, self.modify_statusbar, self.statusbar,
|
|
|
|
self.change_active_person, self.load_person
|
|
|
|
)
|
|
|
|
|
2004-03-23 10:31:19 +05:30
|
|
|
self.place_view = PlaceView.PlaceView(self,self.db,self.gtop,
|
|
|
|
self.update_display)
|
|
|
|
self.source_view = SourceView.SourceView(self,self.db,self.gtop,
|
|
|
|
self.update_display)
|
|
|
|
self.media_view = MediaView.MediaView(self,self.db,self.gtop,
|
|
|
|
self.update_display)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-08-25 10:33:36 +05:30
|
|
|
self.add_button = self.gtop.get_widget('addbtn')
|
* src/gramps.glade: Remove hot keys from toolbar buttons.
Add editing items under Edit menu.
* src/gramps_main.py: Enable/disable new menu items.
* NEWS, configure, configure.in, gramps.spec, doc/gramps.1,
doc/gramps-manual/C/gramps-manual-C.omf,
doc/gramps-manual/C/gramps-manual.xml: merge with 0.9.5 branch.
* Version 0.9.5: the "Fix me up" release.
* src/gramps_main.py (delete_person_response, merge_update):
Add remove_from_history and redraw_histmenu() calls before deleting
the person.
* doc/gramps.1.in, doc/gramps.1, doc/gramps-manual/C/gramps-manual.xml,
doc/gramps-manual/C/gramps-manual.omf, gramps.spec: New version.
* configure.in: Fix version and release numbers for 0.9.5-1.
* NEWS: Update for a 0.9.5 release.
svn: r2222
2003-10-10 09:26:19 +05:30
|
|
|
self.add_item = self.gtop.get_widget('add_item')
|
2003-08-16 08:52:56 +05:30
|
|
|
self.backbtn = self.gtop.get_widget('back_btn')
|
|
|
|
self.fwdbtn = self.gtop.get_widget('fwd_btn')
|
2003-10-06 07:12:55 +05:30
|
|
|
self.gomenuitem = self.gtop.get_widget("go1")
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-12-01 10:55:16 +05:30
|
|
|
# FIXME: Horrible and ugly hack that works around a bug in
|
|
|
|
# either gtk or libglade: button-press-event does not propagate
|
|
|
|
# from ToolButton to the child.
|
|
|
|
self.backbtn.get_children()[0].connect("button-press-event",self.back_pressed)
|
|
|
|
self.fwdbtn.get_children()[0].connect("button-press-event",self.fwd_pressed)
|
|
|
|
|
2004-02-19 19:10:09 +05:30
|
|
|
self.wins = self.gtop.get_widget("windows1")
|
|
|
|
self.wins.set_submenu(gtk.Menu())
|
|
|
|
self.winsmenu = self.wins.get_submenu()
|
2004-02-25 08:50:53 +05:30
|
|
|
self.child_windows = {}
|
2004-02-19 19:10:09 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.gtop.signal_autoconnect({
|
2004-03-30 10:20:24 +05:30
|
|
|
"on_undo_activate" : self.undo,
|
2004-10-13 09:21:27 +05:30
|
|
|
"on_abandon_activate" : self.exit_and_undo,
|
2004-03-10 10:45:06 +05:30
|
|
|
"on_column_order_activate": self.column_order,
|
2003-08-14 09:21:19 +05:30
|
|
|
"on_back_clicked" : self.back_clicked,
|
2004-12-01 10:55:16 +05:30
|
|
|
# FIXME: uncomment when fixed
|
|
|
|
#"on_back_pressed" : self.back_pressed,
|
2003-08-14 09:21:19 +05:30
|
|
|
"on_fwd_clicked" : self.fwd_clicked,
|
2004-12-01 10:55:16 +05:30
|
|
|
# FIXME: uncomment when fixed
|
|
|
|
#"on_fwd_pressed" : self.fwd_pressed,
|
2002-10-20 19:55:16 +05:30
|
|
|
"on_editbtn_clicked" : self.edit_button_clicked,
|
|
|
|
"on_addbtn_clicked" : self.add_button_clicked,
|
|
|
|
"on_removebtn_clicked" : self.remove_button_clicked,
|
|
|
|
"delete_event" : self.delete_event,
|
2003-03-31 07:03:40 +05:30
|
|
|
"destroy_passed_object" : Utils.destroy_passed_object,
|
|
|
|
"on_about_activate" : self.on_about_activate,
|
|
|
|
"on_add_bookmark_activate" : self.on_add_bookmark_activate,
|
|
|
|
"on_add_place_clicked" : self.place_view.on_add_place_clicked,
|
|
|
|
"on_add_source_clicked" : self.source_view.on_add_clicked,
|
|
|
|
"on_addperson_clicked" : self.load_new_person,
|
|
|
|
"on_apply_filter_clicked" : self.on_apply_filter_clicked,
|
|
|
|
"on_arrow_left_clicked" : self.pedigree_view.on_show_child_menu,
|
|
|
|
"on_canvas1_event" : self.pedigree_view.on_canvas1_event,
|
|
|
|
"on_contents_activate" : self.on_contents_activate,
|
2003-11-27 00:45:24 +05:30
|
|
|
"on_faq_activate" : self.on_faq_activate,
|
2003-03-31 07:03:40 +05:30
|
|
|
"on_default_person_activate" : self.on_default_person_activate,
|
|
|
|
"on_delete_person_clicked" : self.delete_person_clicked,
|
|
|
|
"on_delete_place_clicked" : self.place_view.on_delete_clicked,
|
|
|
|
"on_delete_source_clicked" : self.source_view.on_delete_clicked,
|
|
|
|
"on_delete_media_clicked" : self.media_view.on_delete_clicked,
|
|
|
|
"on_edit_active_person" : self.load_active_person,
|
|
|
|
"on_edit_selected_people" : self.load_selected_people,
|
|
|
|
"on_edit_bookmarks_activate" : self.on_edit_bookmarks_activate,
|
|
|
|
"on_exit_activate" : self.on_exit_activate,
|
2003-08-26 09:56:09 +05:30
|
|
|
"on_family_activate" : self.on_family_activate,
|
2003-03-31 07:03:40 +05:30
|
|
|
"on_family1_activate" : self.on_family1_activate,
|
2003-08-26 09:15:41 +05:30
|
|
|
"on_family2_activate" : self.on_family2_activate,
|
2003-03-31 07:03:40 +05:30
|
|
|
"on_home_clicked" : self.on_home_clicked,
|
|
|
|
"on_new_clicked" : self.on_new_clicked,
|
|
|
|
"on_notebook1_switch_page" : self.on_views_switch_page,
|
|
|
|
"on_open_activate" : self.on_open_activate,
|
2004-06-26 11:09:43 +05:30
|
|
|
"on_import_activate" : self.on_import_activate,
|
|
|
|
"on_export_activate" : self.on_export_activate,
|
2005-01-31 05:23:47 +05:30
|
|
|
"on_saveas_activate" : self.on_saveas_activate,
|
2003-03-31 07:03:40 +05:30
|
|
|
"on_pedigree1_activate" : self.on_pedigree1_activate,
|
|
|
|
"on_person_list1_activate" : self.on_person_list1_activate,
|
|
|
|
"on_media_activate" : self.on_media_activate,
|
|
|
|
"on_media_list_select_row" : self.media_view.on_select_row,
|
|
|
|
"on_media_list_drag_data_get" : self.media_view.on_drag_data_get,
|
|
|
|
"on_media_list_drag_data_received" : self.media_view.on_drag_data_received,
|
|
|
|
"on_merge_activate" : self.on_merge_activate,
|
|
|
|
"on_sidebar1_activate" : self.on_sidebar_activate,
|
2003-10-17 10:35:20 +05:30
|
|
|
"on_toolbar2_activate" : self.on_toolbar_activate,
|
2003-03-31 07:03:40 +05:30
|
|
|
"on_filter1_activate" : self.on_filter_activate,
|
|
|
|
"on_places_activate" : self.on_places_activate,
|
|
|
|
"on_preferences1_activate" : self.on_preferences_activate,
|
|
|
|
"on_reports_clicked" : self.on_reports_clicked,
|
|
|
|
"on_revert_activate" : self.on_revert_activate,
|
|
|
|
"on_show_plugin_status" : self.on_show_plugin_status,
|
|
|
|
"on_source_list_button_press" : self.source_view.button_press,
|
|
|
|
"on_sources_activate" : self.on_sources_activate,
|
|
|
|
"on_tools_clicked" : self.on_tools_clicked,
|
|
|
|
"on_gramps_home_page_activate" : self.home_page_activate,
|
|
|
|
"on_gramps_report_bug_activate" : self.report_bug_activate,
|
|
|
|
"on_gramps_mailing_lists_activate" : self.mailing_lists_activate,
|
|
|
|
"on_open_example" : self.open_example,
|
2004-06-22 04:54:51 +05:30
|
|
|
})
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-01-06 22:58:31 +05:30
|
|
|
self.filter_btn.set_active(GrampsKeys.get_filter())
|
|
|
|
self.enable_filter(GrampsKeys.get_filter())
|
|
|
|
self.toolbar_btn.set_active(GrampsKeys.get_toolbar_on())
|
|
|
|
self.enable_toolbar(GrampsKeys.get_toolbar_on())
|
2004-08-21 09:35:51 +05:30
|
|
|
|
2005-01-06 22:58:31 +05:30
|
|
|
if not GrampsKeys.get_screen_size_checked():
|
|
|
|
GrampsKeys.save_screen_size_checked(1)
|
2004-08-21 09:35:51 +05:30
|
|
|
if gtk.gdk.screen_width() <= 900:
|
2005-01-06 22:58:31 +05:30
|
|
|
GrampsKeys.save_view(0)
|
|
|
|
self.sidebar_btn.set_active(GrampsKeys.get_view())
|
|
|
|
self.enable_sidebar(GrampsKeys.get_view())
|
2003-08-19 08:25:27 +05:30
|
|
|
|
2003-04-23 03:22:59 +05:30
|
|
|
self.find_place = None
|
|
|
|
self.find_source = None
|
|
|
|
self.find_media = None
|
2003-09-03 06:24:55 +05:30
|
|
|
|
2005-01-06 22:58:31 +05:30
|
|
|
if GrampsKeys.get_default_view() == 0:
|
2003-09-03 06:24:55 +05:30
|
|
|
self.views.set_current_page(PERSON_VIEW)
|
2005-01-06 22:58:31 +05:30
|
|
|
elif GrampsKeys.get_family_view() == 0:
|
2003-09-03 06:24:55 +05:30
|
|
|
self.views.set_current_page(FAMILY_VIEW1)
|
2003-08-12 08:31:17 +05:30
|
|
|
else:
|
2003-09-03 06:24:55 +05:30
|
|
|
self.views.set_current_page(FAMILY_VIEW2)
|
|
|
|
|
2003-10-09 09:48:53 +05:30
|
|
|
self.accel_group = gtk.AccelGroup()
|
|
|
|
self.topWindow.add_accel_group(self.accel_group)
|
|
|
|
self.back = gtk.ImageMenuItem(gtk.STOCK_GO_BACK)
|
2003-12-05 05:41:22 +05:30
|
|
|
self.forward = gtk.ImageMenuItem(gtk.STOCK_GO_FORWARD)
|
2003-10-09 09:48:53 +05:30
|
|
|
|
2004-11-29 10:45:41 +05:30
|
|
|
def build_recent_menu(self):
|
|
|
|
gramps_rf = RecentFiles.GrampsRecentFiles()
|
|
|
|
gramps_rf.gramps_recent_files.sort()
|
|
|
|
gramps_rf.gramps_recent_files.reverse()
|
|
|
|
recent_menu = gtk.Menu()
|
|
|
|
recent_menu.show()
|
|
|
|
index = 0
|
|
|
|
for item in gramps_rf.gramps_recent_files:
|
|
|
|
index = index + 1
|
|
|
|
name = os.path.basename(item.get_path())
|
2005-01-06 09:37:29 +05:30
|
|
|
if gtk.pygtk_version < (2,4,0):
|
|
|
|
menu_item = gtk.MenuItem(name)
|
|
|
|
else:
|
|
|
|
menu_item = gtk.MenuItem(name,False)
|
2004-11-30 07:46:30 +05:30
|
|
|
menu_item.connect("activate",self.recent_callback,
|
|
|
|
item.get_path(),item.get_mime())
|
2004-11-29 10:45:41 +05:30
|
|
|
menu_item.show()
|
|
|
|
recent_menu.append(menu_item)
|
|
|
|
self.open_recent.set_submenu(recent_menu)
|
|
|
|
|
2004-11-30 07:46:30 +05:30
|
|
|
def recent_callback(self,obj,filename,filetype):
|
|
|
|
if os.path.exists(filename):
|
|
|
|
DbPrompter.open_native(self,filename,filetype)
|
|
|
|
else:
|
|
|
|
ErrorDialog(_('File does not exist'),
|
|
|
|
_("The file %s cannot be found. "
|
|
|
|
"It will be removed from the list of recent files.") % filename )
|
|
|
|
RecentFiles.remove_filename(filename)
|
|
|
|
self.build_recent_menu()
|
2004-11-29 10:45:41 +05:30
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
def undo_callback(self,text):
|
|
|
|
if text == None:
|
|
|
|
self.undolabel.set_sensitive(0)
|
|
|
|
self.undolabel.get_children()[0].set_text(_("_Undo"))
|
2005-02-25 22:36:04 +05:30
|
|
|
self.undolabel.get_children()[0].set_use_underline(1)
|
2004-08-13 10:04:07 +05:30
|
|
|
else:
|
|
|
|
self.undolabel.set_sensitive(1)
|
|
|
|
label = self.undolabel.get_children()[0]
|
|
|
|
label.set_text(text)
|
|
|
|
label.set_use_underline(1)
|
|
|
|
|
|
|
|
def redo_callback(self,text):
|
|
|
|
if text == None:
|
|
|
|
self.redolabel.set_sensitive(0)
|
|
|
|
self.redolabel.get_children()[0].set_text(_("_Redo"))
|
|
|
|
else:
|
|
|
|
self.redolabel.set_sensitive(1)
|
|
|
|
label = self.redolabel.get_children()[0]
|
|
|
|
label.set_text(text)
|
|
|
|
label.set_use_underline(1)
|
2003-08-14 09:21:19 +05:30
|
|
|
|
2004-03-30 10:20:24 +05:30
|
|
|
def undo(self,*args):
|
|
|
|
self.db.undo()
|
2004-04-04 10:09:52 +05:30
|
|
|
if self.active_person:
|
2004-08-07 10:46:57 +05:30
|
|
|
p = self.db.get_person_from_handle(self.active_person.get_handle())
|
2004-04-04 10:09:52 +05:30
|
|
|
self.change_active_person(p)
|
2004-03-30 10:20:24 +05:30
|
|
|
self.place_view.change_db(self.db)
|
|
|
|
self.people_view.change_db(self.db)
|
2004-05-14 05:18:40 +05:30
|
|
|
self.people_view.apply_filter()
|
2004-03-30 10:20:24 +05:30
|
|
|
self.source_view.change_db(self.db)
|
|
|
|
self.media_view.change_db(self.db)
|
|
|
|
self.family_view.load_family()
|
|
|
|
|
2004-10-13 09:21:27 +05:30
|
|
|
def exit_and_undo(self,*args):
|
|
|
|
self.db.abort_changes()
|
|
|
|
self.db.set_people_view_maps((None,None,None,None))
|
|
|
|
gtk.main_quit()
|
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
def set_person_column_order(self,list):
|
|
|
|
self.db.set_person_column_order(list)
|
2004-03-10 10:45:06 +05:30
|
|
|
self.people_view.build_columns()
|
|
|
|
|
2004-11-19 01:51:06 +05:30
|
|
|
def set_child_column_order(self,list):
|
|
|
|
self.db.set_child_column_order(list)
|
|
|
|
self.family_view.build_columns()
|
|
|
|
|
2004-03-22 10:11:35 +05:30
|
|
|
def set_place_column_order(self,list):
|
|
|
|
self.db.set_place_column_order(list)
|
|
|
|
self.place_view.build_columns()
|
|
|
|
|
|
|
|
def set_source_column_order(self,list):
|
|
|
|
self.db.set_source_column_order(list)
|
|
|
|
self.source_view.build_columns()
|
|
|
|
|
|
|
|
def set_media_column_order(self,list):
|
|
|
|
self.db.set_media_column_order(list)
|
|
|
|
self.media_view.build_columns()
|
|
|
|
|
2004-03-10 10:45:06 +05:30
|
|
|
def column_order(self,obj):
|
|
|
|
import ColumnOrder
|
2004-03-22 10:11:35 +05:30
|
|
|
|
|
|
|
cpage = self.views.get_current_page()
|
|
|
|
if cpage == PERSON_VIEW:
|
2004-08-13 10:04:07 +05:30
|
|
|
ColumnOrder.ColumnOrder(self.db.get_person_column_order(),
|
2004-03-22 10:11:35 +05:30
|
|
|
PeopleView.column_names,
|
2004-08-13 10:04:07 +05:30
|
|
|
self.set_person_column_order)
|
2004-11-19 01:51:06 +05:30
|
|
|
elif cpage == FAMILY_VIEW1 or cpage == FAMILY_VIEW2:
|
|
|
|
ColumnOrder.ColumnOrder(self.db.get_child_column_order(),
|
|
|
|
map(lambda x: x[0], FamilyView.column_names),
|
|
|
|
self.set_child_column_order)
|
2004-03-22 10:11:35 +05:30
|
|
|
elif cpage == SOURCE_VIEW:
|
|
|
|
ColumnOrder.ColumnOrder(self.db.get_source_column_order(),
|
|
|
|
SourceView.column_names,
|
|
|
|
self.set_source_column_order)
|
|
|
|
elif cpage == PLACE_VIEW:
|
|
|
|
ColumnOrder.ColumnOrder(self.db.get_place_column_order(),
|
|
|
|
PlaceView.column_names,
|
|
|
|
self.set_place_column_order)
|
|
|
|
elif cpage == MEDIA_VIEW:
|
|
|
|
ColumnOrder.ColumnOrder(self.db.get_media_column_order(),
|
|
|
|
MediaView.column_names,
|
|
|
|
self.set_media_column_order)
|
2004-03-10 10:45:06 +05:30
|
|
|
|
2003-11-07 21:59:27 +05:30
|
|
|
def clear_history(self):
|
|
|
|
self.history = []
|
|
|
|
self.mhistory = []
|
|
|
|
self.hindex = -1
|
|
|
|
self.back.set_sensitive(0)
|
|
|
|
self.forward.set_sensitive(0)
|
|
|
|
self.backbtn.set_sensitive(0)
|
|
|
|
self.fwdbtn.set_sensitive(0)
|
|
|
|
self.redraw_histmenu()
|
|
|
|
|
2003-08-17 09:31:52 +05:30
|
|
|
def redraw_histmenu(self):
|
2003-08-17 21:37:06 +05:30
|
|
|
"""Create the history submenu of the Go menu"""
|
2003-10-06 07:12:55 +05:30
|
|
|
|
|
|
|
# Start a brand new menu and create static items:
|
|
|
|
# back, forward, separator, home.
|
|
|
|
gomenu = gtk.Menu()
|
|
|
|
|
2003-10-09 09:48:53 +05:30
|
|
|
self.back.destroy()
|
|
|
|
self.forward.destroy()
|
|
|
|
|
2003-10-06 07:12:55 +05:30
|
|
|
self.back = gtk.ImageMenuItem(gtk.STOCK_GO_BACK)
|
|
|
|
self.back.connect("activate",self.back_clicked)
|
2003-10-09 09:48:53 +05:30
|
|
|
self.back.add_accelerator("activate", self.accel_group,
|
|
|
|
gtk.gdk.keyval_from_name("Left"),
|
|
|
|
gtk.gdk.MOD1_MASK, gtk.ACCEL_VISIBLE)
|
2003-10-06 07:12:55 +05:30
|
|
|
self.back.show()
|
|
|
|
gomenu.append(self.back)
|
|
|
|
|
|
|
|
self.forward = gtk.ImageMenuItem(gtk.STOCK_GO_FORWARD)
|
|
|
|
self.forward.connect("activate",self.fwd_clicked)
|
2003-10-09 09:48:53 +05:30
|
|
|
self.forward.add_accelerator("activate", self.accel_group,
|
|
|
|
gtk.gdk.keyval_from_name("Right"),
|
|
|
|
gtk.gdk.MOD1_MASK, gtk.ACCEL_VISIBLE)
|
2003-10-06 07:12:55 +05:30
|
|
|
self.forward.show()
|
|
|
|
gomenu.append(self.forward)
|
|
|
|
|
|
|
|
item = gtk.MenuItem()
|
|
|
|
item.show()
|
|
|
|
gomenu.append(item)
|
|
|
|
|
2003-12-05 05:41:22 +05:30
|
|
|
#FIXME: revert to stock item when German gtk translation is fixed
|
|
|
|
#item = gtk.ImageMenuItem(gtk.STOCK_HOME)
|
|
|
|
item = gtk.ImageMenuItem(_("Home"))
|
2004-06-22 04:54:51 +05:30
|
|
|
im = gtk.image_new_from_stock(gtk.STOCK_HOME,gtk.ICON_SIZE_MENU)
|
|
|
|
im.show()
|
|
|
|
item.set_image(im)
|
2003-10-06 07:12:55 +05:30
|
|
|
item.connect("activate",self.on_home_clicked)
|
2003-10-09 09:48:53 +05:30
|
|
|
item.add_accelerator("activate", self.accel_group,
|
|
|
|
gtk.gdk.keyval_from_name("Home"),
|
|
|
|
gtk.gdk.MOD1_MASK, gtk.ACCEL_VISIBLE)
|
2003-10-06 07:12:55 +05:30
|
|
|
item.show()
|
|
|
|
gomenu.append(item)
|
|
|
|
|
2003-10-23 08:32:52 +05:30
|
|
|
try:
|
|
|
|
if len(self.history) > 0:
|
|
|
|
# Draw separator
|
|
|
|
item = gtk.MenuItem()
|
|
|
|
item.show()
|
|
|
|
gomenu.append(item)
|
|
|
|
|
|
|
|
pids = self.mhistory[:]
|
|
|
|
pids.reverse()
|
|
|
|
num = 0
|
|
|
|
haveit = []
|
|
|
|
for pid in pids:
|
|
|
|
if num >= 10:
|
|
|
|
break
|
|
|
|
if pid not in haveit:
|
|
|
|
haveit.append(pid)
|
2004-08-07 10:46:57 +05:30
|
|
|
person = self.db.get_person_from_handle(pid)
|
2003-10-23 08:32:52 +05:30
|
|
|
item = gtk.MenuItem("_%d. %s [%s]" %
|
2005-01-01 09:57:15 +05:30
|
|
|
(num,
|
|
|
|
NameDisplay.displayer.display(person),
|
2004-11-03 09:57:12 +05:30
|
|
|
person.get_gramps_id()))
|
2004-12-20 04:25:41 +05:30
|
|
|
item.connect("activate",self.bookmark_callback,
|
|
|
|
person.get_handle())
|
2003-10-23 08:32:52 +05:30
|
|
|
item.show()
|
|
|
|
gomenu.append(item)
|
|
|
|
num = num + 1
|
|
|
|
else:
|
|
|
|
self.back.set_sensitive(0)
|
|
|
|
self.forward.set_sensitive(0)
|
|
|
|
except:
|
2004-01-13 10:35:39 +05:30
|
|
|
self.clear_history()
|
2003-10-06 07:12:55 +05:30
|
|
|
|
|
|
|
self.gomenuitem.remove_submenu()
|
|
|
|
self.gomenuitem.set_submenu(gomenu)
|
2003-08-17 09:31:52 +05:30
|
|
|
|
2003-11-07 21:59:27 +05:30
|
|
|
def build_backhistmenu(self,event):
|
2003-08-19 06:04:09 +05:30
|
|
|
"""Builds and displays the menu with the back portion of the history"""
|
|
|
|
if self.hindex > 0:
|
|
|
|
backhistmenu = gtk.Menu()
|
|
|
|
backhistmenu.set_title(_('Back Menu'))
|
|
|
|
pids = self.history[:self.hindex]
|
|
|
|
pids.reverse()
|
|
|
|
num = 1
|
|
|
|
for pid in pids:
|
2003-08-19 18:09:05 +05:30
|
|
|
if num <= 10:
|
|
|
|
f,r = divmod(num,10)
|
|
|
|
hotkey = "_%d" % r
|
|
|
|
elif num <= 20:
|
|
|
|
hotkey = "_%s" % chr(ord('a')+num-11)
|
|
|
|
elif num >= 21:
|
|
|
|
break
|
2004-08-07 10:46:57 +05:30
|
|
|
person = self.db.get_person_from_handle(pid)
|
2003-08-19 18:09:05 +05:30
|
|
|
item = gtk.MenuItem("%s. %s [%s]" %
|
2004-12-20 04:25:41 +05:30
|
|
|
(hotkey,
|
2005-01-01 09:57:15 +05:30
|
|
|
NameDisplay.displayer.display(person),
|
2004-12-20 04:25:41 +05:30
|
|
|
person.get_gramps_id()))
|
2003-08-19 06:04:09 +05:30
|
|
|
item.connect("activate",self.back_clicked,num)
|
|
|
|
item.show()
|
|
|
|
backhistmenu.append(item)
|
|
|
|
num = num + 1
|
2003-11-07 21:59:27 +05:30
|
|
|
backhistmenu.popup(None,None,None,event.button,event.time)
|
2003-08-19 06:04:09 +05:30
|
|
|
|
|
|
|
def back_pressed(self,obj,event):
|
|
|
|
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
2003-11-07 21:59:27 +05:30
|
|
|
self.build_backhistmenu(event)
|
2003-08-19 06:04:09 +05:30
|
|
|
|
2003-11-07 21:59:27 +05:30
|
|
|
def build_fwdhistmenu(self,event):
|
2003-08-19 06:04:09 +05:30
|
|
|
"""Builds and displays the menu with the forward portion of the history"""
|
|
|
|
if self.hindex < len(self.history)-1:
|
|
|
|
fwdhistmenu = gtk.Menu()
|
|
|
|
fwdhistmenu.set_title(_('Forward Menu'))
|
|
|
|
pids = self.history[self.hindex+1:]
|
|
|
|
num = 1
|
|
|
|
for pid in pids:
|
2003-08-19 18:09:05 +05:30
|
|
|
if num <= 10:
|
|
|
|
f,r = divmod(num,10)
|
|
|
|
hotkey = "_%d" % r
|
|
|
|
elif num <= 20:
|
|
|
|
hotkey = "_%s" % chr(ord('a')+num-11)
|
|
|
|
elif num >= 21:
|
|
|
|
break
|
2004-08-07 10:46:57 +05:30
|
|
|
person = self.db.get_person_from_handle(pid)
|
2003-08-19 18:09:05 +05:30
|
|
|
item = gtk.MenuItem("%s. %s [%s]" %
|
2004-12-20 04:25:41 +05:30
|
|
|
(hotkey,
|
2005-01-01 09:57:15 +05:30
|
|
|
NameDisplay.displayer.display(person),
|
2004-12-20 04:25:41 +05:30
|
|
|
person.get_gramps_id()))
|
2003-08-19 06:04:09 +05:30
|
|
|
item.connect("activate",self.fwd_clicked,num)
|
|
|
|
item.show()
|
|
|
|
fwdhistmenu.append(item)
|
|
|
|
num = num + 1
|
2003-11-07 21:59:27 +05:30
|
|
|
fwdhistmenu.popup(None,None,None,event.button,event.time)
|
2003-08-19 06:04:09 +05:30
|
|
|
|
|
|
|
def fwd_pressed(self,obj,event):
|
|
|
|
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
2003-11-07 21:59:27 +05:30
|
|
|
self.build_fwdhistmenu(event)
|
2003-08-19 06:04:09 +05:30
|
|
|
|
2003-10-05 01:32:38 +05:30
|
|
|
def set_buttons(self,val):
|
|
|
|
self.report_menu.set_sensitive(val)
|
|
|
|
self.tools_menu.set_sensitive(val)
|
|
|
|
self.report_button.set_sensitive(val)
|
|
|
|
self.tool_button.set_sensitive(val)
|
|
|
|
if self.views.get_current_page() == PERSON_VIEW:
|
|
|
|
self.remove_button.set_sensitive(val)
|
|
|
|
self.edit_button.set_sensitive(val)
|
* src/gramps.glade: Remove hot keys from toolbar buttons.
Add editing items under Edit menu.
* src/gramps_main.py: Enable/disable new menu items.
* NEWS, configure, configure.in, gramps.spec, doc/gramps.1,
doc/gramps-manual/C/gramps-manual-C.omf,
doc/gramps-manual/C/gramps-manual.xml: merge with 0.9.5 branch.
* Version 0.9.5: the "Fix me up" release.
* src/gramps_main.py (delete_person_response, merge_update):
Add remove_from_history and redraw_histmenu() calls before deleting
the person.
* doc/gramps.1.in, doc/gramps.1, doc/gramps-manual/C/gramps-manual.xml,
doc/gramps-manual/C/gramps-manual.omf, gramps.spec: New version.
* configure.in: Fix version and release numbers for 0.9.5-1.
* NEWS: Update for a 0.9.5 release.
svn: r2222
2003-10-10 09:26:19 +05:30
|
|
|
self.remove_item.set_sensitive(val)
|
|
|
|
self.edit_item.set_sensitive(val)
|
2003-10-05 01:32:38 +05:30
|
|
|
|
2003-08-19 06:04:09 +05:30
|
|
|
def back_clicked(self,obj,step=1):
|
2003-08-14 09:21:19 +05:30
|
|
|
if self.hindex > 0:
|
|
|
|
try:
|
2003-08-19 06:04:09 +05:30
|
|
|
self.hindex -= step
|
2004-08-07 10:46:57 +05:30
|
|
|
self.active_person = self.db.get_person_from_handle(self.history[self.hindex])
|
2003-08-14 09:21:19 +05:30
|
|
|
self.modify_statusbar()
|
2003-08-16 08:52:56 +05:30
|
|
|
self.update_display(0)
|
2003-08-17 21:37:06 +05:30
|
|
|
self.mhistory.append(self.history[self.hindex])
|
2003-08-17 09:31:52 +05:30
|
|
|
self.redraw_histmenu()
|
2003-08-16 08:52:56 +05:30
|
|
|
self.set_buttons(1)
|
|
|
|
if self.hindex == 0:
|
|
|
|
self.backbtn.set_sensitive(0)
|
2003-08-16 10:36:24 +05:30
|
|
|
self.back.set_sensitive(0)
|
2003-08-16 08:52:56 +05:30
|
|
|
else:
|
|
|
|
self.backbtn.set_sensitive(1)
|
2003-08-16 10:36:24 +05:30
|
|
|
self.back.set_sensitive(1)
|
2003-08-16 08:52:56 +05:30
|
|
|
self.fwdbtn.set_sensitive(1)
|
2003-08-16 10:36:24 +05:30
|
|
|
self.forward.set_sensitive(1)
|
2003-08-14 09:21:19 +05:30
|
|
|
except:
|
2004-01-13 10:35:39 +05:30
|
|
|
self.clear_history()
|
2003-08-16 08:52:56 +05:30
|
|
|
else:
|
|
|
|
self.backbtn.set_sensitive(0)
|
2003-08-16 10:36:24 +05:30
|
|
|
self.back.set_sensitive(0)
|
2003-08-16 08:52:56 +05:30
|
|
|
self.fwdbtn.set_sensitive(1)
|
2003-08-16 10:36:24 +05:30
|
|
|
self.forward.set_sensitive(1)
|
2004-11-06 09:11:21 +05:30
|
|
|
self.goto_active_person()
|
2003-08-14 09:21:19 +05:30
|
|
|
|
2003-08-19 06:04:09 +05:30
|
|
|
def fwd_clicked(self,obj,step=1):
|
2003-08-14 09:21:19 +05:30
|
|
|
if self.hindex+1 < len(self.history):
|
|
|
|
try:
|
2003-08-19 06:04:09 +05:30
|
|
|
self.hindex += step
|
2004-08-07 10:46:57 +05:30
|
|
|
self.active_person = self.db.get_person_from_handle(self.history[self.hindex])
|
2003-08-14 09:21:19 +05:30
|
|
|
self.modify_statusbar()
|
2003-08-16 08:52:56 +05:30
|
|
|
self.update_display(0)
|
2003-08-17 21:37:06 +05:30
|
|
|
self.mhistory.append(self.history[self.hindex])
|
2003-08-17 09:31:52 +05:30
|
|
|
self.redraw_histmenu()
|
2003-08-14 09:21:19 +05:30
|
|
|
self.set_buttons(1)
|
2003-08-16 08:52:56 +05:30
|
|
|
if self.hindex == len(self.history)-1:
|
|
|
|
self.fwdbtn.set_sensitive(0)
|
2003-08-16 10:36:24 +05:30
|
|
|
self.forward.set_sensitive(0)
|
2003-08-16 08:52:56 +05:30
|
|
|
else:
|
|
|
|
self.fwdbtn.set_sensitive(1)
|
2003-08-16 10:36:24 +05:30
|
|
|
self.forward.set_sensitive(1)
|
2003-08-16 08:52:56 +05:30
|
|
|
self.backbtn.set_sensitive(1)
|
2003-08-16 10:36:24 +05:30
|
|
|
self.back.set_sensitive(1)
|
2003-08-14 09:21:19 +05:30
|
|
|
except:
|
2004-01-13 10:35:39 +05:30
|
|
|
self.clear_history()
|
2003-08-16 08:52:56 +05:30
|
|
|
else:
|
|
|
|
self.fwdbtn.set_sensitive(0)
|
2003-08-16 10:36:24 +05:30
|
|
|
self.forward.set_sensitive(0)
|
2003-08-16 08:52:56 +05:30
|
|
|
self.backbtn.set_sensitive(1)
|
2003-08-16 10:36:24 +05:30
|
|
|
self.back.set_sensitive(1)
|
2004-11-06 09:11:21 +05:30
|
|
|
self.goto_active_person()
|
2003-08-14 09:21:19 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def edit_button_clicked(self,obj):
|
2003-03-27 08:46:09 +05:30
|
|
|
cpage = self.views.get_current_page()
|
2003-10-13 09:53:34 +05:30
|
|
|
if cpage == PERSON_VIEW:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.load_selected_people(obj)
|
2003-10-13 09:53:34 +05:30
|
|
|
elif cpage == FAMILY_VIEW2 or cpage == FAMILY_VIEW1:
|
|
|
|
self.load_person(self.active_person)
|
2003-08-26 09:15:41 +05:30
|
|
|
elif cpage == SOURCE_VIEW:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.source_view.on_edit_clicked(obj)
|
2003-08-26 09:15:41 +05:30
|
|
|
elif cpage == PLACE_VIEW:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.place_view.on_edit_clicked(obj)
|
2003-08-26 09:15:41 +05:30
|
|
|
elif cpage == MEDIA_VIEW:
|
2002-12-11 10:48:47 +05:30
|
|
|
self.media_view.on_edit_clicked(obj)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def add_button_clicked(self,obj):
|
2003-03-27 08:46:09 +05:30
|
|
|
cpage = self.views.get_current_page()
|
2003-10-13 08:42:27 +05:30
|
|
|
if cpage == PERSON_VIEW or cpage == FAMILY_VIEW2 or cpage == FAMILY_VIEW1:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.load_new_person(obj)
|
2003-08-26 09:15:41 +05:30
|
|
|
elif cpage == SOURCE_VIEW:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.source_view.on_add_clicked(obj)
|
2003-08-26 09:15:41 +05:30
|
|
|
elif cpage == PLACE_VIEW:
|
2002-10-21 06:48:07 +05:30
|
|
|
self.place_view.on_add_place_clicked(obj)
|
2003-08-26 09:15:41 +05:30
|
|
|
elif cpage == MEDIA_VIEW:
|
2002-12-11 10:48:47 +05:30
|
|
|
self.media_view.on_add_clicked(obj)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def remove_button_clicked(self,obj):
|
2003-03-27 08:46:09 +05:30
|
|
|
cpage = self.views.get_current_page()
|
2003-10-13 08:42:27 +05:30
|
|
|
if cpage == PERSON_VIEW or cpage == FAMILY_VIEW2 or cpage == FAMILY_VIEW1:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.delete_person_clicked(obj)
|
2003-08-26 09:15:41 +05:30
|
|
|
elif cpage == SOURCE_VIEW:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.source_view.on_delete_clicked(obj)
|
2003-08-26 09:15:41 +05:30
|
|
|
elif cpage == PLACE_VIEW:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.place_view.on_delete_clicked(obj)
|
2003-08-26 09:15:41 +05:30
|
|
|
elif cpage == MEDIA_VIEW:
|
2002-12-11 10:48:47 +05:30
|
|
|
self.media_view.on_delete_clicked(obj)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def enable_buttons(self,val):
|
2005-02-17 04:19:54 +05:30
|
|
|
if self.db.readonly:
|
|
|
|
mode = False
|
|
|
|
else:
|
|
|
|
mode = val
|
|
|
|
self.add_button.set_sensitive(mode)
|
|
|
|
self.remove_button.set_sensitive(mode)
|
|
|
|
self.add_item.set_sensitive(mode)
|
|
|
|
self.remove_item.set_sensitive(mode)
|
|
|
|
|
2003-08-25 10:33:36 +05:30
|
|
|
self.edit_button.set_sensitive(val)
|
* src/gramps.glade: Remove hot keys from toolbar buttons.
Add editing items under Edit menu.
* src/gramps_main.py: Enable/disable new menu items.
* NEWS, configure, configure.in, gramps.spec, doc/gramps.1,
doc/gramps-manual/C/gramps-manual-C.omf,
doc/gramps-manual/C/gramps-manual.xml: merge with 0.9.5 branch.
* Version 0.9.5: the "Fix me up" release.
* src/gramps_main.py (delete_person_response, merge_update):
Add remove_from_history and redraw_histmenu() calls before deleting
the person.
* doc/gramps.1.in, doc/gramps.1, doc/gramps-manual/C/gramps-manual.xml,
doc/gramps-manual/C/gramps-manual.omf, gramps.spec: New version.
* configure.in: Fix version and release numbers for 0.9.5-1.
* NEWS: Update for a 0.9.5 release.
svn: r2222
2003-10-10 09:26:19 +05:30
|
|
|
self.edit_item.set_sensitive(val)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_show_plugin_status(self,obj):
|
2005-01-26 02:55:15 +05:30
|
|
|
Plugins.PluginStatus(self)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_sidebar_activate(self,obj):
|
2004-07-28 07:59:07 +05:30
|
|
|
self.enable_sidebar(obj.get_active())
|
2005-01-06 22:58:31 +05:30
|
|
|
GrampsKeys.save_view(obj.get_active())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def enable_sidebar(self,val):
|
|
|
|
if val:
|
|
|
|
self.sidebar.show()
|
2003-03-27 08:46:09 +05:30
|
|
|
self.views.set_show_tabs(0)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
|
|
|
self.sidebar.hide()
|
2003-03-27 08:46:09 +05:30
|
|
|
self.views.set_show_tabs(1)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def enable_filter(self,val):
|
|
|
|
if val:
|
|
|
|
self.filterbar.show()
|
|
|
|
else:
|
|
|
|
self.filterbar.hide()
|
|
|
|
|
|
|
|
def on_filter_activate(self,obj):
|
2005-01-06 22:58:31 +05:30
|
|
|
GrampsKeys.save_filter(obj.get_active())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-10-17 10:35:20 +05:30
|
|
|
def on_toolbar_activate(self,obj):
|
2005-01-06 22:58:31 +05:30
|
|
|
GrampsKeys.save_toolbar_on(obj.get_active())
|
2003-10-17 10:35:20 +05:30
|
|
|
|
|
|
|
def enable_toolbar(self,val):
|
|
|
|
if val:
|
|
|
|
self.toolbardock.show()
|
|
|
|
else:
|
|
|
|
self.toolbardock.hide()
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def build_plugin_menus(self):
|
2002-11-17 04:52:33 +05:30
|
|
|
self.report_menu = self.gtop.get_widget("reports_menu")
|
|
|
|
self.tools_menu = self.gtop.get_widget("tools_menu")
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2002-11-17 04:52:33 +05:30
|
|
|
self.report_menu.set_sensitive(0)
|
|
|
|
self.tools_menu.set_sensitive(0)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-01-09 07:48:49 +05:30
|
|
|
error = PluginMgr.load_plugins(const.docgenDir)
|
|
|
|
error |= PluginMgr.load_plugins(os.path.expanduser("~/.gramps/docgen"))
|
|
|
|
error |= PluginMgr.load_plugins(const.pluginsDir)
|
|
|
|
error |= PluginMgr.load_plugins(os.path.expanduser("~/.gramps/plugins"))
|
|
|
|
|
|
|
|
if GrampsKeys.get_pop_plugin_status() and error:
|
2005-01-26 02:55:15 +05:30
|
|
|
Plugins.PluginStatus(self)
|
2002-11-17 04:52:33 +05:30
|
|
|
Plugins.build_report_menu(self.report_menu,self.menu_report)
|
|
|
|
Plugins.build_tools_menu(self.tools_menu,self.menu_tools)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-01-05 10:32:19 +05:30
|
|
|
self.RelClass = PluginMgr.relationship_class
|
2004-02-16 02:58:31 +05:30
|
|
|
self.relationship = self.RelClass(self.db)
|
2003-04-30 22:10:28 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def init_filters(self):
|
|
|
|
|
2005-01-07 10:04:02 +05:30
|
|
|
cell = gtk.CellRendererText()
|
2005-03-09 06:38:49 +05:30
|
|
|
self.filter_list.clear()
|
2005-01-07 10:04:02 +05:30
|
|
|
self.filter_list.pack_start(cell,True)
|
|
|
|
self.filter_list.add_attribute(cell,'text',0)
|
|
|
|
|
2004-04-28 09:36:25 +05:30
|
|
|
filter_list = []
|
|
|
|
|
2004-04-30 08:31:51 +05:30
|
|
|
all = GenericFilter.GenericFilter()
|
|
|
|
all.set_name(_("Entire Database"))
|
|
|
|
all.add_rule(GenericFilter.Everyone([]))
|
|
|
|
filter_list.append(all)
|
|
|
|
|
2004-04-28 09:36:25 +05:30
|
|
|
all = GenericFilter.GenericFilter()
|
|
|
|
all.set_name(_("Females"))
|
|
|
|
all.add_rule(GenericFilter.IsFemale([]))
|
|
|
|
filter_list.append(all)
|
|
|
|
|
|
|
|
all = GenericFilter.GenericFilter()
|
|
|
|
all.set_name(_("Males"))
|
|
|
|
all.add_rule(GenericFilter.IsMale([]))
|
|
|
|
filter_list.append(all)
|
2004-12-05 09:45:48 +05:30
|
|
|
|
|
|
|
all = GenericFilter.GenericFilter()
|
|
|
|
all.set_name(_("Disconnected individuals"))
|
|
|
|
all.add_rule(GenericFilter.Disconnected([]))
|
|
|
|
filter_list.append(all)
|
2004-04-28 09:36:25 +05:30
|
|
|
|
2004-04-30 08:31:51 +05:30
|
|
|
all = GenericFilter.ParamFilter()
|
|
|
|
all.set_name(_("Name contains..."))
|
|
|
|
all.add_rule(GenericFilter.SearchName([]))
|
2004-04-28 09:36:25 +05:30
|
|
|
filter_list.append(all)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-03-11 00:31:00 +05:30
|
|
|
all = GenericFilter.GenericFilter()
|
|
|
|
all.set_name(_("People who were adopted"))
|
|
|
|
all.add_rule(GenericFilter.HaveAltFamilies([]))
|
|
|
|
filter_list.append(all)
|
|
|
|
|
|
|
|
all = GenericFilter.GenericFilter()
|
|
|
|
all.set_name(_("People who have images"))
|
|
|
|
all.add_rule(GenericFilter.HavePhotos([]))
|
|
|
|
filter_list.append(all)
|
|
|
|
|
|
|
|
all = GenericFilter.GenericFilter()
|
|
|
|
all.set_name(_("People with incomplete names"))
|
|
|
|
all.add_rule(GenericFilter.IncompleteNames([]))
|
|
|
|
filter_list.append(all)
|
|
|
|
|
|
|
|
all = GenericFilter.GenericFilter()
|
|
|
|
all.set_name(_("People with children"))
|
|
|
|
all.add_rule(GenericFilter.HaveChildren([]))
|
|
|
|
filter_list.append(all)
|
|
|
|
|
|
|
|
all = GenericFilter.GenericFilter()
|
|
|
|
all.set_name(_("People with no marriage records"))
|
|
|
|
all.add_rule(GenericFilter.NeverMarried([]))
|
|
|
|
filter_list.append(all)
|
|
|
|
|
|
|
|
all = GenericFilter.GenericFilter()
|
|
|
|
all.set_name(_("People without a birth date"))
|
|
|
|
all.add_rule(GenericFilter.NoBirthdate([]))
|
|
|
|
filter_list.append(all)
|
|
|
|
|
|
|
|
all = GenericFilter.GenericFilter()
|
|
|
|
all.set_name(_("People with multiple marriage records"))
|
|
|
|
all.add_rule(GenericFilter.MultipleMarriages([]))
|
|
|
|
filter_list.append(all)
|
|
|
|
|
2005-01-07 10:04:02 +05:30
|
|
|
self.filter_model = GenericFilter.FilterStore(filter_list)
|
|
|
|
self.filter_list.set_model(self.filter_model)
|
|
|
|
self.filter_list.set_active(self.filter_model.default_index())
|
2004-04-30 08:31:51 +05:30
|
|
|
self.filter_list.connect('changed',self.on_filter_name_changed)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.filter_text.set_sensitive(0)
|
|
|
|
|
2003-01-12 05:13:24 +05:30
|
|
|
def home_page_activate(self,obj):
|
2003-01-10 19:22:32 +05:30
|
|
|
gnome.url_show(_HOMEPAGE)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-01-12 05:13:24 +05:30
|
|
|
def mailing_lists_activate(self,obj):
|
2003-01-10 19:22:32 +05:30
|
|
|
gnome.url_show(_MAILLIST)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-01-12 05:13:24 +05:30
|
|
|
def report_bug_activate(self,obj):
|
2003-01-10 19:22:32 +05:30
|
|
|
gnome.url_show(_BUGREPORT)
|
2002-12-14 10:37:09 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def on_merge_activate(self,obj):
|
|
|
|
"""Calls up the merge dialog for the selection"""
|
2003-03-27 08:46:09 +05:30
|
|
|
page = self.views.get_current_page()
|
2003-08-26 09:15:41 +05:30
|
|
|
if page == PERSON_VIEW:
|
2002-12-14 10:37:09 +05:30
|
|
|
|
2004-03-09 10:42:14 +05:30
|
|
|
mlist = self.people_view.get_selected_objects()
|
2002-12-14 10:37:09 +05:30
|
|
|
|
|
|
|
if len(mlist) != 2:
|
2003-02-24 10:21:57 +05:30
|
|
|
msg = _("Cannot merge people.")
|
|
|
|
msg2 = _("Exactly two people must be selected to perform a merge. "
|
|
|
|
"A second person can be selected by holding down the "
|
2003-09-30 09:49:35 +05:30
|
|
|
"control key while clicking on the desired person.")
|
2003-02-24 10:21:57 +05:30
|
|
|
ErrorDialog(msg,msg2)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
|
|
|
import MergeData
|
2004-08-07 10:46:57 +05:30
|
|
|
p1 = self.db.get_person_from_handle(mlist[0])
|
|
|
|
p2 = self.db.get_person_from_handle(mlist[1])
|
2004-02-21 12:10:44 +05:30
|
|
|
MergeData.MergePeople(self,self.db,p1,p2,self.merge_update,
|
2002-10-27 09:13:12 +05:30
|
|
|
self.update_after_edit)
|
2003-08-26 09:15:41 +05:30
|
|
|
elif page == PLACE_VIEW:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.place_view.merge()
|
|
|
|
|
|
|
|
def delete_event(self,widget, event):
|
|
|
|
"""Catch the destruction of the top window, prompt to save if needed"""
|
|
|
|
self.on_exit_activate(widget)
|
|
|
|
return 1
|
|
|
|
|
|
|
|
def on_exit_activate(self,obj):
|
|
|
|
"""Prompt to save on exit if needed"""
|
2004-02-29 01:45:48 +05:30
|
|
|
self.db.close()
|
2004-04-28 09:36:25 +05:30
|
|
|
gtk.main_quit()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def quit(self):
|
|
|
|
"""Catch the reponse to the save on exit question"""
|
|
|
|
self.db.close()
|
2004-04-28 09:36:25 +05:30
|
|
|
gtk.main_quit()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-05-19 23:47:35 +05:30
|
|
|
def close_noquit(self):
|
|
|
|
"""Close database and delete abandoned photos, no quit"""
|
|
|
|
self.db.close()
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def on_about_activate(self,obj):
|
|
|
|
"""Displays the about box. Called from Help menu"""
|
|
|
|
pixbuf = gtk.gdk.pixbuf_new_from_file(const.logo)
|
2003-04-06 05:09:22 +05:30
|
|
|
|
|
|
|
if const.translators[0:11] == "TRANSLATORS":
|
2003-04-06 10:37:36 +05:30
|
|
|
trans = ''
|
2003-04-06 05:09:22 +05:30
|
|
|
else:
|
|
|
|
trans = const.translators
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
gnome.ui.About(const.progName,
|
|
|
|
const.version,
|
|
|
|
const.copyright,
|
|
|
|
const.comments,
|
|
|
|
const.authors,
|
|
|
|
const.documenters,
|
2003-04-06 05:09:22 +05:30
|
|
|
trans,
|
2002-10-20 19:55:16 +05:30
|
|
|
pixbuf).show()
|
|
|
|
|
|
|
|
def on_contents_activate(self,obj):
|
|
|
|
"""Display the GRAMPS manual"""
|
2004-05-24 10:02:19 +05:30
|
|
|
try:
|
|
|
|
gnome.help_display('gramps-manual','index')
|
|
|
|
except gobject.GError, msg:
|
2004-07-28 07:59:07 +05:30
|
|
|
ErrorDialog(_("Could not open help"),str(msg))
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-11-27 00:45:24 +05:30
|
|
|
def on_faq_activate(self,obj):
|
|
|
|
"""Display FAQ"""
|
2004-05-24 10:02:19 +05:30
|
|
|
try:
|
|
|
|
gnome.help_display('gramps-manual','faq')
|
|
|
|
except gobject.GError, msg:
|
2004-07-28 07:59:07 +05:30
|
|
|
ErrorDialog(_("Could not open help"),str(msg))
|
2003-11-27 00:45:24 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def on_new_clicked(self,obj):
|
|
|
|
"""Prompt for permission to close the current database"""
|
2004-06-28 23:46:42 +05:30
|
|
|
prompter = DbPrompter.NewNativeDbPrompter(self,self.topWindow)
|
|
|
|
prompter.chooser()
|
2003-05-08 22:42:10 +05:30
|
|
|
|
2003-11-02 01:25:30 +05:30
|
|
|
def clear_database(self):
|
2003-05-08 22:42:10 +05:30
|
|
|
"""Clear out the database if permission was granted"""
|
2004-03-08 03:20:41 +05:30
|
|
|
return
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def tool_callback(self,val):
|
|
|
|
if val:
|
2003-06-30 08:37:24 +05:30
|
|
|
self.import_tool_callback()
|
2003-06-26 08:23:04 +05:30
|
|
|
|
2003-06-30 08:37:24 +05:30
|
|
|
def import_tool_callback(self):
|
2004-08-19 22:05:07 +05:30
|
|
|
home = self.db.get_default_person()
|
|
|
|
if home:
|
|
|
|
self.change_active_person(home)
|
|
|
|
self.update_display(0)
|
2004-11-10 10:04:48 +05:30
|
|
|
self.goto_active_person()
|
2004-06-29 09:21:49 +05:30
|
|
|
self.full_update()
|
|
|
|
|
|
|
|
def full_update(self):
|
|
|
|
"""Brute force display update, updating all the pages"""
|
2004-06-27 23:38:19 +05:30
|
|
|
self.people_view.person_model.rebuild_data()
|
2003-11-07 21:59:27 +05:30
|
|
|
if Utils.wasHistory_broken():
|
|
|
|
self.clear_history()
|
2004-06-22 04:54:51 +05:30
|
|
|
Utils.clearHistory_broken()
|
2004-06-27 23:38:19 +05:30
|
|
|
self.people_view.change_db(self.db)
|
2004-05-05 09:24:02 +05:30
|
|
|
self.people_view.apply_filter()
|
2003-09-12 08:47:42 +05:30
|
|
|
if not self.active_person:
|
|
|
|
self.change_active_person(self.find_initial_person())
|
2004-11-06 09:11:21 +05:30
|
|
|
self.goto_active_person()
|
2004-05-24 10:02:19 +05:30
|
|
|
|
|
|
|
self.place_view.change_db(self.db)
|
|
|
|
self.source_view.change_db(self.db)
|
|
|
|
self.media_view.change_db(self.db)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-02-24 07:10:40 +05:30
|
|
|
def update_display(self,changed=True):
|
2002-10-20 19:55:16 +05:30
|
|
|
"""Incremental display update, update only the displayed page"""
|
2003-03-27 08:46:09 +05:30
|
|
|
page = self.views.get_current_page()
|
2003-08-26 09:15:41 +05:30
|
|
|
if page == PERSON_VIEW:
|
2004-05-02 09:40:33 +05:30
|
|
|
self.people_view.apply_filter()
|
2003-08-26 09:15:41 +05:30
|
|
|
elif page == FAMILY_VIEW1 or page == FAMILY_VIEW2:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.family_view.load_family()
|
2003-08-26 09:15:41 +05:30
|
|
|
elif page == PEDIGREE_VIEW:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.pedigree_view.load_canvas(self.active_person)
|
|
|
|
|
|
|
|
def on_tools_clicked(self,obj):
|
|
|
|
if self.active_person:
|
2004-02-28 09:21:59 +05:30
|
|
|
Plugins.ToolPlugins(self,self.db,self.active_person,
|
2002-10-20 19:55:16 +05:30
|
|
|
self.tool_callback)
|
|
|
|
|
|
|
|
def on_reports_clicked(self,obj):
|
|
|
|
if self.active_person:
|
2004-02-28 09:21:59 +05:30
|
|
|
Plugins.ReportPlugins(self,self.db,self.active_person)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-06-21 10:40:27 +05:30
|
|
|
def read_pkg(self,filename):
|
|
|
|
# Create tempdir, if it does not exist, then check for writability
|
|
|
|
tmpdir_path = os.path.expanduser("~/.gramps/tmp" )
|
|
|
|
if not os.path.isdir(tmpdir_path):
|
|
|
|
try:
|
|
|
|
os.mkdir(tmpdir_path,0700)
|
|
|
|
except:
|
|
|
|
DisplayTrace.DisplayTrace()
|
|
|
|
return
|
|
|
|
elif not os.access(tmpdir_path,os.W_OK):
|
|
|
|
ErrorDialog( _("Cannot unpak archive"),
|
|
|
|
_("Temporary directory %s is not writable") % tmpdir_path )
|
|
|
|
return
|
|
|
|
else: # tempdir exists and writable -- clean it up if not empty
|
|
|
|
files = os.listdir(tmpdir_path) ;
|
|
|
|
for fn in files:
|
|
|
|
os.remove( os.path.join(tmpdir_path,fn) )
|
|
|
|
|
|
|
|
try:
|
|
|
|
import TarFile
|
|
|
|
t = TarFile.ReadTarFile(filename,tmpdir_path)
|
|
|
|
t.extract()
|
|
|
|
t.close()
|
2002-10-20 19:55:16 +05:30
|
|
|
except:
|
|
|
|
DisplayTrace.DisplayTrace()
|
2004-06-21 10:40:27 +05:30
|
|
|
return
|
|
|
|
|
|
|
|
dbname = os.path.join(tmpdir_path,const.xmlFile)
|
|
|
|
|
|
|
|
try:
|
|
|
|
import ReadXML
|
|
|
|
ReadXML.importData(self.db,dbname,None)
|
|
|
|
except:
|
|
|
|
DisplayTrace.DisplayTrace()
|
|
|
|
|
|
|
|
# Clean up tempdir after ourselves
|
|
|
|
files = os.listdir(tmpdir_path)
|
|
|
|
for fn in files:
|
|
|
|
os.remove(os.path.join(tmpdir_path,fn))
|
|
|
|
os.rmdir(tmpdir_path)
|
|
|
|
self.import_tool_callback()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-12-20 05:07:40 +05:30
|
|
|
def read_file(self,filename,callback=None):
|
2005-02-24 05:55:34 +05:30
|
|
|
self.topWindow.set_resizable(False)
|
2005-02-17 04:19:54 +05:30
|
|
|
mode = "w"
|
2003-02-24 10:21:57 +05:30
|
|
|
filename = os.path.normpath(os.path.abspath(filename))
|
2004-04-10 09:08:48 +05:30
|
|
|
|
|
|
|
if os.path.isdir(filename):
|
|
|
|
ErrorDialog(_('Cannot open database'),
|
|
|
|
_('The selected file is a directory, not '
|
|
|
|
'a file.\nA GRAMPS database must be a file.'))
|
|
|
|
return 0
|
|
|
|
elif os.path.exists(filename):
|
|
|
|
if not os.access(filename,os.R_OK):
|
|
|
|
ErrorDialog(_('Cannot open database'),
|
|
|
|
_('You do not have read access to the selected '
|
|
|
|
'file.'))
|
|
|
|
return 0
|
|
|
|
elif not os.access(filename,os.W_OK):
|
2005-02-17 04:19:54 +05:30
|
|
|
mode = "r"
|
|
|
|
WarningDialog(_('Read only database'),
|
|
|
|
_('You do not have write access to the selected '
|
|
|
|
'file.'))
|
|
|
|
|
2005-02-18 10:19:59 +05:30
|
|
|
try:
|
|
|
|
if self.load_database(filename,callback,mode=mode) == 1:
|
|
|
|
if filename[-1] == '/':
|
|
|
|
filename = filename[:-1]
|
|
|
|
name = os.path.basename(filename)
|
|
|
|
if self.db.readonly:
|
|
|
|
self.topWindow.set_title("%s (%s) - GRAMPS" % (name,_('Read Only')))
|
|
|
|
else:
|
|
|
|
self.topWindow.set_title("%s - GRAMPS" % name)
|
|
|
|
else:
|
|
|
|
GrampsKeys.save_last_file("")
|
|
|
|
ErrorDialog(_('Cannot open database'),
|
|
|
|
_('The database file specified could not be opened.'))
|
|
|
|
return 0
|
|
|
|
except db.DBAccessError, msg:
|
2004-04-10 09:08:48 +05:30
|
|
|
ErrorDialog(_('Cannot open database'),
|
2005-02-18 10:19:59 +05:30
|
|
|
_('%s could not be opened.' % filename) + '\n' + msg[1])
|
2004-04-10 09:08:48 +05:30
|
|
|
return 0
|
2005-02-18 10:19:59 +05:30
|
|
|
|
|
|
|
|
2005-02-24 05:55:34 +05:30
|
|
|
self.topWindow.set_resizable(True)
|
2005-02-18 10:19:59 +05:30
|
|
|
self.gtop.get_widget('import1').set_sensitive(not self.db.readonly)
|
|
|
|
self.gtop.get_widget('abandon').set_sensitive(not self.db.readonly)
|
|
|
|
self.gtop.get_widget('undolabel').set_sensitive(not self.db.readonly)
|
|
|
|
self.gtop.get_widget('redolabel').set_sensitive(not self.db.readonly)
|
|
|
|
self.gtop.get_widget('add_item').set_sensitive(not self.db.readonly)
|
|
|
|
self.gtop.get_widget('remove_item').set_sensitive(not self.db.readonly)
|
|
|
|
self.gtop.get_widget('merge').set_sensitive(not self.db.readonly)
|
|
|
|
self.gtop.get_widget('default_person1').set_sensitive(not self.db.readonly)
|
|
|
|
self.gtop.get_widget('edit_bookmarks').set_sensitive(not self.db.readonly)
|
|
|
|
self.gtop.get_widget('tools_menu').set_sensitive(not self.db.readonly)
|
|
|
|
self.gtop.get_widget('tools').set_sensitive(not self.db.readonly)
|
2004-05-01 19:38:36 +05:30
|
|
|
self.goto_active_person()
|
2005-02-24 07:10:40 +05:30
|
|
|
self.update_display()
|
2004-04-10 09:08:48 +05:30
|
|
|
return 1
|
2003-05-17 09:44:13 +05:30
|
|
|
|
2003-05-12 09:00:30 +05:30
|
|
|
def save_media(self,filename):
|
2004-01-18 07:29:30 +05:30
|
|
|
missmedia_action = 0
|
2003-05-14 06:09:10 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
def remove_clicked():
|
|
|
|
# File is lost => remove all references and the object itself
|
2004-07-28 07:59:07 +05:30
|
|
|
for p in self.db.get_family_handle_map().values():
|
2004-02-21 11:41:59 +05:30
|
|
|
nl = p.get_media_list()
|
2003-05-14 06:09:10 +05:30
|
|
|
for o in nl:
|
2004-07-28 07:59:07 +05:30
|
|
|
if o.get_reference_handle() == ObjectId:
|
2003-05-14 06:09:10 +05:30
|
|
|
nl.remove(o)
|
2004-02-21 11:41:59 +05:30
|
|
|
p.set_media_list(nl)
|
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-02-21 11:41:59 +05:30
|
|
|
nl = p.get_media_list()
|
2003-05-14 06:09:10 +05:30
|
|
|
for o in nl:
|
2004-07-28 07:59:07 +05:30
|
|
|
if o.get_reference_handle() == ObjectId:
|
2003-05-14 06:09:10 +05:30
|
|
|
nl.remove(o)
|
2004-02-21 11:41:59 +05:30
|
|
|
p.set_media_list(nl)
|
2004-08-13 10:04:07 +05:30
|
|
|
for key in self.db.get_source_handles():
|
2004-08-07 10:46:57 +05:30
|
|
|
p = self.db.get_source_from_handle(key)
|
2004-02-21 11:41:59 +05:30
|
|
|
nl = p.get_media_list()
|
2003-05-14 06:09:10 +05:30
|
|
|
for o in nl:
|
2004-07-28 07:59:07 +05:30
|
|
|
if o.get_reference_handle() == ObjectId:
|
2003-05-14 06:09:10 +05:30
|
|
|
nl.remove(o)
|
2004-02-21 11:41:59 +05:30
|
|
|
p.set_media_list(nl)
|
2004-08-13 10:04:07 +05:30
|
|
|
for key in self.db.get_place_handles():
|
2004-08-07 10:46:57 +05:30
|
|
|
p = self.db.get_place_from_handle(key)
|
2004-02-21 11:41:59 +05:30
|
|
|
nl = p.get_media_list()
|
2003-05-14 06:09:10 +05:30
|
|
|
for o in nl:
|
2004-07-28 07:59:07 +05:30
|
|
|
if o.get_reference_handle() == ObjectId:
|
2003-05-14 06:09:10 +05:30
|
|
|
nl.remove(o)
|
2004-02-21 11:41:59 +05:30
|
|
|
p.set_media_list(nl)
|
2004-03-30 10:20:24 +05:30
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
trans = self.db.transaction_begin()
|
2004-03-30 10:20:24 +05:30
|
|
|
self.db.remove_object(ObjectId)
|
2004-08-13 10:04:07 +05:30
|
|
|
self.db.transaction_commit(trans,_("Save Media Object"))
|
2003-05-14 06:09:10 +05:30
|
|
|
|
|
|
|
def leave_clicked():
|
|
|
|
# File is lost => do nothing, leave as is
|
|
|
|
pass
|
|
|
|
|
|
|
|
def select_clicked():
|
2004-05-03 09:17:29 +05:30
|
|
|
choose = gtk.FileChooserDialog('Open GRAMPS database',
|
|
|
|
None,
|
|
|
|
gtk.FILE_CHOOSER_ACTION_OPEN,
|
|
|
|
(gtk.STOCK_CANCEL,
|
|
|
|
gtk.RESPONSE_CANCEL,
|
|
|
|
gtk.STOCK_OPEN,
|
|
|
|
gtk.RESPONSE_OK))
|
|
|
|
|
2004-10-06 09:12:54 +05:30
|
|
|
mime_filter = gtk.FileFilter()
|
|
|
|
mime_filter.set_name(_('All files'))
|
|
|
|
mime_filter.add_pattern('*')
|
|
|
|
choose.add_filter(mime_filter)
|
2004-05-03 09:17:29 +05:30
|
|
|
|
|
|
|
response = choose.run()
|
|
|
|
if response == gtk.RESPONSE_OK:
|
|
|
|
name = choose.get_filename()
|
2003-05-14 06:09:10 +05:30
|
|
|
if os.path.isfile(name):
|
2004-10-06 09:12:54 +05:30
|
|
|
obj = self.db.get_object_from_handle(ObjectId)
|
|
|
|
obj.set_path(name)
|
2004-05-03 09:17:29 +05:30
|
|
|
choose.destroy()
|
|
|
|
|
2003-05-14 06:09:10 +05:30
|
|
|
#-------------------------------------------------------------------------
|
2004-08-13 10:04:07 +05:30
|
|
|
for ObjectId in self.db.get_media_object_handles():
|
2004-10-06 09:12:54 +05:30
|
|
|
obj = self.db.get_object_from_handle(ObjectId)
|
2004-03-01 10:03:36 +05:30
|
|
|
if 0:
|
2004-10-06 09:12:54 +05:30
|
|
|
oldfile = obj.get_path()
|
2003-05-12 09:00:30 +05:30
|
|
|
(base,ext) = os.path.splitext(os.path.basename(oldfile))
|
|
|
|
newfile = os.path.join(filename,os.path.basename(oldfile))
|
2004-10-06 09:12:54 +05:30
|
|
|
obj.set_path(newfile)
|
2003-05-14 06:09:10 +05:30
|
|
|
if os.path.isfile(oldfile):
|
2003-05-12 09:00:30 +05:30
|
|
|
RelImage.import_media_object(oldfile,filename,base)
|
2003-05-14 06:09:10 +05:30
|
|
|
else:
|
2003-05-21 23:36:41 +05:30
|
|
|
if self.cl:
|
|
|
|
print "Warning: media file %s was not found," \
|
|
|
|
% os.path.basename(oldfile), "so it was ignored."
|
|
|
|
else:
|
|
|
|
# File is lost => ask what to do
|
2004-01-18 07:29:30 +05:30
|
|
|
if missmedia_action == 0:
|
|
|
|
mmd = MissingMediaDialog(_("Media object could not be found"),
|
2004-06-22 04:54:51 +05:30
|
|
|
_("%(file_name)s is referenced in the database, but no longer exists. "
|
2004-01-18 07:29:30 +05:30
|
|
|
"The file may have been deleted or moved to a different location. "
|
|
|
|
"You may choose to either remove the reference from the database, "
|
|
|
|
"keep the reference to the missing file, or select a new file."
|
|
|
|
) % { 'file_name' : oldfile },
|
|
|
|
remove_clicked, leave_clicked, select_clicked)
|
|
|
|
missmedia_action = mmd.default_action
|
|
|
|
elif missmedia_action == 1:
|
|
|
|
remove_clicked()
|
|
|
|
elif missmedia_action == 2:
|
|
|
|
leave_clicked()
|
|
|
|
elif missmedia_action == 3:
|
|
|
|
select_clicked()
|
2003-05-12 09:00:30 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def load_selected_people(self,obj):
|
|
|
|
"""Display the selected people in the EditPerson display"""
|
2004-03-09 10:42:14 +05:30
|
|
|
mlist = self.people_view.get_selected_objects()
|
2004-07-28 07:59:07 +05:30
|
|
|
if mlist and self.active_person.get_handle() == mlist[0]:
|
2002-11-17 04:52:33 +05:30
|
|
|
self.load_person(self.active_person)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def load_active_person(self,obj):
|
|
|
|
self.load_person(self.active_person)
|
2003-06-25 09:06:48 +05:30
|
|
|
|
|
|
|
def update_person_list(self,person):
|
2003-10-11 07:52:51 +05:30
|
|
|
self.people_view.add_to_person_list(person,0)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def load_new_person(self,obj):
|
2004-10-16 22:56:04 +05:30
|
|
|
person = RelLib.Person()
|
2002-10-20 19:55:16 +05:30
|
|
|
try:
|
2005-02-27 11:21:59 +05:30
|
|
|
EditPerson.EditPerson(self, person, self.db,
|
2005-03-10 06:32:09 +05:30
|
|
|
self.new_after_edit)
|
2002-10-20 19:55:16 +05:30
|
|
|
except:
|
|
|
|
DisplayTrace.DisplayTrace()
|
|
|
|
|
|
|
|
def delete_person_clicked(self,obj):
|
2003-10-13 09:53:34 +05:30
|
|
|
cpage = self.views.get_current_page()
|
|
|
|
if cpage == PERSON_VIEW:
|
2004-03-09 10:42:14 +05:30
|
|
|
mlist = self.people_view.get_selected_objects()
|
2003-10-13 09:53:34 +05:30
|
|
|
else:
|
2004-07-28 07:59:07 +05:30
|
|
|
mlist = [ self.active_person.get_handle() ]
|
2002-12-29 11:14:35 +05:30
|
|
|
|
2004-10-01 08:08:23 +05:30
|
|
|
if len(mlist) == 0:
|
|
|
|
return
|
|
|
|
|
2002-12-29 11:14:35 +05:30
|
|
|
for sel in mlist:
|
2004-08-07 10:46:57 +05:30
|
|
|
p = self.db.get_person_from_handle(sel)
|
2003-11-01 21:31:36 +05:30
|
|
|
self.active_person = p
|
2005-01-01 09:57:15 +05:30
|
|
|
name = NameDisplay.displayer.display(p)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-02-24 10:21:57 +05:30
|
|
|
QuestionDialog(_('Delete %s?') % name,
|
2003-07-17 08:07:28 +05:30
|
|
|
_('Deleting the person will remove the person '
|
2003-02-24 10:21:57 +05:30
|
|
|
'from the database. The data can only be '
|
|
|
|
'recovered by closing the database without saving '
|
|
|
|
'changes. This change will become permanent '
|
|
|
|
'after you save the database.'),
|
2003-03-23 09:20:59 +05:30
|
|
|
_('_Delete Person'),
|
2003-02-24 10:21:57 +05:30
|
|
|
self.delete_person_response)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-12-03 07:19:09 +05:30
|
|
|
def disable_interface(self):
|
|
|
|
self.remove_button.set_sensitive(False)
|
|
|
|
self.edit_button.set_sensitive(False)
|
|
|
|
self.add_button.set_sensitive(False)
|
|
|
|
|
|
|
|
def enable_interface(self):
|
|
|
|
self.remove_button.set_sensitive(True)
|
|
|
|
self.edit_button.set_sensitive(True)
|
|
|
|
self.add_button.set_sensitive(True)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def delete_person_response(self):
|
2004-12-03 07:19:09 +05:30
|
|
|
self.disable_interface()
|
2004-08-13 10:04:07 +05:30
|
|
|
trans = self.db.transaction_begin()
|
2004-03-30 10:20:24 +05:30
|
|
|
|
2004-05-24 10:02:19 +05:30
|
|
|
n = self.active_person.get_primary_name().get_regular_name()
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if self.db.get_default_person() == self.active_person:
|
2004-08-13 10:04:07 +05:30
|
|
|
self.db.set_default_person_handle(None)
|
2004-01-12 09:05:02 +05:30
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
for family_handle in self.active_person.get_family_handle_list():
|
|
|
|
if not family_handle:
|
2003-09-30 09:01:14 +05:30
|
|
|
continue
|
2004-08-20 03:05:16 +05:30
|
|
|
family = self.db.get_family_from_handle(family_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
if self.active_person.get_handle() == family.get_father_handle():
|
|
|
|
if family.get_mother_handle() == None:
|
|
|
|
for child_handle in family.get_child_handle_list():
|
2004-08-07 10:46:57 +05:30
|
|
|
child = self.db.get_person_from_handle(child_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
child.remove_parent_family_handle(family.get_handle())
|
2004-03-30 10:20:24 +05:30
|
|
|
self.db.commit_person(child,trans)
|
2004-07-28 07:59:07 +05:30
|
|
|
self.db.delete_family(family.get_handle(),trans)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-07-28 07:59:07 +05:30
|
|
|
family.set_father_handle(None)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-07-28 07:59:07 +05:30
|
|
|
if family.get_father_handle() == None:
|
|
|
|
for child_handle in family.get_child_handle_list():
|
2004-08-07 10:46:57 +05:30
|
|
|
child = self.db.get_person_from_handle(child_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
child.remove_parent_family_handle(family)
|
2004-03-30 10:20:24 +05:30
|
|
|
self.db.commit_person(child,trans)
|
|
|
|
self.db.delete_family(family,trans)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-07-28 07:59:07 +05:30
|
|
|
family.set_mother_handle(None)
|
2004-03-30 10:20:24 +05:30
|
|
|
self.db.commit_family(family,trans)
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
for (family_handle,mrel,frel) in self.active_person.get_parent_family_handle_list():
|
|
|
|
if family_handle:
|
2004-08-20 03:05:16 +05:30
|
|
|
family = self.db.get_family_from_handle(family_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
family.remove_child_handle(self.active_person.get_handle())
|
2004-03-30 10:20:24 +05:30
|
|
|
self.db.commit_family(family,trans)
|
2004-04-28 09:36:25 +05:30
|
|
|
|
2004-10-06 09:12:54 +05:30
|
|
|
handle = self.active_person.get_handle()
|
2004-10-01 08:08:23 +05:30
|
|
|
|
|
|
|
person = self.active_person
|
|
|
|
self.people_view.remove_from_person_list(person)
|
2004-10-06 09:12:54 +05:30
|
|
|
self.people_view.remove_from_history(handle)
|
|
|
|
self.db.remove_person(handle, trans)
|
2004-10-01 08:08:23 +05:30
|
|
|
self.people_view.delete_person(person)
|
|
|
|
self.people_view.person_model.rebuild_data()
|
2003-10-07 04:19:16 +05:30
|
|
|
|
2003-10-13 09:53:34 +05:30
|
|
|
if self.hindex >= 0:
|
2004-08-07 10:46:57 +05:30
|
|
|
self.active_person = self.db.get_person_from_handle(self.history[self.hindex])
|
2003-10-13 08:42:27 +05:30
|
|
|
else:
|
|
|
|
self.change_active_person(None)
|
2004-11-06 09:11:21 +05:30
|
|
|
self.goto_active_person()
|
2004-08-13 10:04:07 +05:30
|
|
|
self.db.transaction_commit(trans,_("Delete Person (%s)") % n)
|
2003-10-13 09:53:34 +05:30
|
|
|
self.redraw_histmenu()
|
2004-12-03 07:19:09 +05:30
|
|
|
self.enable_interface()
|
2004-01-12 09:05:02 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def merge_update(self,p1,p2,old_id):
|
2003-10-05 10:04:31 +05:30
|
|
|
self.people_view.remove_from_person_list(p1,old_id)
|
|
|
|
self.people_view.remove_from_person_list(p2)
|
2003-10-07 04:19:16 +05:30
|
|
|
self.people_view.remove_from_history(p1,old_id)
|
|
|
|
self.people_view.remove_from_history(p2)
|
|
|
|
self.redraw_histmenu()
|
2003-10-05 10:04:31 +05:30
|
|
|
self.people_view.redisplay_person_list(p1)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.update_display(0)
|
|
|
|
|
2004-08-29 01:19:34 +05:30
|
|
|
def goto_active_person(self):
|
|
|
|
self.people_view.goto_active_person()
|
2003-03-17 07:58:43 +05:30
|
|
|
|
2004-03-30 10:20:24 +05:30
|
|
|
def change_active_person(self,person,force=0):
|
2004-03-25 09:34:35 +05:30
|
|
|
if person == None:
|
|
|
|
self.set_buttons(0)
|
|
|
|
self.active_person = None
|
|
|
|
self.modify_statusbar()
|
2004-12-03 07:19:09 +05:30
|
|
|
elif (self.active_person == None or
|
|
|
|
person.get_handle() != self.active_person.get_handle()):
|
2004-08-07 10:46:57 +05:30
|
|
|
self.active_person = self.db.get_person_from_handle(person.get_handle())
|
2003-04-04 11:18:25 +05:30
|
|
|
self.modify_statusbar()
|
2004-03-30 10:20:24 +05:30
|
|
|
self.set_buttons(1)
|
2003-08-14 09:21:19 +05:30
|
|
|
if person:
|
|
|
|
if self.hindex+1 < len(self.history):
|
|
|
|
self.history = self.history[0:self.hindex+1]
|
2003-08-19 20:16:34 +05:30
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
self.history.append(person.get_handle())
|
|
|
|
self.mhistory.append(person.get_handle())
|
2003-08-19 20:16:34 +05:30
|
|
|
self.hindex += 1
|
|
|
|
self.redraw_histmenu()
|
|
|
|
|
|
|
|
if self.hindex+1 < len(self.history):
|
2003-08-16 08:52:56 +05:30
|
|
|
self.fwdbtn.set_sensitive(1)
|
2003-08-16 10:36:24 +05:30
|
|
|
self.forward.set_sensitive(1)
|
2003-08-16 08:52:56 +05:30
|
|
|
else:
|
|
|
|
self.fwdbtn.set_sensitive(0)
|
2003-08-16 10:36:24 +05:30
|
|
|
self.forward.set_sensitive(0)
|
2003-08-17 09:31:52 +05:30
|
|
|
|
2003-08-16 10:36:24 +05:30
|
|
|
if self.hindex > 0:
|
|
|
|
self.backbtn.set_sensitive(1)
|
|
|
|
self.back.set_sensitive(1)
|
|
|
|
else:
|
|
|
|
self.backbtn.set_sensitive(0)
|
|
|
|
self.back.set_sensitive(0)
|
2004-03-30 10:20:24 +05:30
|
|
|
else:
|
2004-08-07 10:46:57 +05:30
|
|
|
self.active_person = self.db.get_person_from_handle(person.get_handle())
|
2003-08-26 02:08:35 +05:30
|
|
|
self.set_buttons(1)
|
2003-03-12 08:32:08 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def modify_statusbar(self):
|
2003-03-23 01:56:44 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
if self.active_person == None:
|
2002-11-17 04:52:33 +05:30
|
|
|
self.status_text("")
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2005-01-06 22:58:31 +05:30
|
|
|
if GrampsKeys.get_statusbar() <= 1:
|
2005-01-01 09:57:15 +05:30
|
|
|
pname = NameDisplay.displayer.display(self.active_person)
|
2004-06-27 08:40:06 +05:30
|
|
|
name = "[%s] %s" % (self.active_person.get_gramps_id(),pname)
|
2003-03-23 01:56:44 +05:30
|
|
|
else:
|
2003-04-30 05:54:32 +05:30
|
|
|
name = self.display_relationship()
|
2002-11-17 04:52:33 +05:30
|
|
|
self.status_text(name)
|
2002-10-20 19:55:16 +05:30
|
|
|
return 0
|
2003-04-30 05:54:32 +05:30
|
|
|
|
|
|
|
def display_relationship(self):
|
2004-03-22 10:11:35 +05:30
|
|
|
default_person = self.db.get_default_person()
|
|
|
|
if not default_person:
|
|
|
|
return u''
|
2003-04-30 05:54:32 +05:30
|
|
|
try:
|
2005-01-01 09:57:15 +05:30
|
|
|
pname = NameDisplay.displayer.display(default_person)
|
2004-02-16 02:58:31 +05:30
|
|
|
(name,plist) = self.relationship.get_relationship(
|
2004-03-22 10:11:35 +05:30
|
|
|
default_person,
|
2004-02-16 02:58:31 +05:30
|
|
|
self.active_person)
|
2004-10-29 06:19:40 +05:30
|
|
|
|
2003-04-30 05:54:32 +05:30
|
|
|
if name:
|
2003-11-20 09:48:10 +05:30
|
|
|
if plist == None:
|
|
|
|
return name
|
2004-03-25 09:34:35 +05:30
|
|
|
return _("%(relationship)s of %(person)s") % {
|
|
|
|
'relationship' : name, 'person' : pname }
|
2003-04-30 05:54:32 +05:30
|
|
|
else:
|
2004-10-06 09:12:54 +05:30
|
|
|
return u""
|
2003-04-30 05:54:32 +05:30
|
|
|
except:
|
|
|
|
DisplayTrace.DisplayTrace()
|
2004-10-06 09:12:54 +05:30
|
|
|
return u""
|
2004-06-22 04:54:51 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def on_open_activate(self,obj):
|
2004-06-28 23:46:42 +05:30
|
|
|
prompter = DbPrompter.ExistingDbPrompter(self,self.topWindow)
|
|
|
|
prompter.chooser()
|
2004-05-03 09:17:29 +05:30
|
|
|
|
2004-06-26 11:09:43 +05:30
|
|
|
def on_import_activate(self,obj):
|
2004-06-28 23:46:42 +05:30
|
|
|
prompter = DbPrompter.ImportDbPrompter(self,self.topWindow)
|
|
|
|
prompter.chooser()
|
2005-02-24 10:16:45 +05:30
|
|
|
self.update_display()
|
2004-06-26 11:09:43 +05:30
|
|
|
|
2005-01-31 05:23:47 +05:30
|
|
|
def on_saveas_activate(self,obj):
|
|
|
|
prompter = DbPrompter.NewSaveasDbPrompter(self,self.topWindow)
|
|
|
|
prompter.chooser()
|
|
|
|
|
2004-06-26 11:09:43 +05:30
|
|
|
def on_export_activate(self,obj):
|
2004-07-09 23:49:47 +05:30
|
|
|
Exporter.Exporter(self,self.topWindow)
|
2004-06-26 11:09:43 +05:30
|
|
|
|
2004-02-29 01:45:48 +05:30
|
|
|
def on_revert_activate(self,obj):
|
|
|
|
pass
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_person_list1_activate(self,obj):
|
|
|
|
"""Switches to the person list view"""
|
2003-08-26 09:15:41 +05:30
|
|
|
self.views.set_current_page(PERSON_VIEW)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-08-26 09:56:09 +05:30
|
|
|
def on_family_activate(self,obj):
|
|
|
|
"""Switches to the family view"""
|
2005-01-06 22:58:31 +05:30
|
|
|
if GrampsKeys.get_family_view() == 0:
|
2003-08-26 09:56:09 +05:30
|
|
|
self.on_family1_activate(obj)
|
|
|
|
else:
|
|
|
|
self.on_family2_activate(obj)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def on_family1_activate(self,obj):
|
|
|
|
"""Switches to the family view"""
|
2003-08-26 09:15:41 +05:30
|
|
|
self.views.set_current_page(FAMILY_VIEW1)
|
|
|
|
|
|
|
|
def on_family2_activate(self,obj):
|
|
|
|
"""Switches to the family view"""
|
|
|
|
self.views.set_current_page(FAMILY_VIEW2)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_pedigree1_activate(self,obj):
|
|
|
|
"""Switches to the pedigree view"""
|
2003-08-26 09:15:41 +05:30
|
|
|
self.views.set_current_page(PEDIGREE_VIEW)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_sources_activate(self,obj):
|
|
|
|
"""Switches to the sources view"""
|
2003-08-26 09:15:41 +05:30
|
|
|
self.views.set_current_page(SOURCE_VIEW)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_places_activate(self,obj):
|
|
|
|
"""Switches to the places view"""
|
2004-06-20 08:36:21 +05:30
|
|
|
self.status_text(_('Updating display...'))
|
2003-08-26 09:15:41 +05:30
|
|
|
self.views.set_current_page(PLACE_VIEW)
|
2003-07-27 09:20:57 +05:30
|
|
|
self.modify_statusbar()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_media_activate(self,obj):
|
|
|
|
"""Switches to the media view"""
|
2003-08-26 09:15:41 +05:30
|
|
|
self.views.set_current_page(MEDIA_VIEW)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-03-27 08:46:09 +05:30
|
|
|
def on_views_switch_page(self,obj,junk,page):
|
2002-10-20 19:55:16 +05:30
|
|
|
"""Load the appropriate page after a notebook switch"""
|
2003-08-26 09:15:41 +05:30
|
|
|
if page == PERSON_VIEW:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.enable_buttons(1)
|
2003-10-05 01:32:38 +05:30
|
|
|
self.people_view.goto_active_person()
|
2002-10-20 19:55:16 +05:30
|
|
|
self.merge_button.set_sensitive(1)
|
2003-08-26 09:15:41 +05:30
|
|
|
elif page == FAMILY_VIEW1 or page == FAMILY_VIEW2:
|
2003-10-13 08:42:27 +05:30
|
|
|
self.enable_buttons(1)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.merge_button.set_sensitive(0)
|
|
|
|
self.family_view.load_family()
|
2003-08-26 09:15:41 +05:30
|
|
|
elif page == PEDIGREE_VIEW:
|
2002-10-27 09:13:12 +05:30
|
|
|
self.enable_buttons(0)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.merge_button.set_sensitive(0)
|
|
|
|
self.pedigree_view.load_canvas(self.active_person)
|
2003-08-26 09:15:41 +05:30
|
|
|
elif page == SOURCE_VIEW:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.enable_buttons(1)
|
|
|
|
self.merge_button.set_sensitive(0)
|
2003-08-26 09:15:41 +05:30
|
|
|
elif page == PLACE_VIEW:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.enable_buttons(1)
|
|
|
|
self.merge_button.set_sensitive(1)
|
2003-08-26 09:15:41 +05:30
|
|
|
elif page == MEDIA_VIEW:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.enable_buttons(1)
|
|
|
|
self.merge_button.set_sensitive(0)
|
|
|
|
|
|
|
|
def on_apply_filter_clicked(self,obj):
|
2003-10-05 01:32:38 +05:30
|
|
|
self.people_view.apply_filter_clicked()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_filter_name_changed(self,obj):
|
2005-01-07 10:04:02 +05:30
|
|
|
index = self.filter_list.get_active()
|
|
|
|
mime_filter = self.filter_model.get_filter(index)
|
2004-10-06 09:12:54 +05:30
|
|
|
qual = mime_filter.need_param
|
2002-10-20 19:55:16 +05:30
|
|
|
if qual:
|
2004-04-30 08:31:51 +05:30
|
|
|
self.filter_text.show()
|
|
|
|
self.filter_text.set_sensitive(1)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-04-30 08:31:51 +05:30
|
|
|
self.filter_text.hide()
|
|
|
|
self.filter_text.set_sensitive(0)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-08-26 09:33:11 +05:30
|
|
|
def new_after_edit(self,epo,val):
|
2005-03-10 06:32:09 +05:30
|
|
|
self.active_person = epo.person
|
|
|
|
pn = self.active_person.get_primary_name()
|
|
|
|
|
|
|
|
mapname = self.db.get_name_group_mapping(pn.get_group_name())
|
|
|
|
|
|
|
|
self.people_view.build_tree()
|
|
|
|
self.family_view.load_family()
|
|
|
|
self.place_view.build_tree()
|
|
|
|
self.source_view.build_tree()
|
|
|
|
self.update_display(0)
|
|
|
|
self.goto_active_person()
|
2004-08-26 09:33:11 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def update_after_newchild(self,family,person,plist):
|
|
|
|
self.family_view.load_family(family)
|
2003-10-05 01:32:38 +05:30
|
|
|
self.people_view.redisplay_person_list(person)
|
2002-10-20 19:55:16 +05:30
|
|
|
for p in plist:
|
|
|
|
self.place_view.new_place_after_edit(p)
|
|
|
|
|
2004-03-09 10:42:14 +05:30
|
|
|
def update_after_edit(self,epo,change=1):
|
2004-10-16 22:56:04 +05:30
|
|
|
self.active_person = epo.person
|
2004-10-18 04:47:30 +05:30
|
|
|
pn = self.active_person.get_primary_name()
|
|
|
|
|
|
|
|
mapname = self.db.get_name_group_mapping(pn.get_group_name())
|
|
|
|
|
2005-03-10 06:32:09 +05:30
|
|
|
if epo.orig_surname in [pn.get_group_name(), mapname ]:
|
2004-10-17 02:33:38 +05:30
|
|
|
self.people_view.build_tree()
|
|
|
|
elif change:
|
2004-10-01 08:08:23 +05:30
|
|
|
self.people_view.update_person_list(epo.person)
|
|
|
|
else:
|
2004-10-01 00:02:56 +05:30
|
|
|
self.people_view.redisplay_person_list(epo.person)
|
2004-10-01 08:08:23 +05:30
|
|
|
self.family_view.load_family()
|
2005-02-26 10:49:38 +05:30
|
|
|
self.place_view.build_tree()
|
|
|
|
self.source_view.build_tree()
|
2002-10-20 19:55:16 +05:30
|
|
|
self.update_display(0)
|
2004-10-01 00:02:56 +05:30
|
|
|
self.goto_active_person()
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def update_after_merge(self,person,old_id):
|
|
|
|
if person:
|
2003-12-02 22:54:01 +05:30
|
|
|
self.people_view.redisplay_person_list(person)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.update_display(0)
|
|
|
|
|
|
|
|
def load_person(self,person):
|
|
|
|
if person:
|
|
|
|
try:
|
2005-02-24 10:16:45 +05:30
|
|
|
EditPerson.EditPerson(self, person, self.db,
|
|
|
|
self.update_after_edit)
|
2002-10-20 19:55:16 +05:30
|
|
|
except:
|
|
|
|
DisplayTrace.DisplayTrace()
|
|
|
|
|
|
|
|
def list_item(self,label,filter):
|
|
|
|
l = gtk.Label(label)
|
|
|
|
l.set_alignment(0,0.5)
|
|
|
|
l.show()
|
|
|
|
c = gtk.ListItem()
|
|
|
|
c.add(l)
|
|
|
|
c.set_data('d',filter)
|
|
|
|
c.show()
|
|
|
|
return c
|
|
|
|
|
|
|
|
def parent_name(self,person):
|
|
|
|
if person == None:
|
|
|
|
return _("Unknown")
|
|
|
|
else:
|
2005-01-01 09:57:15 +05:30
|
|
|
return NameDisplay.displayer.display(person)
|
2004-06-22 04:54:51 +05:30
|
|
|
|
2002-11-17 04:52:33 +05:30
|
|
|
def status_text(self,text):
|
|
|
|
self.statusbar.set_status(text)
|
|
|
|
while gtk.events_pending():
|
2004-04-28 09:36:25 +05:30
|
|
|
gtk.main_iteration()
|
2002-11-17 04:52:33 +05:30
|
|
|
|
2004-12-20 05:07:40 +05:30
|
|
|
def post_load(self,name,callback=None):
|
2004-02-14 11:10:30 +05:30
|
|
|
self.db.set_save_path(name)
|
|
|
|
res = self.db.get_researcher()
|
2002-10-20 19:55:16 +05:30
|
|
|
owner = GrampsCfg.get_researcher()
|
2004-05-01 19:38:36 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if res.get_name() == "" and owner.get_name():
|
|
|
|
self.db.set_researcher(owner)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
self.setup_bookmarks()
|
2005-03-07 19:19:14 +05:30
|
|
|
if self.db.need_upgrade():
|
|
|
|
if callback:
|
|
|
|
callback(_('Upgrading database...'))
|
2005-03-03 11:03:22 +05:30
|
|
|
self.db.upgrade()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-01-06 22:58:31 +05:30
|
|
|
GrampsKeys.save_last_file(name)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.gtop.get_widget("filter").set_text("")
|
|
|
|
|
2004-12-20 05:07:40 +05:30
|
|
|
if callback:
|
|
|
|
callback(_('Building Person list...'))
|
2004-03-08 03:20:41 +05:30
|
|
|
self.people_view.change_db(self.db)
|
2004-12-20 05:07:40 +05:30
|
|
|
if callback:
|
|
|
|
callback(_('Building Place list...'))
|
2004-03-22 10:11:35 +05:30
|
|
|
self.place_view.change_db(self.db)
|
2004-12-20 05:07:40 +05:30
|
|
|
if callback:
|
|
|
|
callback(_('Building Source list...'))
|
2004-03-22 10:11:35 +05:30
|
|
|
self.source_view.change_db(self.db)
|
2004-12-20 05:07:40 +05:30
|
|
|
if callback:
|
|
|
|
callback(_('Building Media list...'))
|
2004-03-22 10:11:35 +05:30
|
|
|
self.media_view.change_db(self.db)
|
2004-10-29 06:19:40 +05:30
|
|
|
self.relationship = self.RelClass(self.db)
|
2004-02-21 11:41:59 +05:30
|
|
|
|
|
|
|
self.change_active_person(self.find_initial_person())
|
2004-11-06 09:11:21 +05:30
|
|
|
self.goto_active_person()
|
2004-12-20 05:07:40 +05:30
|
|
|
if callback:
|
|
|
|
callback(_('Setup complete'))
|
2005-02-17 04:19:54 +05:30
|
|
|
self.enable_buttons(True)
|
2003-09-12 08:47:42 +05:30
|
|
|
return 1
|
|
|
|
|
|
|
|
def find_initial_person(self):
|
2004-02-14 11:10:30 +05:30
|
|
|
person = self.db.get_default_person()
|
2003-09-03 10:27:36 +05:30
|
|
|
if not person:
|
2004-08-13 10:04:07 +05:30
|
|
|
the_ids = self.db.get_person_handles(sort_handles=False)
|
2003-09-03 10:27:36 +05:30
|
|
|
if the_ids:
|
|
|
|
the_ids.sort()
|
2004-08-07 10:46:57 +05:30
|
|
|
person = self.db.get_person_from_handle(the_ids[0])
|
2003-09-12 08:47:42 +05:30
|
|
|
return person
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-02-17 04:19:54 +05:30
|
|
|
def load_database(self,name,callback=None,mode="w"):
|
2003-03-17 07:58:43 +05:30
|
|
|
|
2004-02-29 00:16:40 +05:30
|
|
|
filename = name
|
2003-03-17 07:58:43 +05:30
|
|
|
|
2003-04-04 11:18:25 +05:30
|
|
|
self.status_text(_("Loading %s...") % name)
|
2004-04-10 09:08:48 +05:30
|
|
|
|
2004-12-20 05:07:40 +05:30
|
|
|
if callback:
|
|
|
|
callback(_('Opening database...'))
|
|
|
|
|
2005-02-17 04:19:54 +05:30
|
|
|
if self.db.load(filename,callback,mode) == 0:
|
2003-03-17 07:58:43 +05:30
|
|
|
self.status_text('')
|
2002-10-20 19:55:16 +05:30
|
|
|
return 0
|
2003-03-17 07:58:43 +05:30
|
|
|
self.status_text('')
|
2004-12-20 04:25:41 +05:30
|
|
|
|
2004-12-20 05:07:40 +05:30
|
|
|
val = self.post_load(name,callback)
|
2004-12-20 04:25:41 +05:30
|
|
|
return val
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def setup_bookmarks(self):
|
2004-02-22 00:29:45 +05:30
|
|
|
self.bookmarks = Bookmarks.Bookmarks(self.db,self.db.get_bookmarks(),
|
2002-10-20 19:55:16 +05:30
|
|
|
self.gtop.get_widget("jump_to"),
|
|
|
|
self.bookmark_callback)
|
|
|
|
|
2003-02-24 10:21:57 +05:30
|
|
|
def displayError(self,msg,msg2):
|
|
|
|
ErrorDialog(msg,msg2)
|
2002-11-17 04:52:33 +05:30
|
|
|
self.status_text("")
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2002-11-17 10:36:43 +05:30
|
|
|
def complete_rebuild(self):
|
2003-10-05 01:32:38 +05:30
|
|
|
self.people_view.apply_filter()
|
2003-03-12 08:32:08 +05:30
|
|
|
self.goto_active_person()
|
2002-11-17 10:36:43 +05:30
|
|
|
self.modify_statusbar()
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def on_home_clicked(self,obj):
|
2004-02-14 11:10:30 +05:30
|
|
|
temp = self.db.get_default_person()
|
2002-10-20 19:55:16 +05:30
|
|
|
if temp:
|
|
|
|
self.change_active_person(temp)
|
|
|
|
self.update_display(0)
|
2004-11-01 04:48:41 +05:30
|
|
|
self.goto_active_person()
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2003-04-10 08:28:00 +05:30
|
|
|
ErrorDialog(_("No Home Person has been set."),
|
|
|
|
_("The Home Person may be set from the Settings menu."))
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_add_bookmark_activate(self,obj):
|
|
|
|
if self.active_person:
|
2004-07-28 07:59:07 +05:30
|
|
|
self.bookmarks.add(self.active_person.get_handle())
|
2005-01-01 09:57:15 +05:30
|
|
|
name = NameDisplay.displayer.display(self.active_person)
|
2002-11-17 04:52:33 +05:30
|
|
|
self.status_text(_("%s has been bookmarked") % name)
|
2002-10-20 19:55:16 +05:30
|
|
|
gtk.timeout_add(5000,self.modify_statusbar)
|
|
|
|
else:
|
2003-07-17 08:07:28 +05:30
|
|
|
WarningDialog(_("Could Not Set a Bookmark"),
|
2004-03-25 09:34:35 +05:30
|
|
|
_("A bookmark could not be set because "
|
|
|
|
"no one was selected."))
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_edit_bookmarks_activate(self,obj):
|
|
|
|
self.bookmarks.edit()
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
def bookmark_callback(self,obj,person_handle):
|
2003-11-07 21:59:27 +05:30
|
|
|
old_person = self.active_person
|
2004-08-07 10:46:57 +05:30
|
|
|
person = self.db.get_person_from_handle(person_handle)
|
2003-11-07 21:59:27 +05:30
|
|
|
try:
|
|
|
|
self.change_active_person(person)
|
|
|
|
self.update_display(0)
|
2004-11-10 10:04:48 +05:30
|
|
|
self.goto_active_person()
|
2003-11-07 21:59:27 +05:30
|
|
|
except TypeError:
|
2004-03-08 03:20:41 +05:30
|
|
|
WarningDialog(_("Could not go to a Person"),
|
2004-03-25 09:34:35 +05:30
|
|
|
_("Either stale bookmark or broken history "
|
|
|
|
"caused by IDs reorder."))
|
2003-11-07 21:59:27 +05:30
|
|
|
self.clear_history()
|
|
|
|
self.change_active_person(old_person)
|
|
|
|
self.update_display(0)
|
2004-11-10 10:04:48 +05:30
|
|
|
self.goto_active_person()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_default_person_activate(self,obj):
|
|
|
|
if self.active_person:
|
2004-02-14 11:10:30 +05:30
|
|
|
name = self.active_person.get_primary_name().get_regular_name()
|
2003-02-26 11:13:55 +05:30
|
|
|
QuestionDialog(_('Set %s as the Home Person') % name,
|
|
|
|
_('Once a Home Person is defined, pressing the '
|
|
|
|
'Home button on the toolbar will make the home '
|
|
|
|
'person the active person.'),
|
2003-03-23 09:20:59 +05:30
|
|
|
_('_Set Home Person'),
|
2003-02-24 10:21:57 +05:30
|
|
|
self.set_person)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def set_person(self):
|
2004-08-13 10:04:07 +05:30
|
|
|
self.db.set_default_person_handle(self.active_person.get_handle())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def export_callback(self,obj,plugin_function):
|
|
|
|
"""Call the export plugin, with the active person and database"""
|
|
|
|
if self.active_person:
|
|
|
|
plugin_function(self.db,self.active_person)
|
2003-07-31 17:28:08 +05:30
|
|
|
else:
|
|
|
|
ErrorDialog(_('A person must be selected to export'),
|
|
|
|
_('Exporting requires that an active person be selected. '
|
|
|
|
'Please select a person and try again.'))
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def import_callback(self,obj,plugin_function):
|
|
|
|
"""Call the import plugin"""
|
2003-06-26 08:23:04 +05:30
|
|
|
plugin_function(self.db,self.active_person,self.import_tool_callback)
|
2004-06-27 23:38:19 +05:30
|
|
|
self.people_view.person_model.rebuild_data()
|
2004-02-14 11:10:30 +05:30
|
|
|
self.topWindow.set_title("%s - GRAMPS" % self.db.get_save_path())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_preferences_activate(self,obj):
|
|
|
|
GrampsCfg.display_preferences_box(self.db)
|
|
|
|
|
2005-02-24 10:16:45 +05:30
|
|
|
def menu_report(self,obj,task,report_class,options_class,
|
|
|
|
translated_name,name,category):
|
2002-10-20 19:55:16 +05:30
|
|
|
"""Call the report plugin selected from the menus"""
|
|
|
|
if self.active_person:
|
2005-02-24 10:16:45 +05:30
|
|
|
task(self.db,self.active_person,report_class,
|
|
|
|
options_class,translated_name,name,category)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def menu_tools(self,obj,task):
|
|
|
|
"""Call the tool plugin selected from the menus"""
|
|
|
|
if self.active_person:
|
2004-05-10 10:24:10 +05:30
|
|
|
task(self.db,self.active_person,self.tool_callback,self)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-03-31 07:03:40 +05:30
|
|
|
def open_example(self,obj):
|
2004-04-28 09:36:25 +05:30
|
|
|
pass
|
2003-03-31 07:03:40 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
DARKEN = 1.4
|
|
|
|
|
|
|
|
def ms_shift_color_component (component, shift_by):
|
|
|
|
if shift_by > 1.0 :
|
|
|
|
result = int(component * (2 - shift_by))
|
|
|
|
else:
|
|
|
|
result = 0xffff - shift_by * (0xffff - component)
|
|
|
|
return (result & 65535)
|
|
|
|
|
|
|
|
def modify_color(color):
|
|
|
|
red = ms_shift_color_component(color.red,DARKEN)
|
|
|
|
green = ms_shift_color_component(color.green,DARKEN)
|
|
|
|
blue = ms_shift_color_component(color.blue,DARKEN)
|
|
|
|
return (red,green,blue)
|
|
|
|
|
|
|
|
def set_panel(obj):
|
|
|
|
style = obj.get_style().copy()
|
|
|
|
color = style.bg[gtk.STATE_NORMAL]
|
|
|
|
(r,g,b) = modify_color(color)
|
|
|
|
new_color = obj.get_colormap().alloc_color(r,g,b)
|
|
|
|
style.bg[gtk.STATE_NORMAL] = new_color
|
|
|
|
style.bg[gtk.STATE_PRELIGHT] = new_color
|
|
|
|
style.bg[gtk.STATE_ACTIVE] = new_color
|
|
|
|
style.bg[gtk.STATE_INSENSITIVE] = new_color
|
|
|
|
style.bg[gtk.STATE_SELECTED] = new_color
|
|
|
|
obj.set_style(style)
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Start it all
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
if __name__ == '__main__':
|
|
|
|
Gramps(None)
|
2004-05-01 19:38:36 +05:30
|
|
|
gtk.main()
|