Find support

svn: r1423
This commit is contained in:
Don Allingham 2003-04-04 05:48:25 +00:00
parent 6ee5b68393
commit 165efc5848
23 changed files with 899 additions and 1210 deletions

View File

@ -466,8 +466,6 @@ uninstall-info: uninstall-info-recursive
uninstall-info-recursive uninstall-local uninstall-recursive
#grampsdocdir = $(datadir)/doc/gramps-$(VERSION)
gramps: gramps.sh
cp gramps.sh gramps

10
aclocal.m4 vendored
View File

@ -809,9 +809,7 @@ AC_DEFUN([AM_PATH_PYTHON],
m4_if([$1],[],[
dnl No version check is needed.
# Find any Python interpreter.
AC_PATH_PROG([PYTHON], _AM_PYTHON_INTERPRETER_LIST)
am_display_PYTHON=python
], [
AC_PATH_PROG([PYTHON], _AM_PYTHON_INTERPRETER_LIST)],[
dnl A version check is needed.
if test -n "$PYTHON"; then
# If the user set $PYTHON, use it and don't search something else.
@ -832,7 +830,6 @@ AC_DEFUN([AM_PATH_PYTHON],
done])
# Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON.
AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON])
am_display_PYTHON=$am_cv_pathless_PYTHON
fi
])
@ -840,7 +837,7 @@ AC_DEFUN([AM_PATH_PYTHON],
dnl the best way to do this; it's what "site.py" does in the standard
dnl library.
AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
AC_CACHE_CHECK([for $am_cv_pathless_PYTHON version], [am_cv_python_version],
[am_cv_python_version=`$PYTHON -c "import sys; print sys.version[[:3]]"`])
AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
@ -855,7 +852,8 @@ AC_DEFUN([AM_PATH_PYTHON],
dnl At times (like when building shared libraries) you may want
dnl to know which OS platform Python thinks this is.
AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
AC_CACHE_CHECK([for $am_cv_pathless_PYTHON platform],
[am_cv_python_platform],
[am_cv_python_platform=`$PYTHON -c "import sys; print sys.platform"`])
AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])

