* src/plugins/Desbrowser.py: Convert to db; window management.

* src/plugins/desbrowse.glade: Define event handler.
* src/plugins/EventCmp.py: Clean up window management.
* src/plugins/eventcmp.glade: Define event handler.
* src/plugins/Check.py: Clean up conversion to db.
* src/plugins/summary.glade: Make dialog modal.
* src/plugins/Merge.py: Window management.
* src/plugins/merge.glade: Define event handlers.
* src/plugins/ChangeTypes.py: Convert to db.


svn: r3152
This commit is contained in:
Alex Roitman 2004-05-10 23:50:30 +00:00
parent 7b5fe66fe5
commit c2e42c8ea3
10 changed files with 193 additions and 53 deletions

View File

@ -2,6 +2,16 @@
* src/plugins/FilterEditor.py: Clean up window management.
* src/rule.glade: Define event handlers.
* src/plugins/Desbrowser.py: Convert to db; window management.
* src/plugins/desbrowse.glade: Define event handler.
* src/plugins/EventCmp.py: Clean up window management.
* src/plugins/eventcmp.glade: Define event handler.
* src/plugins/Check.py: Clean up conversion to db.
* src/plugins/summary.glade: Make dialog modal.
* src/plugins/Merge.py: Window management.
* src/plugins/merge.glade: Define event handlers.
* src/plugins/ChangeTypes.py: Convert to db.
2004-05-09 Don Allingham <donaldallingham@users.sourceforge.net>
* src/DbPrompter.py: added a .grdb if not specified.

View File

@ -1,7 +1,7 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000 Donald N. Allingham
# Copyright (C) 2000-2004 Donald N. Allingham
#
# 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
@ -38,9 +38,9 @@ import AutoComp
#
#
#-------------------------------------------------------------------------
def runTool(database,person,callback):
def runTool(database,person,callback,parent=None):
try:
ChangeTypes(database,person)
ChangeTypes(database,person,parent)
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
@ -51,7 +51,7 @@ def runTool(database,person,callback):
#
#-------------------------------------------------------------------------
class ChangeTypes:
def __init__(self,db,person):
def __init__(self,db,person,parent):
self.person = person
self.db = db
@ -78,12 +78,17 @@ class ChangeTypes:
original = unicode(self.glade.get_widget("original_text").get_text())
new = unicode(self.glade.get_widget("new_text").get_text())
for person in self.db.get_person_id_map().values():
for event in person.get_event_list():
for person_id in self.db.get_person_keys():
person = self.db.find_person_from_id(person_id)
for event_id in person.get_event_list():
if not event_id:
continue
event = self.db.find_event_from_id(event_id)
if event.get_name() == original:
event.set_name(new)
modified = modified + 1
Utils.modified()
self.db.commit_event(event)
if modified == 1:
msg = _("1 event record was modified")

View File

@ -55,10 +55,10 @@ from QuestionDialog import OkDialog, MissingMediaDialog
# runTool
#
#-------------------------------------------------------------------------
def runTool(database,active_person,callback):
def runTool(database,active_person,callback,parent=None):
try:
checker = CheckIntegrity(database)
checker = CheckIntegrity(database,parent)
checker.check_for_broken_family_links()
checker.cleanup_missing_photos(0)
checker.check_parent_relationships()
@ -77,7 +77,7 @@ def runTool(database,active_person,callback):
#-------------------------------------------------------------------------
class CheckIntegrity:
def __init__(self,db):
def __init__(self,db,parent):
self.db = db
self.bad_photo = []
self.replaced_photo = []

View File

