Fixed unicode mapping problem with python 2.0

svn: r170
This commit is contained in:
Don Allingham 2001-06-21 19:31:12 +00:00
parent 27c1d09f66
commit 434c78203b
10 changed files with 118 additions and 104 deletions

5
NEWS
View File

@ -1,6 +1,11 @@
Version 0.3.1 Version 0.3.1
* Improved Web Site generation (changed from Individual Web Pages) * Improved Web Site generation (changed from Individual Web Pages)
* Faster load times for XML database * Faster load times for XML database
* Fixed unicode problems with Python 2.0
* Improved GEDCOM exporter
* Use the GRAMPSDIR environment variable in the shell script to determine
the root path instead of dynamically doing it by attempting to look
at __file__ in const.py
Version 0.3.0 Version 0.3.0
* Support for RTF (export to MSWord) and limited support for KWord * Support for RTF (export to MSWord) and limited support for KWord

View File

@ -2,9 +2,9 @@
# @configure_input@ # @configure_input@
prefix=@prefix@ prefix=@prefix@
PYTHONPATH=@datadir@/@PACKAGE@
export PYTHONPATH
GRAMPSI18N=@prefix@/share/locale
export GRAMPSI18N
@PYTHON@ @datadir@/@PACKAGE@/gramps.py $* export GRAMPSDIR=@datadir@/@PACKAGE@
export PYTHONPATH=$GRAMPSDIR
export GRAMPSI18N=@prefix@/share/locale
@PYTHON@ $GRAMPSDIR/gramps.py $*

View File

@ -39,7 +39,6 @@ import PaperMenu
from gtk import * from gtk import *
from gnome.ui import * from gnome.ui import *
import GTK
import gnome.config import gnome.config
import gnome.help import gnome.help
import libglade import libglade

View File

@ -171,6 +171,7 @@ class EditPerson:
self.get_widget("lastNameList").set_popdown_strings(self.surname_list) self.get_widget("lastNameList").set_popdown_strings(self.surname_list)
event_names = self.get_widget("personalEvents") event_names = self.get_widget("personalEvents")
event_names.set_popdown_strings(const.personalEvents) event_names.set_popdown_strings(const.personalEvents)
event_names.entry.set_text("") event_names.entry.set_text("")

View File