989
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
<!DOCTYPE database SYSTEM "gramps.dtd" []>
<database>
<header>
<created date="21 MAR 2003" version="0.9.0-1" people="42" families="15" sources="4" places="24"/>
<created date="2 APR 2003" version="0.9.1-pre1" people="42" families="15" sources="4" places="25"/>
<researcher>
<resname>Joe Smith</resname>
<resaddr>Over There</resaddr>
@ -104,6 +104,35 @@
<childof ref="F6"/>
<parentin ref="F12"/>
</person>
<person id="I8">
<gender>M</gender>
<name type="Birth Name">
<first>Hjalmar</first>
<last>Smith</last>
</name>
<event type="Birth">
<dateval val="1895-04-07"/>
<place ref="P3"/>
</event>
<event type="Death">
<dateval val="1975-06-26"/>
<place ref="P10"/>
</event>
<event type="Baptism">
<dateval val="1895-06-03"/>
<place ref="P28"/>
</event>
<event type="Immi">
<dateval val="1912-11-14"/>
<place ref="P13"/>
</event>
<childof ref="F3"/>
<parentin ref="F6"/>
<note>BIOGRAPHY
Hjalmar sailed from Copenhagen, Denmark on the OSCAR II, 14 November 1912 arriving in New York 27 November 1912. He was seventeen years old. On the ship passenger list his trade was listed as a Blacksmith. He came to Reno, Nevada and lived with his sister Marie for a time before settling in Sparks. He worked for Southern Pacific Railroad as a car inspector for a time, then went to work for Standard Oil
Company. He enlisted in the army at Sparks 7 December 1917 and served as a Corporal in the Medical Corp until his discharge 12 August 1919 at the Presidio in San Francisco, California. Both he and Marjorie are buried in the Masonic Memorial Gardens Mausoleum in Reno, he the 30th June 1975, and she the 25th of June 1980.</note>
</person>
<person id="I15">
<gender>M</gender>
<name type="Birth Name">
@ -335,34 +364,17 @@
</event>
<childof ref="F2"/>
</person>
<person id="I8">
<person id="I35">
<gender>M</gender>
<name type="Birth Name">
<first>Hjalmar</first>
<first>Lars Peter</first>
<last>Smith</last>
</name>
<event type="Birth">
<dateval val="1895-04-07"/>
<place ref="P3"/>
<dateval val="1991-09-16"/>
<place ref="P21"/>
</event>
<event type="Death">
<dateval val="1975-06-26"/>
<place ref="P10"/>
</event>
<event type="Baptism">
<dateval val="1895-06-03"/>
<place ref="P28"/>
</event>
<event type="Immi">
<dateval val="1912-11-14"/>
<place ref="P13"/>
</event>
<childof ref="F3"/>
<parentin ref="F6"/>
<note>BIOGRAPHY
Hjalmar sailed from Copenhagen, Denmark on the OSCAR II, 14 November 1912 arriving in New York 27 November 1912. He was seventeen years old. On the ship passenger list his trade was listed as a Blacksmith. He came to Reno, Nevada and lived with his sister Marie for a time before settling in Sparks. He worked for Southern Pacific Railroad as a car inspector for a time, then went to work for Standard Oil
Company. He enlisted in the army at Sparks 7 December 1917 and served as a Corporal in the Medical Corp until his discharge 12 August 1919 at the Presidio in San Francisco, California. Both he and Marjorie are buried in the Masonic Memorial Gardens Mausoleum in Reno, he the 30th June 1975, and she the 25th of June 1980.</note>
<childof ref="F10" mrel="Adopted" frel="Adopted"/>
</person>
<person id="I36">
<gender>F</gender>
@ -544,18 +556,6 @@ Company. He enlisted in the army at Sparks 7 December 1917 and served as a Corpo
<childof ref="F9"/>
<parentin ref="F8"/>
</person>
<person id="I32">
<gender>F</gender>
<name type="Birth Name">
<first>Darcy</first>
<last>Horne</last>
</name>
<event type="Birth">
<dateval val="1966-07-02"/>
<place ref="P20"/>
</event>
<parentin ref="F10"/>
</person>
<person id="I25">
<gender>F</gender>
<name type="Birth Name">
@ -597,17 +597,17 @@ Company. He enlisted in the army at Sparks 7 December 1917 and served as a Corpo
<childof ref="F12"/>
<parentin ref="F13"/>
</person>
<person id="I35">
<gender>M</gender>
<person id="I32">
<gender>F</gender>
<name type="Birth Name">
<first>Lars Peter</first>
<last>Smith</last>
<first>Darcy</first>
<last>Horne</last>
</name>
<event type="Birth">
<dateval val="1991-09-16"/>
<place ref="P21"/>
<dateval val="1966-07-02"/>
<place ref="P20"/>
</event>
<childof ref="F10" mrel="Adopted" frel="Adopted"/>
<parentin ref="F10"/>
</person>
<person id="I21">
<gender>M</gender>
@ -839,6 +839,7 @@ Martin was listed as being a Husman, (owning a house as opposed to a farm) in th
<placeobj id="P8" title="Hayward, Alameda Co., CA"/>
<placeobj id="P9" title="Community Presbyterian Church, Danville, CA"/>
<placeobj id="P26" title="Smestorp, Kristianstad Lan, Sweden"/>
<placeobj id="P25" title="Bí"/>
<placeobj id="P11" title="Sweden"/>
<placeobj id="P19" title="Denver, Denver Co., CO"/>
<placeobj id="P27" title="Tommarp, Kristianstad Lan, Sweden"/>
@ -846,15 +847,15 @@ Martin was listed as being a Husman, (owning a house as opposed to a farm) in th
<placeobj id="P24" title="UC Berkeley"/>
<placeobj id="P12" title="Grostorp, Kristianstad Lan, Sweden"/>
<placeobj id="P13" title="Copenhagen, Denmark"/>
<placeobj id="P14" title="Hoya/Jona/Hoia, Sweden"/>
<placeobj id="P20" title="Sacramento, Sacramento Co., CA"/>
<placeobj id="P21" title="Santa Rosa, Sonoma Co., CA"/>
<placeobj id="P15" title="Simrishamn, Kristianstad Lan, Sweden"/>
<placeobj id="P16" title="Fremont, Alameda Co., CA"/>
<placeobj id="P22" title="San Jose, Santa Clara Co., CA"/>
<placeobj id="P21" title="Santa Rosa, Sonoma Co., CA"/>
<placeobj id="P14" title="Hoya/Jona/Hoia, Sweden"/>
<placeobj id="P30" title="San Ramon, Conta Costa Co., CA"/>
<placeobj id="P29" title="Woodland, Yolo Co., CA"/>
<placeobj id="P28" title="Ronne Bornholm, Denmark"/>
<placeobj id="P15" title="Simrishamn, Kristianstad Lan, Sweden"/>
<placeobj id="P20" title="Sacramento, Sacramento Co., CA"/>
</places>
<objects>
<object id="O5" src="O5.jpg" mime="image/jpeg" description="Edwin &amp; Janice Smith"/>

View File

@ -41,6 +41,14 @@ import string
#-------------------------------------------------------------------------
import gtk
_t = type(u'')
def patch(n):
if type(n) != _t:
return (unicode(n).lower(),unicode(n))
else:
return (n.lower(),n)
#-------------------------------------------------------------------------
#
# AutoCompBase
@ -63,10 +71,11 @@ class AutoCompBase:
self.nlist = source.nlist
else:
self.nlist = []
self.nlist = map((lambda n: (string.lower(n),n)),plist)
self.nlist.sort()
self.nlist = map(patch,plist)
self.nlist.sort()
self.nl = "xzsdkdjecsc"
self.l = 0
self.t = type(u' ')
def insert_text(self,entry,new_text,new_text_len,i_dont_care):
"""
@ -182,6 +191,9 @@ class AutoCombo(AutoCompBase):
typed = entry.get_text()
if (not typed):
return
if type(typed) != self.t:
typed = unicode(typed)
typed_lc = string.lower(typed)
if typed_lc == self.nl:
@ -224,7 +236,7 @@ class AutoEntry(AutoCompBase):
AutoCompBase.__init__(self,widget,plist,source)
self.entry = widget
self.entry.connect("insert-text",self.insert_text)
def timer_callback(self,entry):
"""
The workhorse routine of file completion. This routine grabs the
@ -240,6 +252,10 @@ class AutoEntry(AutoCompBase):
# Get the user's text
typed = entry.get_text()
if type(typed) != self.t:
typed = unicode(typed)
if (not typed):
return
typed_lc = string.lower(typed)