@ -1,7 +1,7 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000 Donald N. Allingham
# Copyright (C) 2000-2004 Donald N. Allingham
#
# 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
@ -18,6 +18,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
"Analysis and Exploration/Interactive descendant browser"
#------------------------------------------------------------------------
@ -50,32 +52,35 @@ import gtk.glade
#
#
#------------------------------------------------------------------------
def runTool(database,person,callback):
def runTool(database,person,callback,parent=None):
try:
DesBrowse(database,person,callback)
DesBrowse(database,person,callback,parent)
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
class DesBrowse:
def __init__(self,database,person,callback):
def __init__(self,database,person,callback,parent):
self.active = person
self.db = database
self.callback = callback
self.parent = parent
self.win_key = self
base = os.path.dirname(__file__)
glade_file = base + os.sep + "desbrowse.glade"
self.glade = gtk.glade.XML(glade_file,"top","gramps")
self.glade.signal_autoconnect({
"destroy_passed_object" : Utils.destroy_passed_object,
"destroy_passed_object" : self.close,
"on_delete_event": self.on_delete_event,
})
top = self.glade.get_widget("top")
self.window = self.glade.get_widget("top")
Utils.set_titles(top,self.glade.get_widget('title'),
Utils.set_titles(self.window,self.glade.get_widget('title'),
_("Descendant Browser"))
self.tree= self.glade.get_widget("tree1")
self.tree = self.glade.get_widget("tree1")
col = gtk.TreeViewColumn('',gtk.CellRendererText(),text=0)
self.tree.append_column(col)
self.model = gtk.TreeStore(gobject.TYPE_STRING,gobject.TYPE_PYOBJECT)
@ -83,21 +88,45 @@ class DesBrowse:
self.tree.set_rules_hint(gtk.TRUE)
self.tree.set_headers_visible(gtk.FALSE)
self.add_to_tree(None,None,self.active)
self.add_to_tree(None,None,self.active.get_id())
self.tree.expand_all()
self.tree.connect('event',self.button_press_event)
top.show()
self.add_itself_to_menu()
self.window.show()
def add_to_tree(self,parent,sib,person):
item = self.model.insert_after(parent,sib)
self.model.set(item,0,GrampsCfg.nameof(person))
self.model.set(item,1,person)
prev = None
for family in person.get_family_id_list():
for child in family.get_child_id_list():
prev = self.add_to_tree(item,prev,child)
return item
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(_("Descendant Browser tool"))
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()
def add_to_tree(self,parent_id,sib_id,person_id):
item_id = self.model.insert_after(parent_id,sib_id)
person = self.db.find_person_from_id(person_id)
self.model.set(item_id,0,GrampsCfg.nameof(person))
self.model.set(item_id,1,person_id)
prev_id = None
for family_id in person.get_family_id_list():
family = self.db.find_family_from_id(family_id)
for child_id in family.get_child_id_list():
prev_id = self.add_to_tree(item_id,prev_id,child_id)
return item_id
def button_press_event(self,obj,event):
import EditPerson
@ -105,8 +134,9 @@ class DesBrowse:
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
store,iter = self.tree.get_selection().get_selected()
if iter:
person = store.get_value(iter,1)
EditPerson.EditPerson(person,self.db,self.callback)
person_id = store.get_value(iter,1)
person = self.db.find_person_from_id(person_id)
EditPerson.EditPerson(self.parent,person,self.db,self.callback)
#------------------------------------------------------------------------
#
@ -123,5 +153,3 @@ register_tool(
author_name="Donald N. Allingham",
author_email="dallingham@users.sourceforge.net"
)

View File

@ -211,7 +211,7 @@ class EventComparison:
if len(plist) == 0:
WarningDialog(_("No matches were found"))
else:
DisplayChart(self.db,plist,self.parent)
DisplayChart(self.db,plist,self)
#------------------------------------------------------------------------
#
@ -248,6 +248,9 @@ class DisplayChart:
self.db = database
self.my_list = people_list
self.row_data = []
self.parent = parent
self.win_key = self
self.save_form = None
base = os.path.dirname(__file__)
self.glade_file = base + os.sep + "eventcmp.glade"
@ -255,13 +258,14 @@ class DisplayChart:
self.topDialog = gtk.glade.XML(self.glade_file,"view","gramps")
self.topDialog.signal_autoconnect({
"on_write_table" : self.on_write_table,
"destroy_passed_object" : Utils.destroy_passed_object
"destroy_passed_object" : self.close,
"on_view_delete_event" : self.on_delete_event,
})
self.top = self.topDialog.get_widget("view")
self.window = self.topDialog.get_widget("view")
self.eventlist = self.topDialog.get_widget('treeview')
Utils.set_titles(self.top, self.topDialog.get_widget('title'),
Utils.set_titles(self.window, self.topDialog.get_widget('title'),
_('Event Comparison'))
self.sort = Sort.Sort(self.db)
@ -270,7 +274,33 @@ class DisplayChart:
self.event_titles = self.make_event_titles()
self.build_row_data()
self.draw_clist_display()
self.top.show()
self.add_itself_to_menu()
self.window.show()
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
self.parent_menu_item = gtk.MenuItem(_("Event Comparison"))
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()
def draw_clist_display(self):

View File

@ -66,11 +66,6 @@ def is_initial(name):
else:
return name[0] == name[0].upper()
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
#-------------------------------------------------------------------------
#
#
@ -78,8 +73,10 @@ def is_initial(name):
#-------------------------------------------------------------------------
class Merge:
def __init__(self,database,callback):
def __init__(self,database,callback,parent):
self.db = database
self.parent = parent
self.win_key = self
self.map = {}
self.list = []
self.index = 0
@ -114,13 +111,38 @@ class Merge:
self.menu = top.get_widget("menu")
self.menu.set_menu(my_menu)
Utils.set_titles(top.get_widget('dialog'), top.get_widget('title'),
self.dialog_window = top.get_widget('dialog')
Utils.set_titles(self.dialog_window, top.get_widget('title'),
_('Merge people'))
top.signal_autoconnect({
"on_merge_ok_clicked" : self.on_merge_ok_clicked,
"destroy_passed_object" : Utils.destroy_passed_object
"destroy_passed_object" : self.close,
"on_delete_merge_event" : self.on_delete_event,
})
self.add_itself_to_menu()
self.dialog_window.show()
def on_delete_event(self,obj,b):
self.remove_itself_from_menu()
def close(self,obj):
self.remove_itself_from_menu()
self.dialog_window.destroy()
def add_itself_to_menu(self):
self.parent.child_windows[self.win_key] = self
self.parent_menu_item = gtk.MenuItem(_('Merge people'))
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.dialog_window.present()
def ancestors_of(self,p1_id,id_list):
if (not p1_id) or (p1_id in id_list):
@ -136,7 +158,7 @@ class Merge:
def on_merge_ok_clicked(self,obj):
active = self.menu.get_menu().get_active().get_data("v")
self.use_soundex = self.soundex_obj.get_active()
Utils.destroy_passed_object(obj)
self.close(obj)
self.find_potentials(active)
self.show()
@ -221,8 +243,9 @@ class Merge:
self.mlist = top.get_widget("mlist")
top.signal_autoconnect({
"destroy_passed_object" : Utils.destroy_passed_object,
"destroy_passed_object" : self.close_show,
"on_do_merge_clicked" : self.on_do_merge_clicked,
"on_delete_show_event" : self.on_delete_show_event,
})
mtitles = [(_('Rating'),3,75),(_('First Person'),1,200),
@ -231,6 +254,29 @@ class Merge:
event_func=self.on_do_merge_clicked)
self.redraw()
self.add_show_to_menu()
self.window.show()
def on_delete_show_event(self,obj,b):
self.remove_show_from_menu()
def close_show(self,obj):
self.remove_show_from_menu()
self.window.destroy()
def add_show_to_menu(self):
self.parent.child_windows[self.win_key] = self
self.parent_menu_item = gtk.MenuItem(_('Potential Merges'))
self.parent_menu_item.connect("activate",self.present_show)
self.parent_menu_item.show()
self.parent.winsmenu.append(self.parent_menu_item)
def remove_show_from_menu(self):
del self.parent.child_windows[self.win_key]
self.parent_menu_item.destroy()
def present_show(self,obj):
self.window.present()
def redraw(self):
list = []
@ -258,7 +304,7 @@ class Merge:
(p1,p2) = self.list.get_object(iter)
pn1 = self.db.find_person_from_id(p1)
pn2 = self.db.find_person_from_id(p2)
MergeData.MergePeople(self.db,pn1,pn2,self.on_update)
MergeData.MergePeople(self.parent,self.db,pn1,pn2,self.on_update)
def on_update(self,p1_id,p2_id,old_id):
self.dellist[p2_id] = p1_id
@ -562,7 +608,11 @@ class Merge:
return chance
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def name_of(p):
if not p:
return ""
@ -579,9 +629,9 @@ def get_name_obj(person):
#
#
#-------------------------------------------------------------------------
def runTool(database,active_person,callback):
def runTool(database,active_person,callback,parent=None):
try:
Merge(database,callback)
Merge(database,callback,parent)
except:
import DisplayTrace
DisplayTrace.DisplayTrace()
@ -608,4 +658,3 @@ register_tool(
description=_("Searches the entire database, looking for "
"individual entries that may represent the same person.")
)

View File

@ -13,7 +13,13 @@
<property name="default_height">400</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">True</property>
<signal name="delete_event" handler="on_delete_event" last_modification_time="Mon, 10 May 2004 22:50:36 GMT"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
@ -34,6 +40,7 @@
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="destroy_passed_object" object="top"/>
</widget>

View File

@ -292,6 +292,7 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">False</property>
<signal name="delete_event" handler="on_view_delete_event" last_modification_time="Mon, 10 May 2004 22:57:39 GMT"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox3">

View File

@ -112,6 +112,7 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">False</property>
<signal name="delete_event" handler="on_delete_show_event" last_modification_time="Mon, 10 May 2004 23:33:31 GMT"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox3">
@ -239,6 +240,7 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">False</property>
<signal name="delete_event" handler="on_delete_merge_event" last_modification_time="Mon, 10 May 2004 23:33:50 GMT"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox4">

View File

@ -8,11 +8,16 @@
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="modal">True</property>
<property name="default_width">450</property>
<property name="default_height">400</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
@ -34,6 +39,7 @@
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="destroy_passed_object" object="summary"/>
</widget>
@ -89,6 +95,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="overwrite">False</property>
<property name="accepts_tab">True</property>
<property name="justification">GTK_JUSTIFY_LEFT</property>
<property name="wrap_mode">GTK_WRAP_NONE</property>
<property name="cursor_visible">True</property>