@ -149,7 +149,7 @@ class GrampsParser(handler.ContentHandler):
#--------------------------------------------------------------------- #---------------------------------------------------------------------
def start_event(self,attrs): def start_event(self,attrs):
self.event = Event() self.event = Event()
self.event_type = string.capwords(attrs["type"]) self.event_type = u2l(string.capwords(attrs["type"]))
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# #
@ -160,7 +160,7 @@ class GrampsParser(handler.ContentHandler):
self.attribute = Attribute() self.attribute = Attribute()
if attrs.has_key('type'): if attrs.has_key('type'):
self.in_old_attr = 1 self.in_old_attr = 1
self.attribute.setType(string.capwords(attrs["type"])) self.attribute.setType(u2l(string.capwords(attrs["type"])))
else: else:
self.in_old_attr = 0 self.in_old_attr = 0
if self.person: if self.person:
@ -183,7 +183,7 @@ class GrampsParser(handler.ContentHandler):
# #
#--------------------------------------------------------------------- #---------------------------------------------------------------------
def start_bmark(self,attrs): def start_bmark(self,attrs):
person = self.db.findPersonNoMap(attrs["ref"]) person = self.db.findPersonNoMap(u2l(attrs["ref"]))
self.db.bookmarks.append(person) self.db.bookmarks.append(person)
#--------------------------------------------------------------------- #---------------------------------------------------------------------
@ -195,7 +195,7 @@ class GrampsParser(handler.ContentHandler):
if self.count % self.increment == 0: if self.count % self.increment == 0:
self.callback(float(self.count)/float(self.entries)) self.callback(float(self.count)/float(self.entries))
self.count = self.count + 1 self.count = self.count + 1
self.person = self.db.findPersonNoMap(attrs["id"]) self.person = self.db.findPersonNoMap(u2l(attrs["id"]))
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# #
@ -212,7 +212,7 @@ class GrampsParser(handler.ContentHandler):
# #
#--------------------------------------------------------------------- #---------------------------------------------------------------------
def start_father(self,attrs): def start_father(self,attrs):
self.family.Father = self.db.findPersonNoMap(attrs["ref"]) self.family.Father = self.db.findPersonNoMap(u2l(attrs["ref"]))
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# #
@ -220,7 +220,7 @@ class GrampsParser(handler.ContentHandler):
# #
#--------------------------------------------------------------------- #---------------------------------------------------------------------
def start_mother(self,attrs): def start_mother(self,attrs):
self.family.Mother = self.db.findPersonNoMap(attrs["ref"]) self.family.Mother = self.db.findPersonNoMap(u2l(attrs["ref"]))
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# #
@ -228,7 +228,7 @@ class GrampsParser(handler.ContentHandler):
# #
#--------------------------------------------------------------------- #---------------------------------------------------------------------
def start_child(self,attrs): def start_child(self,attrs):
self.family.Children.append(self.db.findPersonNoMap(attrs["ref"])) self.family.Children.append(self.db.findPersonNoMap(u2l(attrs["ref"])))
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# #
@ -240,12 +240,12 @@ class GrampsParser(handler.ContentHandler):
if not attrs.has_key("href"): if not attrs.has_key("href"):
return return
try: try:
desc = attrs["description"] desc = u2l(attrs["description"])
except KeyError: except KeyError:
desc = "" desc = ""
try: try:
url = Url(attrs["href"],desc) url = Url(u2l(attrs["href"]),desc)
self.person.addUrl(url) self.person.addUrl(url)
except KeyError: except KeyError:
return return
@ -259,9 +259,9 @@ class GrampsParser(handler.ContentHandler):
if self.count % self.increment == 0: if self.count % self.increment == 0:
self.callback(float(self.count)/float(self.entries)) self.callback(float(self.count)/float(self.entries))
self.count = self.count + 1 self.count = self.count + 1
self.family = self.db.findFamilyNoMap(attrs["id"]) self.family = self.db.findFamilyNoMap(u2l(attrs["id"]))
if attrs.has_key("type"): if attrs.has_key("type"):
self.family.setRelationship(attrs["type"]) self.family.setRelationship(u2l(attrs["type"]))
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# #
@ -269,9 +269,9 @@ class GrampsParser(handler.ContentHandler):
# #
#--------------------------------------------------------------------- #---------------------------------------------------------------------
def start_childof(self,attrs): def start_childof(self,attrs):
family = self.db.findFamilyNoMap(attrs["ref"]) family = self.db.findFamilyNoMap(u2l(attrs["ref"]))
if attrs.has_key("type"): if attrs.has_key("type"):
type = attrs["type"] type = u2l(attrs["type"])
self.person.AltFamilyList.append((family,type)) self.person.AltFamilyList.append((family,type))
else: else:
self.person.MainFamily = family self.person.MainFamily = family
@ -282,7 +282,7 @@ class GrampsParser(handler.ContentHandler):
# #
#--------------------------------------------------------------------- #---------------------------------------------------------------------
def start_parentin(self,attrs): def start_parentin(self,attrs):
self.person.FamilyList.append(self.db.findFamilyNoMap(attrs["ref"])) self.person.FamilyList.append(self.db.findFamilyNoMap(u2l(attrs["ref"])))
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# #
@ -307,7 +307,7 @@ class GrampsParser(handler.ContentHandler):
#--------------------------------------------------------------------- #---------------------------------------------------------------------
def start_sourceref(self,attrs): def start_sourceref(self,attrs):
self.source_ref = SourceRef() self.source_ref = SourceRef()
self.source = self.db.findSourceNoMap(attrs["ref"]) self.source = self.db.findSourceNoMap(u2l(attrs["ref"]))
self.source_ref.setBase(self.source) self.source_ref.setBase(self.source)
if self.address: if self.address:
self.address.setSourceRef(self.source_ref) self.address.setSourceRef(self.source_ref)
@ -326,7 +326,7 @@ class GrampsParser(handler.ContentHandler):
# #
#--------------------------------------------------------------------- #---------------------------------------------------------------------
def start_source(self,attrs): def start_source(self,attrs):
self.source = self.db.findSourceNoMap(attrs["id"]) self.source = self.db.findSourceNoMap(ul2(attrs["id"]))
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# #
@ -336,8 +336,8 @@ class GrampsParser(handler.ContentHandler):
def start_photo(self,attrs): def start_photo(self,attrs):
photo = Photo() photo = Photo()
if attrs.has_key("descrip"): if attrs.has_key("descrip"):
photo.setDescription(attrs["descrip"]) photo.setDescription(u2l(attrs["descrip"]))
src = attrs["src"] src = u2l(attrs["src"])
if src[0] != os.sep: if src[0] != os.sep:
photo.setPath("%s%s%s" % (self.base,os.sep,src)) photo.setPath("%s%s%s" % (self.base,os.sep,src))
photo.setPrivate(1) photo.setPrivate(1)
@ -879,7 +879,7 @@ class GrampsImportParser(handler.ContentHandler):
# #
#--------------------------------------------------------------------- #---------------------------------------------------------------------
def start_bmark(self,attrs): def start_bmark(self,attrs):
person = self.db.findPerson("x%s" % attrs["ref"],self.pmap) person = self.db.findPerson("x%s" % u2l(attrs["ref"]),self.pmap)
self.db.bookmarks.append(person) self.db.bookmarks.append(person)
#--------------------------------------------------------------------- #---------------------------------------------------------------------
@ -891,7 +891,7 @@ class GrampsImportParser(handler.ContentHandler):
if self.count % self.increment == 0: if self.count % self.increment == 0:
self.callback(float(self.count)/float(self.entries)) self.callback(float(self.count)/float(self.entries))
self.count = self.count + 1 self.count = self.count + 1
self.person = self.db.findPerson("x%s" % attrs["id"],self.pmap) self.person = self.db.findPerson("x%s" % u2l(attrs["id"]),self.pmap)
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# #
@ -899,7 +899,7 @@ class GrampsImportParser(handler.ContentHandler):
# #
#--------------------------------------------------------------------- #---------------------------------------------------------------------
def start_father(self,attrs): def start_father(self,attrs):
father = self.db.findPerson("x%s" % attrs["ref"],self.pmap) father = self.db.findPerson("x%s" % u2l(attrs["ref"]),self.pmap)
self.family.setFather(father) self.family.setFather(father)
#--------------------------------------------------------------------- #---------------------------------------------------------------------
@ -908,7 +908,7 @@ class GrampsImportParser(handler.ContentHandler):
# #
#--------------------------------------------------------------------- #---------------------------------------------------------------------
def start_mother(self,attrs): def start_mother(self,attrs):
mother = self.db.findPerson("x%s" % attrs["ref"],self.pmap) mother = self.db.findPerson("x%s" % u2l(attrs["ref"]),self.pmap)
self.family.setMother(mother) self.family.setMother(mother)
#--------------------------------------------------------------------- #---------------------------------------------------------------------
@ -917,7 +917,7 @@ class GrampsImportParser(handler.ContentHandler):
# #
#--------------------------------------------------------------------- #---------------------------------------------------------------------
def start_child(self,attrs): def start_child(self,attrs):
child = self.db.findPerson("x%s" % attrs["ref"],self.pmap) child = self.db.findPerson("x%s" % u2l(attrs["ref"]),self.pmap)
self.family.addChild(child) self.family.addChild(child)
#--------------------------------------------------------------------- #---------------------------------------------------------------------
@ -929,9 +929,9 @@ class GrampsImportParser(handler.ContentHandler):
if self.count % self.increment == 0: if self.count % self.increment == 0:
self.callback(float(self.count)/float(self.entries)) self.callback(float(self.count)/float(self.entries))
self.count = self.count + 1 self.count = self.count + 1
self.family = self.db.findFamily(attrs["id"],self.fmap) self.family = self.db.findFamily(u2l(attrs["id"]),self.fmap)
if attrs.has_key("type"): if attrs.has_key("type"):
self.family.setRelationship(attrs["type"]) self.family.setRelationship(u2l(attrs["type"]))
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# #
@ -939,9 +939,9 @@ class GrampsImportParser(handler.ContentHandler):
# #
#--------------------------------------------------------------------- #---------------------------------------------------------------------
def start_childof(self,attrs): def start_childof(self,attrs):
family = self.db.findFamily(attrs["ref"],self.fmap) family = self.db.findFamily(u2l(attrs["ref"]),self.fmap)
if attrs.has_key("type"): if attrs.has_key("type"):
type = attrs["type"] type = u2l(attrs["type"])
self.person.addAltFamily(family,type) self.person.addAltFamily(family,type)
else: else:
self.person.setMainFamily(family) self.person.setMainFamily(family)
@ -953,7 +953,7 @@ class GrampsImportParser(handler.ContentHandler):
#--------------------------------------------------------------------- #---------------------------------------------------------------------
def start_sourceref(self,attrs): def start_sourceref(self,attrs):
self.source_ref = SourceRef() self.source_ref = SourceRef()
self.source = self.db.findSource(attrs["ref"],self.smap) self.source = self.db.findSource(u2l(attrs["ref"]),self.smap)
self.source_ref.setBase(self.source) self.source_ref.setBase(self.source)
if self.address: if self.address:
self.address.setSourceRef(self.source_ref) self.address.setSourceRef(self.source_ref)
@ -972,5 +972,5 @@ class GrampsImportParser(handler.ContentHandler):
# #
#--------------------------------------------------------------------- #---------------------------------------------------------------------
def start_source(self,attrs): def start_source(self,attrs):
self.source = self.db.findSource(attrs["id"],self.smap) self.source = self.db.findSource(u2l(attrs["id"]),self.smap)