View File

@ -677,8 +677,17 @@ class EditPerson:
self.etree.select_row(0)
# Remember old combo list input
prev_btext = Utils.strip_id(self.bplace.get_text())
prev_dtext = Utils.strip_id(self.dplace.get_text())
bplace_text = self.bplace.get_text()
if type(bplace_text) == type(u''):
bplace_text = unicode(bplace_text)
dplace_text = self.dplace.get_text()
if type(dplace_text) == type(u''):
dplace_text = unicode(dplace_text)
prev_btext = Utils.strip_id(bplace_text)
prev_dtext = Utils.strip_id(dplace_text)
# Update birth with new values, make sure death values don't change
if self.update_birth:
@ -745,6 +754,9 @@ class EditPerson:
event = self.birth
event.setDate(self.bdate.get_text())
def_placename = self.bplace.get_text()
if type(def_placename) == type(u''):
def_placename = unicode(def_placename)
p = self.get_place(self.bplace)
if p:
event.setPlace(p)
@ -762,6 +774,9 @@ class EditPerson:
event = self.death
event.setDate(self.ddate.get_text())
def_placename = self.dplace.get_text()
if type(def_placename) == type(u''):
def_placename = unicode(def_placename)
p = self.get_place(self.dplace)
if p:
event.setPlace(p)

View File

@ -57,16 +57,13 @@ from intl import gettext as _
class FindBase:
"""Opens find person dialog for gramps"""
def __init__(self,clist,task,name,db):
def __init__(self,task,name,db):
"""Opens a dialog box instance that allows users to
search for a person.
clist - GtkCList containing the people information
task - function to call to change the active person"""
self.t = type(u' ')
self.db = db
self.clist = clist
self.nlist = []
self.task = task
self.glade = gtk.glade.XML(const.gladeFile,"find")
self.glade.signal_autoconnect({
@ -76,38 +73,46 @@ class FindBase:
})
self.top = self.glade.get_widget('find')
self.entry = self.glade.get_widget('entry')
self.forward_button = self.glade.get_widget('forward')
self.back_button = self.glade.get_widget('back')
Utils.set_titles(self.top, self.glade.get_widget('title'), name)
self.index = 0
def get_value(self,id):
return None
def enable_autocomp(self):
if GrampsCfg.autocomp:
self.comp = AutoComp.AutoEntry(self.entry,self.nlist)
return id
def advance(self,func):
text = self.entry.get_text()
if type(text) != self.t:
text = unicode(text.upper())
orow = self.index
func()
while self.row != orow:
id = self.clist.get_row_data(self.row)
while self.index != orow:
vals = self.list[self.index]
id = vals[1]
name = vals[0]
if id == None:
func()
continue
if string.find(string.upper(self.get_value(id)),string.upper(text)) >= 0:
self.task(self.row)
if string.find(name.upper(),text) >= 0:
self.back_button.set_sensitive(0)
self.forward_button.set_sensitive(0)
self.task(self.get_value(id))
self.back_button.set_sensitive(1)
self.forward_button.set_sensitive(1)
return
func()
gtk.gdk_beep()
def forward(self):
self.row = self.row + 1
if self.row == self.clist.rows:
self.row = 0
self.index = self.index + 1
if self.index == len(self.list):
self.index = 0
def backward(self):
self.row = self.row - 1
if self.row < 0:
self.row = self.clist.rows
self.index = self.index - 1
if self.index < 0:
self.index = len(self.list)
def on_close_clicked(self,obj):
"""Destroys the window in response to a close window button press"""
@ -129,23 +134,19 @@ class FindBase:
class FindPerson(FindBase):
"""Opens a Find Person dialog for GRAMPS"""
def __init__(self,id,task,db):
def __init__(self,task,db):
"""Opens a dialog box instance that allows users to
search for a person.
clist - GtkCList containing the people information
task - function to call to change the active person"""
FindBase.__init__(self,id,task,_("Find Person"),db)
for n in self.db.getPersonKeys():
val = self.db.getPersonDisplay(n)
self.nlist.append(val[0])
self.enable_autocomp()
FindBase.__init__(self,task,_("Find Person"),db)
self.list = db.personTable.values()
self.list.sort()
def get_value(self,id):
return self.db.getPersonDisplay(id)[0]
return self.db.getPerson(id)
#-------------------------------------------------------------------------
#
# FindPlace
@ -154,20 +155,15 @@ class FindPerson(FindBase):
class FindPlace(FindBase):
"""Opens a Find Place dialog for GRAMPS"""
def __init__(self,clist,task,db):
def __init__(self,task,db):
"""Opens a dialog box instance that allows users to
search for a place.
clist - GtkCList containing the people information
task - function to call to change the active person"""
FindBase.__init__(self,clist,task,_("Find Place"),db)
for n in self.db.getPlaceKeys():
self.nlist.append(self.db.getPlaceDisplay(n)[0])
self.enable_autocomp()
def get_value(self,id):
return self.db.getPlaceDisplay(id)[0]
FindBase.__init__(self,task,_("Find Place"),db)
self.list = db.placeTable.values()
self.list.sort()
#-------------------------------------------------------------------------
#
@ -177,20 +173,15 @@ class FindPlace(FindBase):
class FindSource(FindBase):
"""Opens a Find Place dialog for GRAMPS"""
def __init__(self,clist,task,db):
def __init__(self,task,db):
"""Opens a dialog box instance that allows users to
search for a place.
clist - GtkCList containing the people information
task - function to call to change the active person"""
FindBase.__init__(self,clist,task,_("Find Source"),db)
for n in self.db.getSourceKeys():
self.nlist.append(n[0])
self.enable_autocomp()
def get_value(self,id):
return self.db.getSourceDisplay(id)[0]
FindBase.__init__(self,task,_("Find Source"),db)
self.list = db.sourceTable.values()
self.list.sort()
#-------------------------------------------------------------------------
#
@ -200,39 +191,15 @@ class FindSource(FindBase):
class FindMedia(FindBase):
"""Opens a Find Media Object dialog for GRAMPS"""
def __init__(self,clist,task,db):
def __init__(self,task,db):
"""Opens a dialog box instance that allows users to
search for a place.
clist - GtkCList containing the people information
task - function to call to change the active person"""
FindBase.__init__(self,clist,task,_("Find Media Object"),db)
FindBase.__init__(self,task,_("Find Media Object"),db)
self.list = []
for n in self.db.getObjectMap().values():
self.nlist.append(n.getDescription())
self.enable_autocomp()
self.list.append((n.getDescription(),n.getId()))
self.list.sort()
def advance(self,func):
try:
self.row = self.clist.selection[0]
except IndexError:
gtk.gdk_beep()
return
text = self.entry.get_text()
if self.row == None or text == "":
gtk.gdk_beep()
return
orow = self.row
func()
while self.row != orow:
value = self.clist.get_row_data(self.row)
if value == None:
func()
continue
name = value.getDescription()
if string.find(string.upper(name),string.upper(text)) >= 0:
self.task(self.row)
return
func()
gtk.gdk_beep()

