Enhanced several plugins

svn: r504
This commit is contained in:
Don Allingham 2001-10-21 22:11:30 +00:00
parent ea59f17e89
commit 6aea5773e8
3 changed files with 67 additions and 88 deletions

View File

@ -21,11 +21,10 @@
"Analysis and Exploration/Interactive descendant browser"
from RelLib import *
import re
import string
import os
import utils
import intl
import Config
_ = intl.gettext
@ -39,36 +38,32 @@ from libglade import *
#
#------------------------------------------------------------------------
def runTool(database,person,callback):
global active_person
global topDialog
global glade_file
global db
DesBrowse(database,person,callback)
active_person = person
db = database
class DesBrowse:
def __init__(self,database,person,callback):
self.active = person
self.db = database
self.callback = callback
base = os.path.dirname(__file__)
glade_file = base + os.sep + "desbrowse.glade"
topDialog = GladeXML(glade_file,"top")
topDialog.signal_autoconnect({
self.glade = GladeXML(glade_file,"top")
self.glade.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object,
})
top = topDialog.get_widget("top")
tree= topDialog.get_widget("tree1")
add_to_tree(tree,active_person)
top = self.glade.get_widget("top")
tree= self.glade.get_widget("tree1")
self.add_to_tree(tree,self.active)
top.show()
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def add_to_tree(tree,person):
item = GtkTreeItem(person.getPrimaryName().getName())
def add_to_tree(self,tree,person):
item = GtkTreeItem(Config.nameof(person))
item.show()
item.connect('button-press-event',self.button_press_event)
item.set_data('d',person)
tree.append(item)
subtree = None
for family in person.getFamilyList():
@ -77,7 +72,13 @@ def add_to_tree(tree,person):
subtree = GtkTree()
subtree.show()
item.set_subtree(subtree)
add_to_tree(subtree,child)
self.add_to_tree(subtree,child)
def button_press_event(self,obj,event):
import EditPerson
if event.button == 1 and event.type == GDK._2BUTTON_PRESS:
person = obj.get_data('d')
EditPerson.EditPerson(person,self.db,self.callback)
#------------------------------------------------------------------------
#
@ -93,3 +94,4 @@ register_tool(
description=_("Provides a browsable hierarchy based on the active person")
)

View File

@ -74,20 +74,6 @@ def get_name_obj(p1):
else:
return p1.getPrimaryName()
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def on_merge_ok_clicked(obj):
myobj = obj.get_data("t")
active = myobj.menu.get_menu().get_active().get_data("v")
myobj.use_soundex = myobj.soundex_obj.get_active()
utils.destroy_passed_object(obj)
myobj.find_potentials(active)
myobj.show()
#-------------------------------------------------------------------------
#
#
@ -118,7 +104,6 @@ class Merge:
self.glade_file = base + os.sep + "merge.glade"
top = GladeXML(self.glade_file,"dialog")
topWin = top.get_widget("dialog")
topWin.set_data("t",self)
my_menu = GtkMenu()
item = GtkMenuItem(_("Low"))
@ -139,10 +124,19 @@ class Merge:
self.menu.set_menu(my_menu)
top.signal_autoconnect({
"on_merge_ok_clicked" : on_merge_ok_clicked,
"on_merge_ok_clicked" : self.on_merge_ok_clicked,
"destroy_passed_object" : utils.destroy_passed_object
})
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.find_potentials(active)
self.show()
#---------------------------------------------------------------------
#
#
@ -227,18 +221,26 @@ class Merge:
self.altname = self.topDialog.get_widget("altname")
self.topDialog.signal_autoconnect({
"on_next_clicked" : on_next_clicked,
"on_merge_clicked" : on_merge_clicked,
"destroy_passed_object" : update_and_destroy
"on_next_clicked" : self.on_next_clicked,
"on_merge_clicked" : self.on_merge_clicked,
"destroy_passed_object" : self.update_and_destroy
})
if len(self.map) > 0:
top = self.topDialog.get_widget("merge")
top.set_data("MergeObject",self)
top.show()
top.set_data("t",self)
self.load_next()
def on_merge_clicked(self,obj):
self.merge()
def on_next_clicked(self,obj):
self.load_next()
def update_and_destroy(self,obj):
self.update(1)
utils.destroy_passed_object(obj)
#---------------------------------------------------------------------
#
#
@ -914,33 +916,6 @@ class Merge:
def runTool(database,active_person,callback):
mergeObj = Merge(database,callback)
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def update_and_destroy(obj):
obj.get_data("t").update(1)
utils.destroy_passed_object(obj)
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def on_next_clicked(obj):
myObject = obj.get_data("MergeObject")
myObject.load_next()
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def on_merge_clicked(obj):
myObject = obj.get_data("MergeObject")
myObject.merge()
#-------------------------------------------------------------------------
#
#

View File

@ -129,7 +129,7 @@
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<padding>10</padding>
<expand>False</expand>
<fill>False</fill>
</child>
@ -159,6 +159,7 @@
<widget>
<class>GtkFrame</class>
<name>PersonFrame1</name>
<width>300</width>
<label>First Person</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
@ -787,6 +788,7 @@
<widget>
<class>GtkFrame</class>
<name>PersonFrame2</name>
<width>300</width>
<label>Second Person</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
@ -1420,7 +1422,7 @@
<spacing>0</spacing>
<child>
<padding>10</padding>
<expand>True</expand>
<expand>False</expand>
<fill>True</fill>
</child>
@ -1478,7 +1480,7 @@
<name>hseparator8</name>
<child>
<padding>0</padding>
<expand>True</expand>
<expand>False</expand>
<fill>True</fill>
</child>
</widget>
@ -1490,7 +1492,7 @@
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<expand>False</expand>
<fill>True</fill>
</child>