View File

@ -438,9 +438,9 @@ class OpenDrawDoc(DrawDoc):
text = latin_to_utf8(string.replace(text,'\n','<text:line-break/>')) text = latin_to_utf8(string.replace(text,'\n','<text:line-break/>'))
self.f.write('>\n') self.f.write('>\n')
self.f.write('<text:p text:style-name="P1">') self.f.write('<text:p text:style-name="P1">')
self.f.write('<text:span text:style-name="T') self.f.write('<text:span text:style-name="T%s">' % para_name)
self.f.write(para_name) self.f.write(text)
self.f.write('">'+text+'</text:span></text:p>\n') self.f.write('</text:span></text:p>\n')
self.f.write('</draw:rect>\n') self.f.write('</draw:rect>\n')
else: else:
self.f.write('/>\n') self.f.write('/>\n')

View File

@ -19,6 +19,7 @@
# #
import os import os
import sys
import intl import intl
_ = intl.gettext _ = intl.gettext
@ -46,7 +47,12 @@ OpenFailed = "Open Failed"
# this one, and that the plugins directory is in a directory below this. # this one, and that the plugins directory is in a directory below this.
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
rootDir = os.path.dirname(__file__)
if os.environ.has_key('GRAMPSDIR'):
rootDir == os.environ['GRAMPSDIR']
else:
rootDir = "."
logo = rootDir + os.sep + "gramps.xpm" logo = rootDir + os.sep + "gramps.xpm"
gladeFile = rootDir + os.sep + "gramps.glade" gladeFile = rootDir + os.sep + "gramps.glade"
imageselFile = rootDir + os.sep + "imagesel.glade" imageselFile = rootDir + os.sep + "imagesel.glade"
@ -68,7 +74,7 @@ gtkrcFile = rootDir + os.sep + "gtkrc"
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
progName = "gramps" progName = "gramps"
version = "0.2.0" version = "0.3.1"
copyright = "(C) 2001 Donald N. Allingham" copyright = "(C) 2001 Donald N. Allingham"
authors = ["Donald N. Allingham"] authors = ["Donald N. Allingham"]
comments = _("Gramps (Genealogical Research and Analysis Management Programming System) is a personal genealogy program that can be extended by using the Python programming language.") comments = _("Gramps (Genealogical Research and Analysis Management Programming System) is a personal genealogy program that can be extended by using the Python programming language.")
@ -101,7 +107,7 @@ helpMenu = "contents.html"
output_formats = ["OpenOffice", "AbiWord", "PDF", "HTML" ] output_formats = ["OpenOffice", "AbiWord", "PDF", "HTML" ]
childRelations = [ childRelations = [
"Biological", "Birth",
"Adopted", "Adopted",
"Other" "Other"
] ]