View File

@ -33,8 +33,6 @@ class ListModel:
self.mylist = [TYPE_STRING]*l + [TYPE_PYOBJECT]
self.tree.set_rules_hint(gtk.TRUE)
self.tree.set_enable_search(gtk.TRUE)
self.tree.set_search_column(gtk.TRUE)
self.new_model()
self.selection = self.tree.get_selection()
self.selection.set_mode(mode)

View File

@ -260,7 +260,7 @@ RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
install-exec-recursive installdirs-recursive install-recursive \
uninstall-recursive check-recursive installcheck-recursive
DIST_COMMON = README $(dist_pkgdata_DATA) $(pkgpython_PYTHON) AUTHORS \
ChangeLog Makefile.am Makefile.in NEWS const.py.in
ChangeLog Makefile.am Makefile.in NEWS TODO const.py.in
DIST_SUBDIRS = $(SUBDIRS)
all: all-recursive

View File

@ -114,7 +114,11 @@ class MediaView:
self.update = update
self.list.connect('button-press-event',self.on_button_press_event)
self.selection.connect('changed',self.on_select_row)
def goto(self,id):
self.selection.unselect_all()
self.selection.select_iter(self.id2col[id])
def change_db(self,db):
self.db = db
@ -214,23 +218,6 @@ class MediaView:
self.id2col[id] = iter
self.model.set(iter, 0, title, 1, id, 2, type, 3, path, 4, stitle)
# if index > 0:
# self.list.select_row(current_row,0)
# self.list.moveto(current_row)
# self.preview.show()
# else:
# self.mid.set_text("")
# self.mtype.set_text("")
# self.mdesc.set_text("")
# self.mpath.set_text("")
# self.mdetails.set_text("")
# self.preview.hide()
# if current_row < self.list.rows:
# self.list.moveto(current_row)
# else:
# self.list.moveto(0)
# self.list.thaw()
def on_add_clicked(self,obj):
"""Add a new media object to the media list"""

View File

@ -182,8 +182,9 @@ class PedigreeView:
for t in list:
if t:
for n in [GrampsCfg.nameof(t[0]),
"b. %s" % t[0].getBirth().getDate(),
"d. %s" % t[0].getDeath().getDate()]:
u'b. %s' % t[0].getBirth().getDate(),
u'd. %s' % t[0].getDeath().getDate()]:
print n, type(n)
try:
a.set_text(n,len(n))
except TypeError:

View File

@ -92,6 +92,7 @@ class PlaceView:
gobject.TYPE_STRING)
self.list.set_model(self.model)
self.list.get_column(0).clicked()
self.selection = self.list.get_selection()
def change_db(self,db):
self.db = db
@ -124,8 +125,11 @@ class PlaceView:
self.list.set_model(self.model)
self.list.get_column(0).clicked()
def merge(self):
def goto(self,id):
self.selection.unselect_all()
self.selection.select_iter(self.id2col[id])
def merge(self):
mlist = []
self.selection.selected_foreach(self.blist,mlist)

View File

@ -39,6 +39,7 @@ class SaveDialog:
label2.set_text(msg2)
label2.set_use_markup(gtk.TRUE)
self.top.show()
response = self.top.run()
if response == gtk.RESPONSE_NO:
self.task1()
@ -62,6 +63,7 @@ class QuestionDialog:
self.xml.get_widget('okbutton').set_label(label)
self.top.show()
response = self.top.run()
if response == gtk.RESPONSE_ACCEPT:
task()
@ -83,6 +85,7 @@ class OptionDialog:
self.xml.get_widget('option1').set_label(btnmsg1)
self.xml.get_widget('option2').set_label(btnmsg2)
self.top.show()
response = self.top.run()
if response == gtk.RESPONSE_NO:
if task1:
@ -102,6 +105,7 @@ class ErrorDialog:
label1.set_text('<span weight="bold" size="larger">%s</span>' % msg1)
label1.set_use_markup(gtk.TRUE)
label2.set_text(msg2)
self.top.show()
self.top.run()
self.top.destroy()
@ -116,6 +120,7 @@ class WarningDialog:
label1.set_text('<span weight="bold" size="larger">%s</span>' % msg1)
label1.set_use_markup(gtk.TRUE)
label2.set_text(msg2)
self.top.show()
self.top.run()
self.top.destroy()
@ -130,6 +135,7 @@ class OkDialog:
label1.set_text('<span weight="bold" size="larger">%s</span>' % msg1)
label1.set_use_markup(gtk.TRUE)
label2.set_text(msg2)
self.top.show()
self.top.run()
self.top.destroy()

View File

@ -1935,6 +1935,9 @@ class GrampsDB(Persistent):
def need_autosave(self):
return 1
def getPersonLength(self):
return len(self.personTable)
def getPersonKeys(self):
return self.personTable.keys()

View File

@ -1,7 +1,7 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000 Donald N. Allingham
# Copyright (C) 2003 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
@ -176,6 +176,12 @@ def get_nephew(f,s,level):
def get_niece(f,s,level):
return "%s of %s" % (niece_level[level],f)
def is_spouse(orig,other):
for f in orig.getFamilyList():
if other == f.getFather() or other == f.getMother():
return 1
return 0
def get_relationship(orig_person,other_person):
firstMap = {}
firstList = []
@ -184,6 +190,17 @@ def get_relationship(orig_person,other_person):
common = []
rank = 9999999
if orig_person == None:
return "No home person has been defined"
firstName = orig_person.getPrimaryName().getRegularName()
secondName = other_person.getPrimaryName().getRegularName()
if orig_person == other_person:
return firstName
if is_spouse(orig_person,other_person):
return "Spouse of %s" % (firstName)
filter(orig_person,0,firstList,firstMap)
filter(other_person,0,secondList,secondMap)
@ -199,9 +216,6 @@ def get_relationship(orig_person,other_person):
firstRel = -1
secondRel = -1
firstName = orig_person.getPrimaryName().getRegularName()
secondName = other_person.getPrimaryName().getRegularName()
length = len(common)
if length == 1:

View File

@ -82,7 +82,6 @@ class SourceView:
column.set_min_width(title[2])
self.list.append_column(column)
self.list.set_search_column(0)
self.model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING,
gobject.TYPE_STRING, gobject.TYPE_STRING,
gobject.TYPE_STRING)
@ -92,13 +91,18 @@ class SourceView:
def change_db(self,db):
self.db = db
def goto(self,id):
self.list.get_selection().select_iter(self.map[id])
def load_sources(self):
self.model.clear()
self.map = {}
for key in self.db.getSourceKeys():
val = self.db.getSourceDisplay(key)
iter = self.model.append()
self.map[val[1]] = iter
self.model.set(iter, 0, val[0], 1, val[1], 2, val[2],
3, val[3], 4, val[4])
self.list.connect('button-press-event',self.button_press)

View File

@ -93,6 +93,19 @@ def clear_timer():
gtk.timeout_remove(_autosave_tim)
_autosave_tim = None
#-------------------------------------------------------------------------
#
# force_unicode
#
#-------------------------------------------------------------------------
_t = type(u'')
def force_unicode(n):
if type(n) != _t:
return (unicode(n).lower(),unicode(n))
else:
return (n.lower(),n)
#-------------------------------------------------------------------------
#
# Clears the modified flag. Should be called after data is saved.
@ -120,7 +133,7 @@ def phonebook_name(person):
if person:
return person.getPrimaryName().getName()
else:
return ""
return u''
def family_name(family):
"""Builds a name for the family from the parents names"""
@ -146,7 +159,7 @@ def normal_name(person):
if person:
return person.getPrimaryName().getRegularName()
else:
return ""
return u''
#-------------------------------------------------------------------------
#

