2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
* src/gramps_main.py (tool_callback): Typo.
* src/QuestionDialog.py: Use gramps icon.
* src/plugins/EventCmp.py: HIG; single instance; help.
* src/plugins/eventcmp.glade: HIG; help.
* src/plugins/Desbrowser.py: HIG, help, rebuild model after edit.
* src/plugins/desbrowse.glade: help, info label.
* src/plugins/PatchNames.py: HIG, help, single instance.
* src/plugins/patchnames.glade: HIG, help.
* src/plugins/Merge.py: HIG, help, single instance.
* src/plugins/merge.glade: HIG, help.
* src/plugins/ChangeNames.py: HIG, help, single instance.
svn: r4230
2005-03-24 11:52:25 +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-12-17 21:36:36 +05:30
|
|
|
# $Id$
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
"Analysis and Exploration/Compare individual events"
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
2003-01-15 10:55:50 +05:30
|
|
|
# python modules
|
2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
import os
|
* src/gramps_main.py (tool_callback): Typo.
* src/QuestionDialog.py: Use gramps icon.
* src/plugins/EventCmp.py: HIG; single instance; help.
* src/plugins/eventcmp.glade: HIG; help.
* src/plugins/Desbrowser.py: HIG, help, rebuild model after edit.
* src/plugins/desbrowse.glade: help, info label.
* src/plugins/PatchNames.py: HIG, help, single instance.
* src/plugins/patchnames.glade: HIG, help.
* src/plugins/Merge.py: HIG, help, single instance.
* src/plugins/merge.glade: HIG, help.
* src/plugins/ChangeNames.py: HIG, help, single instance.
svn: r4230
2005-03-24 11:52:25 +05:30
|
|
|
from gettext import gettext as _
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-01-15 10:55:50 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GNOME/GTK modules
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2002-10-20 19:55:16 +05:30
|
|
|
import gtk
|
|
|
|
import gtk.glade
|
2005-12-13 07:37:16 +05:30
|
|
|
import GrampsDisplay
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-01-15 10:55:50 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GRAMPS modules
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
import GenericFilter
|
|
|
|
import ListModel
|
2004-05-09 09:14:59 +05:30
|
|
|
import Sort
|
2003-01-15 10:55:50 +05:30
|
|
|
import Utils
|
2003-09-02 06:17:09 +05:30
|
|
|
import BaseDoc
|
2003-01-15 10:55:50 +05:30
|
|
|
import OpenSpreadSheet
|
2003-03-12 08:32:08 +05:30
|
|
|
import const
|
2005-08-06 08:27:37 +05:30
|
|
|
import DateHandler
|
2003-01-15 10:55:50 +05:30
|
|
|
from QuestionDialog import WarningDialog
|
2005-12-06 12:08:09 +05:30
|
|
|
import Tool
|
2003-01-15 10:55:50 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
class TableReport:
|
|
|
|
|
|
|
|
def __init__(self,filename,doc):
|
|
|
|
self.filename = filename
|
|
|
|
self.doc = doc
|
|
|
|
|
|
|
|
def initialize(self,cols):
|
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
t = BaseDoc.TableStyle()
|
2002-10-20 19:55:16 +05:30
|
|
|
t.set_columns(cols)
|
|
|
|
for index in range(0,cols):
|
|
|
|
t.set_column_width(index,4)
|
|
|
|
self.doc.add_table_style("mytbl",t)
|
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
f = BaseDoc.FontStyle()
|
|
|
|
f.set_type_face(BaseDoc.FONT_SANS_SERIF)
|
2002-10-20 19:55:16 +05:30
|
|
|
f.set_size(12)
|
|
|
|
f.set_bold(1)
|
2003-09-02 06:17:09 +05:30
|
|
|
p = BaseDoc.ParagraphStyle()
|
2002-10-20 19:55:16 +05:30
|
|
|
p.set_font(f)
|
|
|
|
p.set_background_color((0xcc,0xff,0xff))
|
|
|
|
p.set_padding(0.1)
|
|
|
|
self.doc.add_style("head",p)
|
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
f = BaseDoc.FontStyle()
|
|
|
|
f.set_type_face(BaseDoc.FONT_SANS_SERIF)
|
2002-10-20 19:55:16 +05:30
|
|
|
f.set_size(10)
|
2003-09-02 06:17:09 +05:30
|
|
|
p = BaseDoc.ParagraphStyle()
|
2002-10-20 19:55:16 +05:30
|
|
|
p.set_font(f)
|
|
|
|
self.doc.add_style("data",p)
|
|
|
|
|
|
|
|
self.doc.open(self.filename)
|
|
|
|
self.doc.start_page("Page 1","mytbl")
|
|
|
|
|
|
|
|
def finalize(self):
|
|
|
|
self.doc.end_page()
|
|
|
|
self.doc.close()
|
|
|
|
|
|
|
|
def write_table_data(self,data):
|
|
|
|
self.doc.start_row()
|
|
|
|
for item in data:
|
|
|
|
self.doc.start_cell("data")
|
|
|
|
self.doc.write_text(item)
|
|
|
|
self.doc.end_cell()
|
|
|
|
self.doc.end_row()
|
|
|
|
|
|
|
|
def set_row(self,val):
|
|
|
|
self.row = val + 2
|
|
|
|
|
|
|
|
def write_table_head(self,data):
|
|
|
|
self.prev = 3
|
|
|
|
|
|
|
|
self.doc.start_row()
|
|
|
|
for item in data:
|
|
|
|
self.doc.start_cell("head")
|
|
|
|
self.doc.write_text(item)
|
|
|
|
self.doc.end_cell()
|
|
|
|
self.doc.end_row()
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2005-12-06 12:08:09 +05:30
|
|
|
class EventComparison(Tool.Tool):
|
|
|
|
def __init__(self,db,person,options_class,name,callback=None,parent=None):
|
|
|
|
Tool.Tool.__init__(self,db,person,options_class,name)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-05-10 10:24:10 +05:30
|
|
|
self.parent = parent
|
* src/gramps_main.py (tool_callback): Typo.
* src/QuestionDialog.py: Use gramps icon.
* src/plugins/EventCmp.py: HIG; single instance; help.
* src/plugins/eventcmp.glade: HIG; help.
* src/plugins/Desbrowser.py: HIG, help, rebuild model after edit.
* src/plugins/desbrowse.glade: help, info label.
* src/plugins/PatchNames.py: HIG, help, single instance.
* src/plugins/patchnames.glade: HIG, help.
* src/plugins/Merge.py: HIG, help, single instance.
* src/plugins/merge.glade: HIG, help.
* src/plugins/ChangeNames.py: HIG, help, single instance.
svn: r4230
2005-03-24 11:52:25 +05:30
|
|
|
if self.parent.child_windows.has_key(self.__class__):
|
|
|
|
self.parent.child_windows[self.__class__].present(None)
|
|
|
|
return
|
|
|
|
self.win_key = self.__class__
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
base = os.path.dirname(__file__)
|
|
|
|
self.glade_file = base + os.sep + "eventcmp.glade"
|
|
|
|
self.qual = 0
|
|
|
|
|
2003-08-17 07:44:33 +05:30
|
|
|
self.filterDialog = gtk.glade.XML(self.glade_file,"filters","gramps")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.filterDialog.signal_autoconnect({
|
|
|
|
"on_apply_clicked" : self.on_apply_clicked,
|
2003-03-12 08:32:08 +05:30
|
|
|
"on_editor_clicked" : self.filter_editor_clicked,
|
2005-12-06 12:08:09 +05:30
|
|
|
## "on_filter_list_enter" : self.filter_list_enter,
|
2004-05-10 10:24:10 +05:30
|
|
|
"on_filters_delete_event": self.on_delete_event,
|
* src/gramps_main.py (tool_callback): Typo.
* src/QuestionDialog.py: Use gramps icon.
* src/plugins/EventCmp.py: HIG; single instance; help.
* src/plugins/eventcmp.glade: HIG; help.
* src/plugins/Desbrowser.py: HIG, help, rebuild model after edit.
* src/plugins/desbrowse.glade: help, info label.
* src/plugins/PatchNames.py: HIG, help, single instance.
* src/plugins/patchnames.glade: HIG, help.
* src/plugins/Merge.py: HIG, help, single instance.
* src/plugins/merge.glade: HIG, help.
* src/plugins/ChangeNames.py: HIG, help, single instance.
svn: r4230
2005-03-24 11:52:25 +05:30
|
|
|
"on_help_clicked" : self.on_help_clicked,
|
2004-05-10 10:24:10 +05:30
|
|
|
"destroy_passed_object" : self.close
|
2002-10-20 19:55:16 +05:30
|
|
|
})
|
|
|
|
|
2004-05-10 10:24:10 +05:30
|
|
|
self.window = self.filterDialog.get_widget("filters")
|
* src/gramps_main.py (tool_callback): Typo.
* src/QuestionDialog.py: Use gramps icon.
* src/plugins/EventCmp.py: HIG; single instance; help.
* src/plugins/eventcmp.glade: HIG; help.
* src/plugins/Desbrowser.py: HIG, help, rebuild model after edit.
* src/plugins/desbrowse.glade: help, info label.
* src/plugins/PatchNames.py: HIG, help, single instance.
* src/plugins/patchnames.glade: HIG, help.
* src/plugins/Merge.py: HIG, help, single instance.
* src/plugins/merge.glade: HIG, help.
* src/plugins/ChangeNames.py: HIG, help, single instance.
svn: r4230
2005-03-24 11:52:25 +05:30
|
|
|
self.window.set_icon(self.parent.topWindow.get_icon())
|
2003-03-12 08:32:08 +05:30
|
|
|
self.filters = self.filterDialog.get_widget("filter_list")
|
2004-05-10 10:24:10 +05:30
|
|
|
self.label = _('Event comparison filter selection')
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-05-10 10:24:10 +05:30
|
|
|
Utils.set_titles(self.window,self.filterDialog.get_widget('title'),
|
|
|
|
self.label)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-03-12 08:32:08 +05:30
|
|
|
self.all = GenericFilter.GenericFilter()
|
|
|
|
self.all.set_name(_("Entire Database"))
|
|
|
|
self.all.add_rule(GenericFilter.Everyone([]))
|
|
|
|
|
|
|
|
self.filter_menu = GenericFilter.build_filter_menu([self.all])
|
2005-12-06 12:08:09 +05:30
|
|
|
filter_num = self.options.handler.get_filter_number()
|
|
|
|
self.filter_menu.set_active(filter_num)
|
|
|
|
self.filter_menu.show()
|
2003-03-12 08:32:08 +05:30
|
|
|
self.filters.set_menu(self.filter_menu)
|
2004-05-10 10:24:10 +05:30
|
|
|
|
|
|
|
self.add_itself_to_menu()
|
|
|
|
self.window.show()
|
|
|
|
|
* src/gramps_main.py (tool_callback): Typo.
* src/QuestionDialog.py: Use gramps icon.
* src/plugins/EventCmp.py: HIG; single instance; help.
* src/plugins/eventcmp.glade: HIG; help.
* src/plugins/Desbrowser.py: HIG, help, rebuild model after edit.
* src/plugins/desbrowse.glade: help, info label.
* src/plugins/PatchNames.py: HIG, help, single instance.
* src/plugins/patchnames.glade: HIG, help.
* src/plugins/Merge.py: HIG, help, single instance.
* src/plugins/merge.glade: HIG, help.
* src/plugins/ChangeNames.py: HIG, help, single instance.
svn: r4230
2005-03-24 11:52:25 +05:30
|
|
|
def on_help_clicked(self,obj):
|
|
|
|
"""Display the relevant portion of GRAMPS manual"""
|
2005-12-13 07:37:16 +05:30
|
|
|
GrampsDisplay.help('tools-util')
|
* src/gramps_main.py (tool_callback): Typo.
* src/QuestionDialog.py: Use gramps icon.
* src/plugins/EventCmp.py: HIG; single instance; help.
* src/plugins/eventcmp.glade: HIG; help.
* src/plugins/Desbrowser.py: HIG, help, rebuild model after edit.
* src/plugins/desbrowse.glade: help, info label.
* src/plugins/PatchNames.py: HIG, help, single instance.
* src/plugins/patchnames.glade: HIG, help.
* src/plugins/Merge.py: HIG, help, single instance.
* src/plugins/merge.glade: HIG, help.
* src/plugins/ChangeNames.py: HIG, help, single instance.
svn: r4230
2005-03-24 11:52:25 +05:30
|
|
|
|
2004-05-10 10:24:10 +05:30
|
|
|
def on_delete_event(self,obj,b):
|
|
|
|
self.remove_itself_from_menu()
|
|
|
|
|
|
|
|
def close(self,obj):
|
|
|
|
self.remove_itself_from_menu()
|
|
|
|
self.window.destroy()
|
|
|
|
|
|
|
|
def add_itself_to_menu(self):
|
|
|
|
self.parent.child_windows[self.win_key] = self
|
|
|
|
self.parent_menu_item = gtk.MenuItem(_("Event Comparison tool"))
|
* src/gramps_main.py (tool_callback): Typo.
* src/QuestionDialog.py: Use gramps icon.
* src/plugins/EventCmp.py: HIG; single instance; help.
* src/plugins/eventcmp.glade: HIG; help.
* src/plugins/Desbrowser.py: HIG, help, rebuild model after edit.
* src/plugins/desbrowse.glade: help, info label.
* src/plugins/PatchNames.py: HIG, help, single instance.
* src/plugins/patchnames.glade: HIG, help.
* src/plugins/Merge.py: HIG, help, single instance.
* src/plugins/merge.glade: HIG, help.
* src/plugins/ChangeNames.py: HIG, help, single instance.
svn: r4230
2005-03-24 11:52:25 +05:30
|
|
|
self.parent_menu_item.connect("activate",self.present)
|
2004-05-10 10:24:10 +05:30
|
|
|
self.parent_menu_item.show()
|
|
|
|
self.parent.winsmenu.append(self.parent_menu_item)
|
|
|
|
|
|
|
|
def remove_itself_from_menu(self):
|
|
|
|
del self.parent.child_windows[self.win_key]
|
|
|
|
self.parent_menu_item.destroy()
|
|
|
|
|
|
|
|
def present(self,obj):
|
|
|
|
self.window.present()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-03-12 08:32:08 +05:30
|
|
|
def filter_editor_clicked(self,obj):
|
|
|
|
import FilterEditor
|
2004-05-10 10:24:10 +05:30
|
|
|
FilterEditor.FilterEditor(const.custom_filters,self.db,self.parent)
|
2003-03-12 08:32:08 +05:30
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
## def filter_list_enter(self,obj):
|
|
|
|
## self.filter_menu = GenericFilter.build_filter_menu([self.all])
|
|
|
|
## self.filters.set_menu(self.filter_menu)
|
2003-03-12 08:32:08 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def on_apply_clicked(self,obj):
|
|
|
|
cfilter = self.filter_menu.get_active().get_data("filter")
|
|
|
|
|
2005-08-18 11:28:28 +05:30
|
|
|
progress_bar = Utils.ProgressMeter(_('Comparing events'),'')
|
|
|
|
progress_bar.set_pass(_('Selecting people'),1)
|
|
|
|
|
|
|
|
plist = cfilter.apply(self.db,
|
|
|
|
self.db.get_person_handles(sort_handles=False))
|
|
|
|
progress_bar.step()
|
|
|
|
progress_bar.close()
|
2005-12-06 12:08:09 +05:30
|
|
|
self.options.handler.set_filter_number(self.filters.get_history())
|
|
|
|
# Save options
|
|
|
|
self.options.handler.save_options()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
if len(plist) == 0:
|
2003-01-15 10:55:50 +05:30
|
|
|
WarningDialog(_("No matches were found"))
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
* src/gramps_main.py (tool_callback): Typo.
* src/QuestionDialog.py: Use gramps icon.
* src/plugins/EventCmp.py: HIG; single instance; help.
* src/plugins/eventcmp.glade: HIG; help.
* src/plugins/Desbrowser.py: HIG, help, rebuild model after edit.
* src/plugins/desbrowse.glade: help, info label.
* src/plugins/PatchNames.py: HIG, help, single instance.
* src/plugins/patchnames.glade: HIG, help.
* src/plugins/Merge.py: HIG, help, single instance.
* src/plugins/merge.glade: HIG, help.
* src/plugins/ChangeNames.py: HIG, help, single instance.
svn: r4230
2005-03-24 11:52:25 +05:30
|
|
|
DisplayChart(self.db,plist,self.parent)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
def by_value(first,second):
|
|
|
|
return cmp(second[0],first[0])
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
def fix(line):
|
2002-11-08 09:12:25 +05:30
|
|
|
l = line.strip().replace('&','&').replace(l,'>','>')
|
|
|
|
return l.replace(l,'<','<').replace(l,'"','"')
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
class DisplayChart:
|
2004-05-10 10:24:10 +05:30
|
|
|
def __init__(self,database,people_list,parent):
|
2004-05-09 09:14:59 +05:30
|
|
|
self.db = database
|
2002-10-20 19:55:16 +05:30
|
|
|
self.my_list = people_list
|
|
|
|
self.row_data = []
|
2004-05-11 05:20:30 +05:30
|
|
|
self.parent = parent
|
|
|
|
self.win_key = self
|
|
|
|
self.save_form = None
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
base = os.path.dirname(__file__)
|
|
|
|
self.glade_file = base + os.sep + "eventcmp.glade"
|
|
|
|
|
2003-08-17 07:44:33 +05:30
|
|
|
self.topDialog = gtk.glade.XML(self.glade_file,"view","gramps")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.topDialog.signal_autoconnect({
|
|
|
|
"on_write_table" : self.on_write_table,
|
2004-05-11 05:20:30 +05:30
|
|
|
"destroy_passed_object" : self.close,
|
* src/gramps_main.py (tool_callback): Typo.
* src/QuestionDialog.py: Use gramps icon.
* src/plugins/EventCmp.py: HIG; single instance; help.
* src/plugins/eventcmp.glade: HIG; help.
* src/plugins/Desbrowser.py: HIG, help, rebuild model after edit.
* src/plugins/desbrowse.glade: help, info label.
* src/plugins/PatchNames.py: HIG, help, single instance.
* src/plugins/patchnames.glade: HIG, help.
* src/plugins/Merge.py: HIG, help, single instance.
* src/plugins/merge.glade: HIG, help.
* src/plugins/ChangeNames.py: HIG, help, single instance.
svn: r4230
2005-03-24 11:52:25 +05:30
|
|
|
"on_help_clicked" : self.on_help_clicked,
|
2004-05-11 05:20:30 +05:30
|
|
|
"on_view_delete_event" : self.on_delete_event,
|
2002-10-20 19:55:16 +05:30
|
|
|
})
|
|
|
|
|
2004-05-11 05:20:30 +05:30
|
|
|
self.window = self.topDialog.get_widget("view")
|
* src/gramps_main.py (tool_callback): Typo.
* src/QuestionDialog.py: Use gramps icon.
* src/plugins/EventCmp.py: HIG; single instance; help.
* src/plugins/eventcmp.glade: HIG; help.
* src/plugins/Desbrowser.py: HIG, help, rebuild model after edit.
* src/plugins/desbrowse.glade: help, info label.
* src/plugins/PatchNames.py: HIG, help, single instance.
* src/plugins/patchnames.glade: HIG, help.
* src/plugins/Merge.py: HIG, help, single instance.
* src/plugins/merge.glade: HIG, help.
* src/plugins/ChangeNames.py: HIG, help, single instance.
svn: r4230
2005-03-24 11:52:25 +05:30
|
|
|
self.window.set_icon(self.parent.topWindow.get_icon())
|
2002-11-08 09:12:25 +05:30
|
|
|
self.eventlist = self.topDialog.get_widget('treeview')
|
2003-03-12 08:32:08 +05:30
|
|
|
|
2004-05-11 05:20:30 +05:30
|
|
|
Utils.set_titles(self.window, self.topDialog.get_widget('title'),
|
* src/gramps_main.py (tool_callback): Typo.
* src/QuestionDialog.py: Use gramps icon.
* src/plugins/EventCmp.py: HIG; single instance; help.
* src/plugins/eventcmp.glade: HIG; help.
* src/plugins/Desbrowser.py: HIG, help, rebuild model after edit.
* src/plugins/desbrowse.glade: help, info label.
* src/plugins/PatchNames.py: HIG, help, single instance.
* src/plugins/patchnames.glade: HIG, help.
* src/plugins/Merge.py: HIG, help, single instance.
* src/plugins/merge.glade: HIG, help.
* src/plugins/ChangeNames.py: HIG, help, single instance.
svn: r4230
2005-03-24 11:52:25 +05:30
|
|
|
_('Event Comparison Results'))
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-05-09 09:14:59 +05:30
|
|
|
self.sort = Sort.Sort(self.db)
|
|
|
|
self.my_list.sort(self.sort.by_last_name)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
self.event_titles = self.make_event_titles()
|
|
|
|
self.build_row_data()
|
|
|
|
self.draw_clist_display()
|
2004-05-11 05:20:30 +05:30
|
|
|
self.add_itself_to_menu()
|
|
|
|
self.window.show()
|
|
|
|
|
* src/gramps_main.py (tool_callback): Typo.
* src/QuestionDialog.py: Use gramps icon.
* src/plugins/EventCmp.py: HIG; single instance; help.
* src/plugins/eventcmp.glade: HIG; help.
* src/plugins/Desbrowser.py: HIG, help, rebuild model after edit.
* src/plugins/desbrowse.glade: help, info label.
* src/plugins/PatchNames.py: HIG, help, single instance.
* src/plugins/patchnames.glade: HIG, help.
* src/plugins/Merge.py: HIG, help, single instance.
* src/plugins/merge.glade: HIG, help.
* src/plugins/ChangeNames.py: HIG, help, single instance.
svn: r4230
2005-03-24 11:52:25 +05:30
|
|
|
def on_help_clicked(self,obj):
|
|
|
|
"""Display the relevant portion of GRAMPS manual"""
|
|
|
|
help_display('gramps-manual','tools-ae')
|
|
|
|
|
2004-05-11 05:20:30 +05:30
|
|
|
def on_delete_event(self,obj,b):
|
|
|
|
self.remove_itself_from_menu()
|
|
|
|
if self.save_form:
|
|
|
|
self.save_form.destroy()
|
|
|
|
|
|
|
|
def close(self,obj):
|
|
|
|
self.remove_itself_from_menu()
|
|
|
|
if self.save_form:
|
|
|
|
self.save_form.destroy()
|
|
|
|
self.window.destroy()
|
|
|
|
|
|
|
|
def add_itself_to_menu(self):
|
|
|
|
self.parent.child_windows[self.win_key] = self
|
* src/gramps_main.py (tool_callback): Typo.
* src/QuestionDialog.py: Use gramps icon.
* src/plugins/EventCmp.py: HIG; single instance; help.
* src/plugins/eventcmp.glade: HIG; help.
* src/plugins/Desbrowser.py: HIG, help, rebuild model after edit.
* src/plugins/desbrowse.glade: help, info label.
* src/plugins/PatchNames.py: HIG, help, single instance.
* src/plugins/patchnames.glade: HIG, help.
* src/plugins/Merge.py: HIG, help, single instance.
* src/plugins/merge.glade: HIG, help.
* src/plugins/ChangeNames.py: HIG, help, single instance.
svn: r4230
2005-03-24 11:52:25 +05:30
|
|
|
self.parent_menu_item = gtk.MenuItem(_("Event Comparison Results"))
|
2004-05-11 05:20:30 +05:30
|
|
|
self.parent_menu_item.connect("activate",self.present)
|
|
|
|
self.parent_menu_item.show()
|
|
|
|
self.parent.winsmenu.append(self.parent_menu_item)
|
|
|
|
|
|
|
|
def remove_itself_from_menu(self):
|
|
|
|
del self.parent.child_windows[self.win_key]
|
|
|
|
self.parent_menu_item.destroy()
|
|
|
|
|
|
|
|
def present(self,obj):
|
|
|
|
self.window.present()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def draw_clist_display(self):
|
|
|
|
|
2002-11-08 09:12:25 +05:30
|
|
|
titles = []
|
|
|
|
index = 0
|
|
|
|
for v in self.event_titles:
|
2002-11-15 09:19:39 +05:30
|
|
|
titles.append((v,index,150))
|
2002-11-08 09:12:25 +05:30
|
|
|
index = index + 1
|
|
|
|
|
|
|
|
self.list = ListModel.ListModel(self.eventlist,titles)
|
2005-08-18 11:28:28 +05:30
|
|
|
|
|
|
|
self.progress_bar.set_pass(_('Building display'),len(self.row_data))
|
2002-11-08 09:12:25 +05:30
|
|
|
for data in self.row_data:
|
|
|
|
self.list.add(data)
|
2005-08-18 11:28:28 +05:30
|
|
|
self.progress_bar.step()
|
|
|
|
self.progress_bar.close()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def build_row_data(self):
|
2005-08-18 11:28:28 +05:30
|
|
|
self.progress_bar = Utils.ProgressMeter(_('Comparing events'),'')
|
|
|
|
self.progress_bar.set_pass(_('Building data'),
|
|
|
|
self.db.get_number_of_people())
|
2004-05-09 09:14:59 +05:30
|
|
|
for individual_id in self.my_list:
|
2004-08-07 10:46:57 +05:30
|
|
|
individual = self.db.get_person_from_handle(individual_id)
|
2004-02-14 11:10:30 +05:30
|
|
|
name = individual.get_primary_name().get_name()
|
2004-07-28 07:59:07 +05:30
|
|
|
birth_handle = individual.get_birth_handle()
|
2004-05-09 09:14:59 +05:30
|
|
|
bdate = ""
|
|
|
|
bplace = ""
|
2004-07-28 07:59:07 +05:30
|
|
|
if birth_handle:
|
* src/AddSpouse.py, src/ChooseParents.py, src/EditPerson.py,
src/EditPlace.py, src/EditSource.py, src/EventEdit.py,
src/FamilyView.py, src/GenericFilter.py,
src/Marriage.py, src/PedView.py, src/PeopleModel.py,
src/PlaceView.py, src/RelLib.py, src/SelectChild.py,
src/Sort.py, src/SourceView.py, src/SubstKeywords.py,
src/WriteGedcom.py, src/WriteXML.py, src/plugins/AncestorReport.py,
src/plugins/Ancestors.py, src/plugins/ChangeTypes.py,
src/plugins/DescendReport.py, src/plugins/DetDescendantReport.py,
src/plugins/EventCmp.py, src/plugins/FamilyGroup.py,
src/plugins/FanChart.py, src/plugins/FtmStyleAncestors.py,
src/plugins/FtmStyleDescendants.py, src/plugins/GraphViz.py,
src/plugins/IndivComplete.py, src/plugins/IndivSummary.py,
src/plugins/Merge.py, src/plugins/RelCalc.py, src/plugins/RelGraph.py,
src/plugins/Summary.py, src/plugins/TimeLine.py, src/plugins/Verify.py,
src/plugins/WebPage.py, src/plugins/WriteCD.py,
src/plugins/WritePkg.py, src/plugins/DetAncestralReport.py:
Use get_event_from_handle (not find_ ).
svn: r3462
2004-08-22 00:26:01 +05:30
|
|
|
birth = self.db.get_event_from_handle(birth_handle)
|
2005-08-06 08:27:37 +05:30
|
|
|
bdate = DateHandler.get_date(birth)
|
2004-07-28 07:59:07 +05:30
|
|
|
bplace_handle = birth.get_place_handle()
|
|
|
|
if bplace_handle:
|
2004-08-07 10:46:57 +05:30
|
|
|
bplace = self.db.get_place_from_handle(bplace_handle).get_title()
|
2004-07-28 07:59:07 +05:30
|
|
|
death_handle = individual.get_death_handle()
|
2004-05-09 09:14:59 +05:30
|
|
|
ddate = ""
|
|
|
|
dplace = ""
|
2004-07-28 07:59:07 +05:30
|
|
|
if death_handle:
|
* src/AddSpouse.py, src/ChooseParents.py, src/EditPerson.py,
src/EditPlace.py, src/EditSource.py, src/EventEdit.py,
src/FamilyView.py, src/GenericFilter.py,
src/Marriage.py, src/PedView.py, src/PeopleModel.py,
src/PlaceView.py, src/RelLib.py, src/SelectChild.py,
src/Sort.py, src/SourceView.py, src/SubstKeywords.py,
src/WriteGedcom.py, src/WriteXML.py, src/plugins/AncestorReport.py,
src/plugins/Ancestors.py, src/plugins/ChangeTypes.py,
src/plugins/DescendReport.py, src/plugins/DetDescendantReport.py,
src/plugins/EventCmp.py, src/plugins/FamilyGroup.py,
src/plugins/FanChart.py, src/plugins/FtmStyleAncestors.py,
src/plugins/FtmStyleDescendants.py, src/plugins/GraphViz.py,
src/plugins/IndivComplete.py, src/plugins/IndivSummary.py,
src/plugins/Merge.py, src/plugins/RelCalc.py, src/plugins/RelGraph.py,
src/plugins/Summary.py, src/plugins/TimeLine.py, src/plugins/Verify.py,
src/plugins/WebPage.py, src/plugins/WriteCD.py,
src/plugins/WritePkg.py, src/plugins/DetAncestralReport.py:
Use get_event_from_handle (not find_ ).
svn: r3462
2004-08-22 00:26:01 +05:30
|
|
|
death = self.db.get_event_from_handle(death_handle)
|
2005-08-06 08:27:37 +05:30
|
|
|
ddate = DateHandler.get_date(death)
|
2004-07-28 07:59:07 +05:30
|
|
|
dplace_handle = death.get_place_handle()
|
|
|
|
if dplace_handle:
|
2004-08-07 10:46:57 +05:30
|
|
|
dplace = self.db.get_place_from_handle(dplace_handle).get_title()
|
2002-10-20 19:55:16 +05:30
|
|
|
map = {}
|
2004-02-14 11:10:30 +05:30
|
|
|
elist = individual.get_event_list()[:]
|
2004-07-28 07:59:07 +05:30
|
|
|
for ievent_handle in elist:
|
|
|
|
if not ievent_handle:
|
2004-05-09 09:14:59 +05:30
|
|
|
continue
|
* src/AddSpouse.py, src/ChooseParents.py, src/EditPerson.py,
src/EditPlace.py, src/EditSource.py, src/EventEdit.py,
src/FamilyView.py, src/GenericFilter.py,
src/Marriage.py, src/PedView.py, src/PeopleModel.py,
src/PlaceView.py, src/RelLib.py, src/SelectChild.py,
src/Sort.py, src/SourceView.py, src/SubstKeywords.py,
src/WriteGedcom.py, src/WriteXML.py, src/plugins/AncestorReport.py,
src/plugins/Ancestors.py, src/plugins/ChangeTypes.py,
src/plugins/DescendReport.py, src/plugins/DetDescendantReport.py,
src/plugins/EventCmp.py, src/plugins/FamilyGroup.py,
src/plugins/FanChart.py, src/plugins/FtmStyleAncestors.py,
src/plugins/FtmStyleDescendants.py, src/plugins/GraphViz.py,
src/plugins/IndivComplete.py, src/plugins/IndivSummary.py,
src/plugins/Merge.py, src/plugins/RelCalc.py, src/plugins/RelGraph.py,
src/plugins/Summary.py, src/plugins/TimeLine.py, src/plugins/Verify.py,
src/plugins/WebPage.py, src/plugins/WriteCD.py,
src/plugins/WritePkg.py, src/plugins/DetAncestralReport.py:
Use get_event_from_handle (not find_ ).
svn: r3462
2004-08-22 00:26:01 +05:30
|
|
|
ievent = self.db.get_event_from_handle(ievent_handle)
|
2004-02-14 11:10:30 +05:30
|
|
|
event_name = ievent.get_name()
|
2002-10-20 19:55:16 +05:30
|
|
|
if map.has_key(event_name):
|
2004-07-28 07:59:07 +05:30
|
|
|
map[event_name].append(ievent_handle)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-07-28 07:59:07 +05:30
|
|
|
map[event_name] = [ievent_handle]
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
first = 1
|
|
|
|
done = 0
|
|
|
|
while done == 0:
|
|
|
|
added = 0
|
|
|
|
if first:
|
2004-05-09 09:14:59 +05:30
|
|
|
tlist = [name,"%s\n%s" % (bdate,bplace),
|
|
|
|
"%s\n%s" % (ddate,dplace)]
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
|
|
|
tlist = ["","",""]
|
|
|
|
for ename in self.event_titles[3:]:
|
|
|
|
if map.has_key(ename) and len(map[ename]) > 0:
|
2004-07-28 07:59:07 +05:30
|
|
|
event_handle = map[ename][0]
|
2002-10-20 19:55:16 +05:30
|
|
|
del map[ename][0]
|
2004-05-09 09:14:59 +05:30
|
|
|
date = ""
|
|
|
|
place = ""
|
2004-07-28 07:59:07 +05:30
|
|
|
if event_handle:
|
* src/AddSpouse.py, src/ChooseParents.py, src/EditPerson.py,
src/EditPlace.py, src/EditSource.py, src/EventEdit.py,
src/FamilyView.py, src/GenericFilter.py,
src/Marriage.py, src/PedView.py, src/PeopleModel.py,
src/PlaceView.py, src/RelLib.py, src/SelectChild.py,
src/Sort.py, src/SourceView.py, src/SubstKeywords.py,
src/WriteGedcom.py, src/WriteXML.py, src/plugins/AncestorReport.py,
src/plugins/Ancestors.py, src/plugins/ChangeTypes.py,
src/plugins/DescendReport.py, src/plugins/DetDescendantReport.py,
src/plugins/EventCmp.py, src/plugins/FamilyGroup.py,
src/plugins/FanChart.py, src/plugins/FtmStyleAncestors.py,
src/plugins/FtmStyleDescendants.py, src/plugins/GraphViz.py,
src/plugins/IndivComplete.py, src/plugins/IndivSummary.py,
src/plugins/Merge.py, src/plugins/RelCalc.py, src/plugins/RelGraph.py,
src/plugins/Summary.py, src/plugins/TimeLine.py, src/plugins/Verify.py,
src/plugins/WebPage.py, src/plugins/WriteCD.py,
src/plugins/WritePkg.py, src/plugins/DetAncestralReport.py:
Use get_event_from_handle (not find_ ).
svn: r3462
2004-08-22 00:26:01 +05:30
|
|
|
event = self.db.get_event_from_handle(event_handle)
|
2005-08-06 08:27:37 +05:30
|
|
|
date = DateHandler.get_date(event)
|
2004-07-28 07:59:07 +05:30
|
|
|
place_handle = event.get_place_handle()
|
|
|
|
if place_handle:
|
2004-08-07 10:46:57 +05:30
|
|
|
place = self.db.get_place_from_handle(place_handle).get_title()
|
2004-05-09 09:14:59 +05:30
|
|
|
tlist.append("%s\n%s" % (date, place))
|
2002-10-20 19:55:16 +05:30
|
|
|
added = 1
|
|
|
|
else:
|
|
|
|
tlist.append("")
|
|
|
|
|
|
|
|
if first:
|
|
|
|
first = 0
|
2002-11-08 09:12:25 +05:30
|
|
|
self.row_data.append(tlist)
|
2002-10-20 19:55:16 +05:30
|
|
|
elif added == 0:
|
|
|
|
done = 1
|
|
|
|
else:
|
2002-11-08 09:12:25 +05:30
|
|
|
self.row_data.append(tlist)
|
2005-08-18 11:28:28 +05:30
|
|
|
self.progress_bar.step()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def make_event_titles(self):
|
|
|
|
"""Creates the list of unique event types, along with the person's
|
|
|
|
name, birth, and death. This should be the column titles of the report"""
|
|
|
|
map = {}
|
2004-05-09 09:14:59 +05:30
|
|
|
for individual_id in self.my_list:
|
2004-08-07 10:46:57 +05:30
|
|
|
individual = self.db.get_person_from_handle(individual_id)
|
2004-02-14 11:10:30 +05:30
|
|
|
elist = individual.get_event_list()
|
2004-07-28 07:59:07 +05:30
|
|
|
for event_handle in elist:
|
|
|
|
if not event_handle:
|
2004-05-09 09:14:59 +05:30
|
|
|
continue
|
* src/AddSpouse.py, src/ChooseParents.py, src/EditPerson.py,
src/EditPlace.py, src/EditSource.py, src/EventEdit.py,
src/FamilyView.py, src/GenericFilter.py,
src/Marriage.py, src/PedView.py, src/PeopleModel.py,
src/PlaceView.py, src/RelLib.py, src/SelectChild.py,
src/Sort.py, src/SourceView.py, src/SubstKeywords.py,
src/WriteGedcom.py, src/WriteXML.py, src/plugins/AncestorReport.py,
src/plugins/Ancestors.py, src/plugins/ChangeTypes.py,
src/plugins/DescendReport.py, src/plugins/DetDescendantReport.py,
src/plugins/EventCmp.py, src/plugins/FamilyGroup.py,
src/plugins/FanChart.py, src/plugins/FtmStyleAncestors.py,
src/plugins/FtmStyleDescendants.py, src/plugins/GraphViz.py,
src/plugins/IndivComplete.py, src/plugins/IndivSummary.py,
src/plugins/Merge.py, src/plugins/RelCalc.py, src/plugins/RelGraph.py,
src/plugins/Summary.py, src/plugins/TimeLine.py, src/plugins/Verify.py,
src/plugins/WebPage.py, src/plugins/WriteCD.py,
src/plugins/WritePkg.py, src/plugins/DetAncestralReport.py:
Use get_event_from_handle (not find_ ).
svn: r3462
2004-08-22 00:26:01 +05:30
|
|
|
event = self.db.get_event_from_handle(event_handle)
|
2004-02-14 11:10:30 +05:30
|
|
|
name = event.get_name()
|
2002-10-20 19:55:16 +05:30
|
|
|
if not name:
|
|
|
|
break
|
|
|
|
if map.has_key(name):
|
|
|
|
map[name] = map[name] + 1
|
|
|
|
else:
|
|
|
|
map[name] = 1
|
|
|
|
|
2004-05-09 09:14:59 +05:30
|
|
|
unsort_list = [ (map[item],item) for item in map.keys() ]
|
2002-10-20 19:55:16 +05:30
|
|
|
unsort_list.sort(by_value)
|
2004-05-09 09:14:59 +05:30
|
|
|
sort_list = [ item[1] for item in unsort_list ]
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
return [_("Person"),_("Birth"),_("Death")] + sort_list
|
|
|
|
|
|
|
|
def on_write_table(self,obj):
|
2003-08-17 07:44:33 +05:30
|
|
|
self.form = gtk.glade.XML(self.glade_file,"dialog1","gramps")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.form.signal_autoconnect({
|
|
|
|
"on_save_clicked" : self.on_save_clicked,
|
|
|
|
"destroy_passed_object" : Utils.destroy_passed_object
|
|
|
|
})
|
|
|
|
self.save_form = self.form.get_widget("dialog1")
|
2004-05-09 09:14:59 +05:30
|
|
|
self.save_form.show_all()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_save_clicked(self,obj):
|
|
|
|
|
2003-12-17 21:36:36 +05:30
|
|
|
name = unicode(self.form.get_widget("filename").get_text())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
pstyle = BaseDoc.PaperStyle("junk",10,10)
|
|
|
|
doc = OpenSpreadSheet.OpenSpreadSheet(pstyle,BaseDoc.PAPER_PORTRAIT)
|
2002-10-20 19:55:16 +05:30
|
|
|
spreadsheet = TableReport(name,doc)
|
|
|
|
spreadsheet.initialize(len(self.event_titles))
|
|
|
|
|
|
|
|
spreadsheet.write_table_head(self.event_titles)
|
|
|
|
|
|
|
|
index = 0
|
2004-01-02 00:40:23 +05:30
|
|
|
for top in self.row_data:
|
2002-10-20 19:55:16 +05:30
|
|
|
spreadsheet.set_row(index%2)
|
|
|
|
index = index + 1
|
|
|
|
spreadsheet.write_table_data(top)
|
|
|
|
|
|
|
|
spreadsheet.finalize()
|
|
|
|
Utils.destroy_passed_object(obj)
|
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
class EventComparisonOptions(Tool.ToolOptions):
|
|
|
|
"""
|
|
|
|
Defines options and provides handling interface.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self,name,person_id=None):
|
|
|
|
Tool.ToolOptions.__init__(self,name,person_id)
|
|
|
|
|
|
|
|
def enable_options(self):
|
|
|
|
# Semi-common options that should be enabled for this report
|
|
|
|
self.enable_dict = {
|
|
|
|
'filter' : 0,
|
|
|
|
}
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2005-01-05 10:32:19 +05:30
|
|
|
from PluginMgr import register_tool
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
register_tool(
|
2005-12-06 12:08:09 +05:30
|
|
|
name = 'eventcmp',
|
|
|
|
category = Tool.TOOL_ANAL,
|
|
|
|
tool_class = EventComparison,
|
|
|
|
options_class = EventComparisonOptions,
|
|
|
|
modes = Tool.MODE_GUI,
|
|
|
|
translated_name = _("Compare individual events"),
|
|
|
|
status = _("Stable"),
|
|
|
|
author_name = "Donald N. Allingham",
|
|
|
|
author_email = "don@gramps-project.org",
|
2002-11-08 09:12:25 +05:30
|
|
|
description=_("Aids in the analysis of data by allowing the "
|
|
|
|
"development of custom filters that can be applied "
|
|
|
|
"to the database to find similar events")
|
2002-10-20 19:55:16 +05:30
|
|
|
)
|