View File

@ -100,7 +100,7 @@ surnameList = []
topWindow = None topWindow = None
statusbar = None statusbar = None
Main = None gtop = None
person_list = None person_list = None
source_list = None source_list = None
database = None database = None
@ -181,7 +181,7 @@ def on_exit_activate(obj):
def save_query(value): def save_query(value):
if value == 0: if value == 0:
on_save_activate(None) on_save_activate(None)
mainquit(Main) mainquit(gtop)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -233,6 +233,7 @@ def on_edit_marriage_clicked(obj):
return return
queryTop = libglade.GladeXML(const.gladeFile,"marriageQuery") queryTop = libglade.GladeXML(const.gladeFile,"marriageQuery")
queryTop.signal_autoconnect({ queryTop.signal_autoconnect({
"on_marriageQuery_clicked" : on_marriageQuery_clicked, "on_marriageQuery_clicked" : on_marriageQuery_clicked,
"destroy_passed_object" : utils.destroy_passed_object "destroy_passed_object" : utils.destroy_passed_object
@ -266,6 +267,7 @@ def on_add_child_clicked(obj):
select_child = None select_child = None
childWindow = libglade.GladeXML(const.gladeFile,"selectChild") childWindow = libglade.GladeXML(const.gladeFile,"selectChild")
childWindow.signal_autoconnect({ childWindow.signal_autoconnect({
"on_save_child_clicked" : on_save_child_clicked, "on_save_child_clicked" : on_save_child_clicked,
"on_addChild_select_row" : on_addChild_select_row, "on_addChild_select_row" : on_addChild_select_row,
@ -438,7 +440,7 @@ def on_rtype_clicked(obj,a):
select_father = None select_father = None
select_mother = None select_mother = None
if type == "Biological": if type == "Birth":
fam = active_person.getMainFamily() fam = active_person.getMainFamily()
if fam: if fam:
select_father = fam.getFather() select_father = fam.getFather()
@ -592,8 +594,8 @@ def marriage_edit(family):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def full_update(): def full_update():
Main.get_widget(NOTEBOOK).set_show_tabs(Config.usetabs) gtop.get_widget(NOTEBOOK).set_show_tabs(Config.usetabs)
Main.get_widget("child_list").set_column_visibility(4,Config.show_detail) gtop.get_widget("child_list").set_column_visibility(4,Config.show_detail)
apply_filter() apply_filter()
load_family() load_family()
load_sources() load_sources()
@ -605,7 +607,7 @@ def full_update():
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def update_display(changed): def update_display(changed):
page = Main.get_widget(NOTEBOOK).get_current_page() page = gtop.get_widget(NOTEBOOK).get_current_page()
if page == 0: if page == 0:
if changed: if changed:
apply_filter() apply_filter()
@ -877,7 +879,7 @@ def find_family(father,mother):
def change_family_type(family,type): def change_family_type(family,type):
if not family: if not family:
if type == "Biological": if type == "Birth":
main = active_person.getMainFamily() main = active_person.getMainFamily()
if main: if main:
main.removeChild(active_person) main.removeChild(active_person)
@ -889,7 +891,7 @@ def change_family_type(family,type):
fam.removeChild(active_person) fam.removeChild(active_person)
return return
elif family == active_person.getMainFamily(): elif family == active_person.getMainFamily():
if type != "Biological": if type != "Birth":
utils.modified() utils.modified()
active_person.setMainFamily(None) active_person.setMainFamily(None)
found = 0 found = 0
@ -905,7 +907,7 @@ def change_family_type(family,type):
else: else:
for fam in active_person.getAltFamilyList(): for fam in active_person.getAltFamilyList():
if family == fam[0]: if family == fam[0]:
if type == "Biological": if type == "Birth":
active_person.setMainFamily(family) active_person.setMainFamily(family)
active_person.removeAltFamily(family) active_person.removeAltFamily(family)
utils.modified() utils.modified()
@ -1187,9 +1189,9 @@ def on_person_list_select_row(obj,a,b,c):
def on_person_list_click_column(obj,column): def on_person_list_click_column(obj,column):
global sortFunc global sortFunc
nameArrow = Main.get_widget("nameSort") nameArrow = gtop.get_widget("nameSort")
dateArrow = Main.get_widget("dateSort") dateArrow = gtop.get_widget("dateSort")
deathArrow= Main.get_widget("deathSort") deathArrow= gtop.get_widget("deathSort")
if column == 0: if column == 0:
dateArrow.hide() dateArrow.hide()
@ -1420,19 +1422,19 @@ def on_save_activate(obj):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_person_list1_activate(obj): def on_person_list1_activate(obj):
notebk = Main.get_widget(NOTEBOOK) notebk = gtop.get_widget(NOTEBOOK)
notebk.set_page(0) notebk.set_page(0)
def on_family1_activate(obj): def on_family1_activate(obj):
notebk = Main.get_widget(NOTEBOOK) notebk = gtop.get_widget(NOTEBOOK)
notebk.set_page(1) notebk.set_page(1)
def on_pedegree1_activate(obj): def on_pedegree1_activate(obj):
notebk = Main.get_widget(NOTEBOOK) notebk = gtop.get_widget(NOTEBOOK)
notebk.set_page(2) notebk.set_page(2)
def on_sources_activate(obj): def on_sources_activate(obj):
notebk = Main.get_widget(NOTEBOOK) notebk = gtop.get_widget(NOTEBOOK)
notebk.set_page(3) notebk.set_page(3)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -1563,9 +1565,9 @@ def on_swap_clicked(obj):
if not active_person: if not active_person:
return return
if len(active_person.getFamilyList()) > 1: if len(active_person.getFamilyList()) > 1:
spouse = Main.get_widget("fv_spouse").get_menu().get_active().get_data("person") spouse = gtop.get_widget("fv_spouse").get_menu().get_active().get_data("person")
else: else:
spouse = Main.get_widget("fv_spouse1").get_data("person") spouse = gtop.get_widget("fv_spouse1").get_data("person")
if not spouse: if not spouse:
return return
@ -1580,9 +1582,9 @@ def on_swap_clicked(obj):
def on_apply_filter_clicked(obj): def on_apply_filter_clicked(obj):
global DataFilter global DataFilter
invert_filter = Main.get_widget("invert").get_active() invert_filter = gtop.get_widget("invert").get_active()
qualifer = Main.get_widget("filter").get_text() qualifer = gtop.get_widget("filter").get_text()
menu = Main.get_widget(FILTERNAME).get_menu() menu = gtop.get_widget(FILTERNAME).get_menu()
function = menu.get_active().get_data("filter") function = menu.get_active().get_data("filter")
DataFilter = function(qualifer) DataFilter = function(qualifer)
DataFilter.set_invert(invert_filter) DataFilter.set_invert(invert_filter)
@ -1595,7 +1597,7 @@ def on_apply_filter_clicked(obj):
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_filter_name_changed(obj): def on_filter_name_changed(obj):
function = obj.get_data("function") function = obj.get_data("function")
Main.get_widget("filter").set_sensitive(function()) gtop.get_widget("filter").set_sensitive(function())
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -1650,7 +1652,7 @@ def load_family():
family_types = [] family_types = []
main_family = None main_family = None
Main.get_widget("fv_person").set_text(Config.nameof(active_person)) gtop.get_widget("fv_person").set_text(Config.nameof(active_person))
if active_person: if active_person:
main_family = active_person.getMainFamily() main_family = active_person.getMainFamily()
@ -1666,7 +1668,7 @@ def load_family():
if len(family_types) > 0: if len(family_types) > 0:
typeMenu = GtkMenu() typeMenu = GtkMenu()
if main_family: if main_family:
menuitem = GtkMenuItem("Biological") menuitem = GtkMenuItem("Birth")
menuitem.set_data("parents",main_family) menuitem.set_data("parents",main_family)
menuitem.connect("activate",on_current_type_changed) menuitem.connect("activate",on_current_type_changed)
menuitem.show() menuitem.show()
@ -1677,10 +1679,10 @@ def load_family():
menuitem.connect("activate",on_current_type_changed) menuitem.connect("activate",on_current_type_changed)
menuitem.show() menuitem.show()
typeMenu.append(menuitem) typeMenu.append(menuitem)
Main.get_widget("childtype").set_menu(typeMenu) gtop.get_widget("childtype").set_menu(typeMenu)
Main.get_widget("childtype").show() gtop.get_widget("childtype").show()
else: else:
Main.get_widget("childtype").hide() gtop.get_widget("childtype").hide()
change_parents(active_parents) change_parents(active_parents)
@ -1705,24 +1707,24 @@ def load_family():
menuitem.connect("activate",on_spouselist_changed) menuitem.connect("activate",on_spouselist_changed)
menuitem.show() menuitem.show()
Main.get_widget("fv_spouse").set_menu(myMenu) gtop.get_widget("fv_spouse").set_menu(myMenu)
Main.get_widget("lab_or_list").set_page(1) gtop.get_widget("lab_or_list").set_page(1)
elif number_of_families == 1: elif number_of_families == 1:
Main.get_widget("lab_or_list").set_page(0) gtop.get_widget("lab_or_list").set_page(0)
family = active_person.getFamilyList()[0] family = active_person.getFamilyList()[0]
if active_person != family.getFather(): if active_person != family.getFather():
spouse = family.getFather() spouse = family.getFather()
else: else:
spouse = family.getMother() spouse = family.getMother()
active_spouse = spouse active_spouse = spouse
fv_spouse1 = Main.get_widget("fv_spouse1") fv_spouse1 = gtop.get_widget("fv_spouse1")
fv_spouse1.set_text(Config.nameof(spouse)) fv_spouse1.set_text(Config.nameof(spouse))
fv_spouse1.set_data("person",spouse) fv_spouse1.set_data("person",spouse)
fv_spouse1.set_data("family",active_person.getFamilyList()[0]) fv_spouse1.set_data("family",active_person.getFamilyList()[0])
else: else:
Main.get_widget("lab_or_list").set_page(0) gtop.get_widget("lab_or_list").set_page(0)
Main.get_widget("fv_spouse1").set_text("") gtop.get_widget("fv_spouse1").set_text("")
fv_spouse1 = Main.get_widget("fv_spouse1") fv_spouse1 = gtop.get_widget("fv_spouse1")
fv_spouse1.set_text("") fv_spouse1.set_text("")
fv_spouse1.set_data("person",None) fv_spouse1.set_data("person",None)
fv_spouse1.set_data("family",None) fv_spouse1.set_data("family",None)
@ -1732,7 +1734,7 @@ def load_family():
else: else:
display_marriage(None) display_marriage(None)
else: else:
fv_spouse1 = Main.get_widget("fv_spouse1").set_text("") fv_spouse1 = gtop.get_widget("fv_spouse1").set_text("")
display_marriage(None) display_marriage(None)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -1744,10 +1746,10 @@ def change_parents(family):
global active_father global active_father
global active_mother global active_mother
fv_father = Main.get_widget("fv_father") fv_father = gtop.get_widget("fv_father")
fv_mother = Main.get_widget("fv_mother") fv_mother = gtop.get_widget("fv_mother")
father_next = Main.get_widget("father_next") father_next = gtop.get_widget("father_next")
mother_next = Main.get_widget("mother_next") mother_next = gtop.get_widget("mother_next")
if family != None : if family != None :
@ -1804,14 +1806,14 @@ def load_tree():
tips.set_tip(pv[i],None) tips.set_tip(pv[i],None)
if text[2] == "": if text[2] == "":
Main.get_widget("ped_father_next").set_sensitive(0) gtop.get_widget("ped_father_next").set_sensitive(0)
else: else:
Main.get_widget("ped_father_next").set_sensitive(1) gtop.get_widget("ped_father_next").set_sensitive(1)
if text[3] == "": if text[3] == "":
Main.get_widget("ped_mother_next").set_sensitive(0) gtop.get_widget("ped_mother_next").set_sensitive(0)
else: else:
Main.get_widget("ped_mother_next").set_sensitive(1) gtop.get_widget("ped_mother_next").set_sensitive(1)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -1850,8 +1852,8 @@ def display_marriage(family):
global active_spouse global active_spouse
active_family = family active_family = family
clist = Main.get_widget("child_list") clist = gtop.get_widget("child_list")
fv_prev = Main.get_widget("fv_prev") fv_prev = gtop.get_widget("fv_prev")
clist.clear() clist.clear()
active_child = None active_child = None
@ -1963,7 +1965,7 @@ def load_database(name):
const.familyRelations.append(type) const.familyRelations.append(type)
Config.save_last_file(name) Config.save_last_file(name)
Main.get_widget("filter").set_text("") gtop.get_widget("filter").set_text("")
active_person = database.getDefaultPerson() active_person = database.getDefaultPerson()
return 1 return 1
@ -1975,7 +1977,7 @@ def load_database(name):
def setup_bookmarks(): def setup_bookmarks():
global bookmarks global bookmarks
menu = Main.get_widget("jump_to") menu = gtop.get_widget("jump_to")
person_map = database.getPersonMap() person_map = database.getPersonMap()
bookmarks = Bookmarks.Bookmarks(database.getBookmarks(),person_map,\ bookmarks = Bookmarks.Bookmarks(database.getBookmarks(),person_map,\
menu,bookmark_callback) menu,bookmark_callback)
@ -2170,7 +2172,7 @@ def on_preferences_activate(obj):
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def main(arg): def main(arg):
global database, Main global database, gtop
global statusbar global statusbar
global person_list, source_list, pv global person_list, source_list, pv
global topWindow global topWindow
@ -2187,12 +2189,13 @@ def main(arg):
if os.path.isdir(path): if os.path.isdir(path):
Filter.load_filters(path) Filter.load_filters(path)
Main = libglade.GladeXML(const.gladeFile, "gramps") gtop = libglade.GladeXML(const.gladeFile, "gramps")
topWindow = Main.get_widget("gramps")
statusbar = Main.get_widget("statusbar") statusbar = gtop.get_widget("statusbar")
person_list = Main.get_widget("person_list") topWindow = gtop.get_widget("gramps")
source_list = Main.get_widget("source_list") person_list = gtop.get_widget("person_list")
filter_list = Main.get_widget("filter_list") source_list = gtop.get_widget("source_list")
filter_list = gtop.get_widget("filter_list")
myMenu = GtkMenu() myMenu = GtkMenu()
for filter in Filter.filterList: for filter in Filter.filterList:
@ -2204,7 +2207,7 @@ def main(arg):
menuitem.show() menuitem.show()
filter_list.set_menu(myMenu) filter_list.set_menu(myMenu)
Main.get_widget("filter").set_sensitive(0) gtop.get_widget("filter").set_sensitive(0)
# set the window icon # set the window icon
topWindow.set_icon(GtkPixmap(topWindow,const.logo)) topWindow.set_icon(GtkPixmap(topWindow,const.logo))
@ -2212,9 +2215,9 @@ def main(arg):
person_list.column_titles_active() person_list.column_titles_active()
for box in range(1,16): for box in range(1,16):
pv[box] = Main.get_widget("pv%d" % box) pv[box] = gtop.get_widget("pv%d" % box)
Main.signal_autoconnect({ gtop.signal_autoconnect({
"on_about_activate": on_about_activate, "on_about_activate": on_about_activate,
"on_reports_clicked" : on_reports_clicked, "on_reports_clicked" : on_reports_clicked,
"on_person_list1_activate": on_person_list1_activate, "on_person_list1_activate": on_person_list1_activate,
@ -2273,16 +2276,16 @@ def main(arg):
database = RelDataBase() database = RelDataBase()
Config.loadConfig(full_update) Config.loadConfig(full_update)
Main.get_widget(NOTEBOOK).set_show_tabs(Config.usetabs) gtop.get_widget(NOTEBOOK).set_show_tabs(Config.usetabs)
Main.get_widget("child_list").set_column_visibility(4,Config.show_detail) gtop.get_widget("child_list").set_column_visibility(4,Config.show_detail)
if arg != None: if arg != None:
read_file(arg) read_file(arg)
elif Config.lastfile != None and Config.lastfile != "" and Config.autoload: elif Config.lastfile != None and Config.lastfile != "" and Config.autoload:
read_file(Config.lastfile) read_file(Config.lastfile)
Main.get_widget("export1").set_submenu(Plugins.export_menu(export_callback)) gtop.get_widget("export1").set_submenu(Plugins.export_menu(export_callback))
Main.get_widget("import1").set_submenu(Plugins.import_menu(import_callback)) gtop.get_widget("import1").set_submenu(Plugins.import_menu(import_callback))
database.setResearcher(Config.owner) database.setResearcher(Config.owner)
mainloop() mainloop()

View File

@ -25,7 +25,7 @@ if sys.version[0] != '1':
return s.encode('latin-1') return s.encode('latin-1')
def latin_to_utf8(s): def latin_to_utf8(s):
return s.encode('utf-8') return s
else: else:
try: try:

View File

@ -1283,7 +1283,7 @@ class GedcomParser:
self.backup() self.backup()
return return
elif matches[1] == "ADDR": elif matches[1] == "ADDR":
addr.label = matches[2] addr.label = matches[2] + self.parse_continue_data(level+1)
self.parse_sub_addr(level+1, addr) self.parse_sub_addr(level+1, addr)
elif matches[1] == "PHON": elif matches[1] == "PHON":
addr.phone = matches[2] addr.phone = matches[2]