View File

@ -4,7 +4,6 @@
<glade-interface>
<widget class="GtkDialog" id="errdialog">
<property name="visible">True</property>
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
@ -134,7 +133,6 @@
</widget>
<widget class="GtkDialog" id="savedialog">
<property name="visible">True</property>
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
@ -289,7 +287,6 @@
</widget>
<widget class="GtkDialog" id="questiondialog">
<property name="visible">True</property>
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
@ -430,7 +427,6 @@
</widget>
<widget class="GtkDialog" id="optiondialog">
<property name="visible">True</property>
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
@ -571,7 +567,6 @@
</widget>
<widget class="GtkDialog" id="warndialog">
<property name="visible">True</property>
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
@ -701,7 +696,6 @@
</widget>
<widget class="GtkDialog" id="okdialog">
<property name="visible">True</property>
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>

View File

@ -51,7 +51,7 @@
<accelerator key="N" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image334">
<widget class="GtkImage" id="image421">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
@ -73,7 +73,7 @@
<accelerator key="O" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image335">
<widget class="GtkImage" id="image422">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
@ -95,7 +95,7 @@
<accelerator key="S" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image336">
<widget class="GtkImage" id="image423">
<property name="visible">True</property>
<property name="stock">gtk-save</property>
<property name="icon_size">1</property>
@ -108,6 +108,61 @@
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="save_as1">
<property name="visible">True</property>
<property name="label" translatable="yes">Save _As...</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_save_as_activate" last_modification_time="Tue, 01 Apr 2003 03:50:28 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image424">
<property name="visible">True</property>
<property name="stock">gtk-save-as</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="separator9">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="import1">
<property name="visible">True</property>
<property name="label" translatable="yes">_Import</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="export1">
<property name="visible">True</property>
<property name="label" translatable="yes">_Export</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image425">
<property name="visible">True</property>
<property name="stock">gtk-convert</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="revert">
<property name="visible">True</property>
@ -116,7 +171,7 @@
<signal name="activate" handler="on_revert_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image337">
<widget class="GtkImage" id="image426">
<property name="visible">True</property>
<property name="stock">gtk-revert-to-saved</property>
<property name="icon_size">1</property>
@ -129,55 +184,6 @@
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="import1">
<property name="visible">True</property>
<property name="label" translatable="yes">_Import</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="save_as1">
<property name="visible">True</property>
<property name="label" translatable="yes">Save _As...</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_save_as_activate" last_modification_time="Tue, 01 Apr 2003 03:50:28 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image338">
<property name="visible">True</property>
<property name="stock">gtk-save-as</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="export1">
<property name="visible">True</property>
<property name="label" translatable="yes">_Export</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image339">
<property name="visible">True</property>
<property name="stock">gtk-convert</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="reload_plugins">
<property name="visible">True</property>
@ -186,7 +192,7 @@
<signal name="activate" handler="on_reload_plugins_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image340">
<widget class="GtkImage" id="image427">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">1</property>
@ -213,7 +219,7 @@
<signal name="activate" handler="on_exit_activate" last_modification_time="Tue, 01 Apr 2003 03:49:05 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image341">
<widget class="GtkImage" id="image428">
<property name="visible">True</property>
<property name="stock">gtk-quit</property>
<property name="icon_size">1</property>
@ -245,9 +251,10 @@
<property name="label" translatable="yes">_Find...</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_find_activate"/>
<accelerator key="F" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image342">
<widget class="GtkImage" id="image429">
<property name="visible">True</property>
<property name="stock">gtk-find</property>
<property name="icon_size">1</property>
@ -268,7 +275,7 @@
<signal name="activate" handler="on_merge_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image343">
<widget class="GtkImage" id="image430">
<property name="visible">True</property>
<property name="stock">gtk-convert</property>
<property name="icon_size">1</property>
@ -336,7 +343,7 @@
<accelerator key="D" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image344">
<widget class="GtkImage" id="image431">
<property name="visible">True</property>
<property name="stock">gtk-index</property>
<property name="icon_size">1</property>
@ -358,7 +365,7 @@
<accelerator key="B" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image345">
<widget class="GtkImage" id="image432">
<property name="visible">True</property>
<property name="stock">gnome-stock-book-open</property>
<property name="icon_size">1</property>
@ -422,7 +429,7 @@
<signal name="activate" handler="on_preferences1_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image346">
<widget class="GtkImage" id="image433">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>
@ -443,7 +450,7 @@
<signal name="activate" handler="on_default_person_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image347">
<widget class="GtkImage" id="image434">
<property name="visible">True</property>
<property name="stock">gtk-home</property>
<property name="icon_size">1</property>
@ -472,14 +479,14 @@
<child>
<widget class="GtkImageMenuItem" id="contents">
<property name="visible">True</property>
<property name="label" translatable="yes">_User's manual</property>
<property name="label" translatable="yes">_User manual</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_contents_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image348">
<widget class="GtkImage" id="image435">
<property name="visible">True</property>
<property name="stock">gnome-stock-book-red</property>
<property name="stock">gtk-go-forward</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
@ -490,6 +497,12 @@
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="separator7">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="gramps_home_page">
<property name="visible">True</property>
@ -498,7 +511,7 @@
<signal name="activate" handler="on_gramps_home_page_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image349">
<widget class="GtkImage" id="image436">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
<property name="icon_size">1</property>
@ -519,7 +532,7 @@
<signal name="activate" handler="on_gramps_mailing_lists_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image350">
<widget class="GtkImage" id="image437">
<property name="visible">True</property>
<property name="stock">gnome-stock-mail</property>
<property name="icon_size">1</property>
@ -541,6 +554,12 @@
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="separator8">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="show_plugin_status">
<property name="visible">True</property>
@ -567,7 +586,7 @@
<signal name="activate" handler="on_about_activate" last_modification_time="Tue, 01 Apr 2003 03:44:24 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image351">
<widget class="GtkImage" id="image438">
<property name="visible">True</property>
<property name="stock">gnome-stock-about</property>
<property name="icon_size">1</property>
@ -757,7 +776,7 @@
</child>
<child>
<widget class="GtkLabel" id="side_ped_label">
<widget class="GtkLabel" id="side_people_label">
<property name="visible">True</property>
<property name="label" translatable="yes">People</property>
<property name="use_underline">False</property>
@ -769,6 +788,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">views</property>
</widget>
<packing>
<property name="padding">0</property>
@ -806,7 +826,7 @@
<widget class="GtkLabel" id="label318">
<property name="visible">True</property>
<property name="label" translatable="yes">Family</property>
<property name="use_underline">False</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
@ -815,6 +835,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">views</property>
</widget>
<packing>
<property name="padding">0</property>
@ -852,7 +873,7 @@
<widget class="GtkLabel" id="label316">
<property name="visible">True</property>
<property name="label" translatable="yes">Pedigree</property>
<property name="use_underline">False</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
@ -861,6 +882,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">views</property>
</widget>
<packing>
<property name="padding">0</property>
@ -898,7 +920,7 @@
<widget class="GtkLabel" id="label319">
<property name="visible">True</property>
<property name="label" translatable="yes">Sources</property>
<property name="use_underline">False</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
@ -907,6 +929,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">views</property>
</widget>
<packing>
<property name="padding">0</property>
@ -944,7 +967,7 @@
<widget class="GtkLabel" id="label320">
<property name="visible">True</property>
<property name="label" translatable="yes">Places</property>
<property name="use_underline">False</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
@ -953,6 +976,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">views</property>
</widget>
<packing>
<property name="padding">0</property>
@ -990,7 +1014,7 @@
<widget class="GtkLabel" id="label321">
<property name="visible">True</property>
<property name="label" translatable="yes">Media</property>
<property name="use_underline">False</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
@ -999,6 +1023,7 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">views</property>
</widget>
<packing>
<property name="padding">0</property>
@ -1026,8 +1051,6 @@
<property name="show_border">False</property>
<property name="tab_pos">GTK_POS_TOP</property>
<property name="scrollable">False</property>
<property name="tab_hborder">6</property>
<property name="tab_vborder">2</property>
<property name="enable_popup">False</property>
<signal name="switch_page" handler="on_notebook1_switch_page" after="yes"/>
@ -1267,8 +1290,6 @@
<property name="show_border">False</property>
<property name="tab_pos">GTK_POS_BOTTOM</property>
<property name="scrollable">False</property>
<property name="tab_hborder">4</property>
<property name="tab_vborder">2</property>
<property name="enable_popup">False</property>
<signal name="switch_page" handler="on_alpha_switch_page" last_modification_time="Sat, 09 Nov 2002 22:11:07 GMT"/>
@ -4634,8 +4655,6 @@
<property name="show_border">True</property>
<property name="tab_pos">GTK_POS_TOP</property>
<property name="scrollable">False</property>
<property name="tab_hborder">2</property>
<property name="tab_vborder">2</property>
<property name="enable_popup">False</property>
<signal name="switch_page" handler="on_switch_page" object="sourceEditor"/>
@ -6319,7 +6338,7 @@
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="button157">
<widget class="GtkButton" id="back">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
@ -6332,7 +6351,7 @@
</child>
<child>
<widget class="GtkButton" id="button158">
<widget class="GtkButton" id="forward">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>

