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

View File

@ -74,20 +74,6 @@ def get_name_obj(p1):
else: else:
return p1.getPrimaryName() 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" self.glade_file = base + os.sep + "merge.glade"
top = GladeXML(self.glade_file,"dialog") top = GladeXML(self.glade_file,"dialog")
topWin = top.get_widget("dialog") topWin = top.get_widget("dialog")
topWin.set_data("t",self)
my_menu = GtkMenu() my_menu = GtkMenu()
item = GtkMenuItem(_("Low")) item = GtkMenuItem(_("Low"))
@ -139,10 +124,19 @@ class Merge:
self.menu.set_menu(my_menu) self.menu.set_menu(my_menu)
top.signal_autoconnect({ 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 "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.altname = self.topDialog.get_widget("altname")
self.topDialog.signal_autoconnect({ self.topDialog.signal_autoconnect({
"on_next_clicked" : on_next_clicked, "on_next_clicked" : self.on_next_clicked,
"on_merge_clicked" : on_merge_clicked, "on_merge_clicked" : self.on_merge_clicked,
"destroy_passed_object" : update_and_destroy "destroy_passed_object" : self.update_and_destroy
}) })
if len(self.map) > 0: if len(self.map) > 0:
top = self.topDialog.get_widget("merge") top = self.topDialog.get_widget("merge")
top.set_data("MergeObject",self)
top.show() top.show()
top.set_data("t",self)
self.load_next() 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): def runTool(database,active_person,callback):
mergeObj = Merge(database,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> <xpad>0</xpad>
<ypad>0</ypad> <ypad>0</ypad>
<child> <child>
<padding>0</padding> <padding>10</padding>
<expand>False</expand> <expand>False</expand>
<fill>False</fill> <fill>False</fill>
</child> </child>
@ -159,6 +159,7 @@
<widget> <widget>
<class>GtkFrame</class> <class>GtkFrame</class>
<name>PersonFrame1</name> <name>PersonFrame1</name>
<width>300</width>
<label>First Person</label> <label>First Person</label>
<label_xalign>0</label_xalign> <label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
@ -787,6 +788,7 @@
<widget> <widget>
<class>GtkFrame</class> <class>GtkFrame</class>
<name>PersonFrame2</name> <name>PersonFrame2</name>
<width>300</width>
<label>Second Person</label> <label>Second Person</label>
<label_xalign>0</label_xalign> <label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
@ -1420,7 +1422,7 @@
<spacing>0</spacing> <spacing>0</spacing>
<child> <child>
<padding>10</padding> <padding>10</padding>
<expand>True</expand> <expand>False</expand>
<fill>True</fill> <fill>True</fill>
</child> </child>
@ -1478,7 +1480,7 @@
<name>hseparator8</name> <name>hseparator8</name>
<child> <child>
<padding>0</padding> <padding>0</padding>
<expand>True</expand> <expand>False</expand>
<fill>True</fill> <fill>True</fill>
</child> </child>
</widget> </widget>
@ -1490,7 +1492,7 @@
<spacing>0</spacing> <spacing>0</spacing>
<child> <child>
<padding>0</padding> <padding>0</padding>
<expand>True</expand> <expand>False</expand>
<fill>True</fill> <fill>True</fill>
</child> </child>