View File

@ -3,20 +3,15 @@
import sys
import os
import locale
import intl
#-------------------------------------------------------------------------
#
# Cope with versioned pygtk installation.
#
#-------------------------------------------------------------------------
try:
import pygtk
pygtk.require('2.0')
except ImportError:
pass
import gtk
import gtk.glade
import intl
#-------------------------------------------------------------------------
#
@ -26,7 +21,21 @@ import gtk
if os.environ.has_key("GRAMPSI18N"):
loc = os.environ["GRAMPSI18N"]
else:
loc = "locale"
loc = "/usr/share/locale"
gtk.glade.bindtextdomain("gramps",loc)
intl.bindtextdomain("gramps",loc)
intl.bind_textdomain_codeset("gramps",'UTF-8')
intl.textdomain("gramps")
locale.setlocale(locale.LC_NUMERIC,"C")
#-------------------------------------------------------------------------
#
# Cope with versioned pygtk installation.
#
#-------------------------------------------------------------------------
import gtk
#-------------------------------------------------------------------------
#
@ -40,11 +49,6 @@ if len(sys.argv) > 1:
else:
arg = None
intl.bindtextdomain("gramps",loc)
intl.bind_textdomain_codeset("gramps",'UTF-8')
intl.textdomain("gramps")
locale.setlocale(locale.LC_NUMERIC,"C")
try:
import StartupDialog

View File

@ -374,7 +374,11 @@ class Gramps:
def row_changed(self,obj):
mlist = self.person_tree.get_selected_objects()
if mlist:
self.change_active_person(self.db.getPerson(mlist[0]))
try:
self.change_active_person(self.db.getPerson(mlist[0]))
except:
self.change_active_person(None)
self.person_tree.unselect()
def on_show_plugin_status(self,obj):
Plugins.PluginStatus()
@ -436,35 +440,35 @@ class Gramps:
def on_find_activate(self,obj):
"""Display the find box"""
if self.views.get_current_page() == 4:
Find.FindPlace(self.active_person.getId(),self.find_goto_place,self.db)
Find.FindPlace(self.find_goto_place,self.db)
elif self.views.get_current_page() == 3:
Find.FindSource(self.source_view.source_list,self.find_goto_source,self.db)
Find.FindSource(self.find_goto_source,self.db)
elif self.views.get_current_page() == 5:
Find.FindMedia(self.media_view.media_list,self.find_goto_media,self.db)
Find.FindMedia(self.find_goto_media,self.db)
else:
Find.FindPerson(self.person_list,self.find_goto_to,self.db)
Find.FindPerson(self.find_goto_person,self.db)
def on_findname_activate(self,obj):
"""Display the find box"""
pass
def find_goto_to(self,id):
def find_goto_person(self,id):
"""Find callback to jump to the selected person"""
self.change_active_person(id)
self.goto_active_person()
self.update_display(0)
def find_goto_place(self,row):
def find_goto_place(self,id):
"""Find callback to jump to the selected place"""
self.place_view.moveto(row)
self.place_view.goto(id)
def find_goto_source(self,row):
def find_goto_source(self,id):
"""Find callback to jump to the selected source"""
self.source_view.moveto(row)
self.source_view.goto(id)
def find_goto_media(self,row):
"""Find callback to jump to the selected media"""
self.media_view.moveto(row)
self.media_view.goto(row)
def home_page_activate(self,obj):
gnome.url_show(_HOMEPAGE)
@ -499,7 +503,6 @@ class Gramps:
def delete_event(self,widget, event):
"""Catch the destruction of the top window, prompt to save if needed"""
widget.hide()
self.on_exit_activate(widget)
return 1
@ -681,8 +684,6 @@ class Gramps:
dbname = obj.get_data("dbname")
getoldrev = obj.get_data("getoldrev")
filename = dbname.get_full_path(0)
print filename
Utils.destroy_passed_object(obj)
if filename == "" or filename == None:
@ -981,8 +982,9 @@ class Gramps:
model.tree.scroll_to_cell(itpath,col,1,0.5,0.0)
def change_active_person(self,person):
self.active_person = person
self.modify_statusbar()
if person != self.active_person:
self.active_person = person
self.modify_statusbar()
if person:
val = 1
else:
@ -1349,7 +1351,7 @@ class Gramps:
else:
self.clear_database(0)
self.status_text(_("Loading %s ...") % name)
self.status_text(_("Loading %s...") % name)
if self.db.load(filename,self.load_progress) == 0:
self.status_text('')
return 0

View File

@ -25,38 +25,46 @@ everything else fails.
import sys
ver = sys.version[0:3]
_trans = None
try:
if ver == "2.2":
from intl22 import *
status = None
else:
import gettext as foo
status = 'Internationalization library could not be loaded'
print status
def gettext(s):
return s
return foo.gettext(s)
def textdomain(s):
return
return foo.textdomain(s)
def bindtextdomain(s,x):
return
return foo.bindtextdomain(s,x)
def bind_textdomain_codeset(s,x):
return
except:
import gettext as foo
status = 'Internationalization library could not be loaded'
print status
def gettext(s):
return s
def textdomain(s):
return
return foo.textdomain(s)
def bindtextdomain(s,x):
return
return foo.bindtextdomain(s,x)
def null(s):
return s
def bind_textdomain_codeset(s,x):
return
global gettext
try:
gettext = foo.translation(s).ugettext
except:
gettext = null

File diff suppressed because it is too large Load Diff