From 2e63b50dd7b8324ba7769e16e5fe8a42b281dc9b Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 21 Jun 2001 19:31:12 +0000 Subject: [PATCH] Fixed unicode mapping problem with python 2.0 svn: r170 --- gramps/NEWS | 5 ++ gramps/gramps.sh.in | 10 +-- gramps/src/Config.py | 1 - gramps/src/EditPerson.py | 1 + gramps/src/GrampsParser.py | 58 +++++++------- gramps/src/OpenDrawDoc.py | 6 +- gramps/src/const.py | 12 ++- gramps/src/gramps_main.py | 125 ++++++++++++++++--------------- gramps/src/latin_utf8.py | 2 +- gramps/src/plugins/ReadGedcom.py | 2 +- 10 files changed, 118 insertions(+), 104 deletions(-) diff --git a/gramps/NEWS b/gramps/NEWS index 93dee144e..65309be28 100644 --- a/gramps/NEWS +++ b/gramps/NEWS @@ -1,6 +1,11 @@ Version 0.3.1 * Improved Web Site generation (changed from Individual Web Pages) * 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 * Support for RTF (export to MSWord) and limited support for KWord diff --git a/gramps/gramps.sh.in b/gramps/gramps.sh.in index 422625c5d..02393b445 100644 --- a/gramps/gramps.sh.in +++ b/gramps/gramps.sh.in @@ -2,9 +2,9 @@ # @configure_input@ 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 $* diff --git a/gramps/src/Config.py b/gramps/src/Config.py index 8c51fe946..f26723749 100644 --- a/gramps/src/Config.py +++ b/gramps/src/Config.py @@ -39,7 +39,6 @@ import PaperMenu from gtk import * from gnome.ui import * -import GTK import gnome.config import gnome.help import libglade diff --git a/gramps/src/EditPerson.py b/gramps/src/EditPerson.py index 0318c2a5e..3838fe0aa 100644 --- a/gramps/src/EditPerson.py +++ b/gramps/src/EditPerson.py @@ -171,6 +171,7 @@ class EditPerson: self.get_widget("lastNameList").set_popdown_strings(self.surname_list) event_names = self.get_widget("personalEvents") + event_names.set_popdown_strings(const.personalEvents) event_names.entry.set_text("") diff --git a/gramps/src/GrampsParser.py b/gramps/src/GrampsParser.py index dfe4e0f9c..cc2595b57 100644 --- a/gramps/src/GrampsParser.py +++ b/gramps/src/GrampsParser.py @@ -149,7 +149,7 @@ class GrampsParser(handler.ContentHandler): #--------------------------------------------------------------------- def start_event(self,attrs): 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() if attrs.has_key('type'): self.in_old_attr = 1 - self.attribute.setType(string.capwords(attrs["type"])) + self.attribute.setType(u2l(string.capwords(attrs["type"]))) else: self.in_old_attr = 0 if self.person: @@ -183,7 +183,7 @@ class GrampsParser(handler.ContentHandler): # #--------------------------------------------------------------------- def start_bmark(self,attrs): - person = self.db.findPersonNoMap(attrs["ref"]) + person = self.db.findPersonNoMap(u2l(attrs["ref"])) self.db.bookmarks.append(person) #--------------------------------------------------------------------- @@ -195,7 +195,7 @@ class GrampsParser(handler.ContentHandler): if self.count % self.increment == 0: self.callback(float(self.count)/float(self.entries)) 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): - 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): - 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): - 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"): return try: - desc = attrs["description"] + desc = u2l(attrs["description"]) except KeyError: desc = "" try: - url = Url(attrs["href"],desc) + url = Url(u2l(attrs["href"]),desc) self.person.addUrl(url) except KeyError: return @@ -259,9 +259,9 @@ class GrampsParser(handler.ContentHandler): if self.count % self.increment == 0: self.callback(float(self.count)/float(self.entries)) 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"): - self.family.setRelationship(attrs["type"]) + self.family.setRelationship(u2l(attrs["type"])) #--------------------------------------------------------------------- # @@ -269,9 +269,9 @@ class GrampsParser(handler.ContentHandler): # #--------------------------------------------------------------------- def start_childof(self,attrs): - family = self.db.findFamilyNoMap(attrs["ref"]) + family = self.db.findFamilyNoMap(u2l(attrs["ref"])) if attrs.has_key("type"): - type = attrs["type"] + type = u2l(attrs["type"]) self.person.AltFamilyList.append((family,type)) else: self.person.MainFamily = family @@ -282,7 +282,7 @@ class GrampsParser(handler.ContentHandler): # #--------------------------------------------------------------------- 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): 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) if self.address: self.address.setSourceRef(self.source_ref) @@ -326,7 +326,7 @@ class GrampsParser(handler.ContentHandler): # #--------------------------------------------------------------------- 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): photo = Photo() if attrs.has_key("descrip"): - photo.setDescription(attrs["descrip"]) - src = attrs["src"] + photo.setDescription(u2l(attrs["descrip"])) + src = u2l(attrs["src"]) if src[0] != os.sep: photo.setPath("%s%s%s" % (self.base,os.sep,src)) photo.setPrivate(1) @@ -879,7 +879,7 @@ class GrampsImportParser(handler.ContentHandler): # #--------------------------------------------------------------------- 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) #--------------------------------------------------------------------- @@ -891,7 +891,7 @@ class GrampsImportParser(handler.ContentHandler): if self.count % self.increment == 0: self.callback(float(self.count)/float(self.entries)) 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): - 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) #--------------------------------------------------------------------- @@ -908,7 +908,7 @@ class GrampsImportParser(handler.ContentHandler): # #--------------------------------------------------------------------- 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) #--------------------------------------------------------------------- @@ -917,7 +917,7 @@ class GrampsImportParser(handler.ContentHandler): # #--------------------------------------------------------------------- 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) #--------------------------------------------------------------------- @@ -929,9 +929,9 @@ class GrampsImportParser(handler.ContentHandler): if self.count % self.increment == 0: self.callback(float(self.count)/float(self.entries)) 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"): - self.family.setRelationship(attrs["type"]) + self.family.setRelationship(u2l(attrs["type"])) #--------------------------------------------------------------------- # @@ -939,9 +939,9 @@ class GrampsImportParser(handler.ContentHandler): # #--------------------------------------------------------------------- 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"): - type = attrs["type"] + type = u2l(attrs["type"]) self.person.addAltFamily(family,type) else: self.person.setMainFamily(family) @@ -953,7 +953,7 @@ class GrampsImportParser(handler.ContentHandler): #--------------------------------------------------------------------- def start_sourceref(self,attrs): 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) if self.address: self.address.setSourceRef(self.source_ref) @@ -972,5 +972,5 @@ class GrampsImportParser(handler.ContentHandler): # #--------------------------------------------------------------------- def start_source(self,attrs): - self.source = self.db.findSource(attrs["id"],self.smap) + self.source = self.db.findSource(u2l(attrs["id"]),self.smap) diff --git a/gramps/src/OpenDrawDoc.py b/gramps/src/OpenDrawDoc.py index 61db7c5bd..7e7f5d1e5 100644 --- a/gramps/src/OpenDrawDoc.py +++ b/gramps/src/OpenDrawDoc.py @@ -438,9 +438,9 @@ class OpenDrawDoc(DrawDoc): text = latin_to_utf8(string.replace(text,'\n','')) self.f.write('>\n') self.f.write('') - self.f.write(''+text+'\n') + self.f.write('' % para_name) + self.f.write(text) + self.f.write('\n') self.f.write('\n') else: self.f.write('/>\n') diff --git a/gramps/src/const.py b/gramps/src/const.py index ef0593042..29ebf3199 100644 --- a/gramps/src/const.py +++ b/gramps/src/const.py @@ -19,6 +19,7 @@ # import os +import sys import intl _ = intl.gettext @@ -46,7 +47,12 @@ OpenFailed = "Open Failed" # 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" gladeFile = rootDir + os.sep + "gramps.glade" imageselFile = rootDir + os.sep + "imagesel.glade" @@ -68,7 +74,7 @@ gtkrcFile = rootDir + os.sep + "gtkrc" # #------------------------------------------------------------------------- progName = "gramps" -version = "0.2.0" +version = "0.3.1" copyright = "(C) 2001 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.") @@ -101,7 +107,7 @@ helpMenu = "contents.html" output_formats = ["OpenOffice", "AbiWord", "PDF", "HTML" ] childRelations = [ - "Biological", + "Birth", "Adopted", "Other" ] diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py index 4b60ab783..fbe5b4203 100755 --- a/gramps/src/gramps_main.py +++ b/gramps/src/gramps_main.py @@ -100,7 +100,7 @@ surnameList = [] topWindow = None statusbar = None -Main = None +gtop = None person_list = None source_list = None database = None @@ -181,7 +181,7 @@ def on_exit_activate(obj): def save_query(value): if value == 0: on_save_activate(None) - mainquit(Main) + mainquit(gtop) #------------------------------------------------------------------------- # @@ -233,6 +233,7 @@ def on_edit_marriage_clicked(obj): return queryTop = libglade.GladeXML(const.gladeFile,"marriageQuery") + queryTop.signal_autoconnect({ "on_marriageQuery_clicked" : on_marriageQuery_clicked, "destroy_passed_object" : utils.destroy_passed_object @@ -266,6 +267,7 @@ def on_add_child_clicked(obj): select_child = None childWindow = libglade.GladeXML(const.gladeFile,"selectChild") + childWindow.signal_autoconnect({ "on_save_child_clicked" : on_save_child_clicked, "on_addChild_select_row" : on_addChild_select_row, @@ -438,7 +440,7 @@ def on_rtype_clicked(obj,a): select_father = None select_mother = None - if type == "Biological": + if type == "Birth": fam = active_person.getMainFamily() if fam: select_father = fam.getFather() @@ -592,8 +594,8 @@ def marriage_edit(family): # #------------------------------------------------------------------------- def full_update(): - Main.get_widget(NOTEBOOK).set_show_tabs(Config.usetabs) - Main.get_widget("child_list").set_column_visibility(4,Config.show_detail) + gtop.get_widget(NOTEBOOK).set_show_tabs(Config.usetabs) + gtop.get_widget("child_list").set_column_visibility(4,Config.show_detail) apply_filter() load_family() load_sources() @@ -605,7 +607,7 @@ def full_update(): # #------------------------------------------------------------------------- def update_display(changed): - page = Main.get_widget(NOTEBOOK).get_current_page() + page = gtop.get_widget(NOTEBOOK).get_current_page() if page == 0: if changed: apply_filter() @@ -877,7 +879,7 @@ def find_family(father,mother): def change_family_type(family,type): if not family: - if type == "Biological": + if type == "Birth": main = active_person.getMainFamily() if main: main.removeChild(active_person) @@ -889,7 +891,7 @@ def change_family_type(family,type): fam.removeChild(active_person) return elif family == active_person.getMainFamily(): - if type != "Biological": + if type != "Birth": utils.modified() active_person.setMainFamily(None) found = 0 @@ -905,7 +907,7 @@ def change_family_type(family,type): else: for fam in active_person.getAltFamilyList(): if family == fam[0]: - if type == "Biological": + if type == "Birth": active_person.setMainFamily(family) active_person.removeAltFamily(family) utils.modified() @@ -1187,9 +1189,9 @@ def on_person_list_select_row(obj,a,b,c): def on_person_list_click_column(obj,column): global sortFunc - nameArrow = Main.get_widget("nameSort") - dateArrow = Main.get_widget("dateSort") - deathArrow= Main.get_widget("deathSort") + nameArrow = gtop.get_widget("nameSort") + dateArrow = gtop.get_widget("dateSort") + deathArrow= gtop.get_widget("deathSort") if column == 0: dateArrow.hide() @@ -1420,19 +1422,19 @@ def on_save_activate(obj): # #------------------------------------------------------------------------- def on_person_list1_activate(obj): - notebk = Main.get_widget(NOTEBOOK) + notebk = gtop.get_widget(NOTEBOOK) notebk.set_page(0) def on_family1_activate(obj): - notebk = Main.get_widget(NOTEBOOK) + notebk = gtop.get_widget(NOTEBOOK) notebk.set_page(1) def on_pedegree1_activate(obj): - notebk = Main.get_widget(NOTEBOOK) + notebk = gtop.get_widget(NOTEBOOK) notebk.set_page(2) def on_sources_activate(obj): - notebk = Main.get_widget(NOTEBOOK) + notebk = gtop.get_widget(NOTEBOOK) notebk.set_page(3) #------------------------------------------------------------------------- @@ -1563,9 +1565,9 @@ def on_swap_clicked(obj): if not active_person: return 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: - spouse = Main.get_widget("fv_spouse1").get_data("person") + spouse = gtop.get_widget("fv_spouse1").get_data("person") if not spouse: return @@ -1580,9 +1582,9 @@ def on_swap_clicked(obj): def on_apply_filter_clicked(obj): global DataFilter - invert_filter = Main.get_widget("invert").get_active() - qualifer = Main.get_widget("filter").get_text() - menu = Main.get_widget(FILTERNAME).get_menu() + invert_filter = gtop.get_widget("invert").get_active() + qualifer = gtop.get_widget("filter").get_text() + menu = gtop.get_widget(FILTERNAME).get_menu() function = menu.get_active().get_data("filter") DataFilter = function(qualifer) DataFilter.set_invert(invert_filter) @@ -1595,7 +1597,7 @@ def on_apply_filter_clicked(obj): #------------------------------------------------------------------------- def on_filter_name_changed(obj): 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 = [] 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: main_family = active_person.getMainFamily() @@ -1666,7 +1668,7 @@ def load_family(): if len(family_types) > 0: typeMenu = GtkMenu() if main_family: - menuitem = GtkMenuItem("Biological") + menuitem = GtkMenuItem("Birth") menuitem.set_data("parents",main_family) menuitem.connect("activate",on_current_type_changed) menuitem.show() @@ -1677,10 +1679,10 @@ def load_family(): menuitem.connect("activate",on_current_type_changed) menuitem.show() typeMenu.append(menuitem) - Main.get_widget("childtype").set_menu(typeMenu) - Main.get_widget("childtype").show() + gtop.get_widget("childtype").set_menu(typeMenu) + gtop.get_widget("childtype").show() else: - Main.get_widget("childtype").hide() + gtop.get_widget("childtype").hide() change_parents(active_parents) @@ -1705,24 +1707,24 @@ def load_family(): menuitem.connect("activate",on_spouselist_changed) menuitem.show() - Main.get_widget("fv_spouse").set_menu(myMenu) - Main.get_widget("lab_or_list").set_page(1) + gtop.get_widget("fv_spouse").set_menu(myMenu) + gtop.get_widget("lab_or_list").set_page(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] if active_person != family.getFather(): spouse = family.getFather() else: spouse = family.getMother() 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_data("person",spouse) fv_spouse1.set_data("family",active_person.getFamilyList()[0]) else: - Main.get_widget("lab_or_list").set_page(0) - Main.get_widget("fv_spouse1").set_text("") - fv_spouse1 = Main.get_widget("fv_spouse1") + gtop.get_widget("lab_or_list").set_page(0) + gtop.get_widget("fv_spouse1").set_text("") + fv_spouse1 = gtop.get_widget("fv_spouse1") fv_spouse1.set_text("") fv_spouse1.set_data("person",None) fv_spouse1.set_data("family",None) @@ -1732,7 +1734,7 @@ def load_family(): else: display_marriage(None) else: - fv_spouse1 = Main.get_widget("fv_spouse1").set_text("") + fv_spouse1 = gtop.get_widget("fv_spouse1").set_text("") display_marriage(None) #------------------------------------------------------------------------- @@ -1744,10 +1746,10 @@ def change_parents(family): global active_father global active_mother - fv_father = Main.get_widget("fv_father") - fv_mother = Main.get_widget("fv_mother") - father_next = Main.get_widget("father_next") - mother_next = Main.get_widget("mother_next") + fv_father = gtop.get_widget("fv_father") + fv_mother = gtop.get_widget("fv_mother") + father_next = gtop.get_widget("father_next") + mother_next = gtop.get_widget("mother_next") if family != None : @@ -1804,14 +1806,14 @@ def load_tree(): tips.set_tip(pv[i],None) if text[2] == "": - Main.get_widget("ped_father_next").set_sensitive(0) + gtop.get_widget("ped_father_next").set_sensitive(0) else: - Main.get_widget("ped_father_next").set_sensitive(1) + gtop.get_widget("ped_father_next").set_sensitive(1) if text[3] == "": - Main.get_widget("ped_mother_next").set_sensitive(0) + gtop.get_widget("ped_mother_next").set_sensitive(0) 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 active_family = family - clist = Main.get_widget("child_list") - fv_prev = Main.get_widget("fv_prev") + clist = gtop.get_widget("child_list") + fv_prev = gtop.get_widget("fv_prev") clist.clear() active_child = None @@ -1963,7 +1965,7 @@ def load_database(name): const.familyRelations.append(type) Config.save_last_file(name) - Main.get_widget("filter").set_text("") + gtop.get_widget("filter").set_text("") active_person = database.getDefaultPerson() return 1 @@ -1975,7 +1977,7 @@ def load_database(name): def setup_bookmarks(): global bookmarks - menu = Main.get_widget("jump_to") + menu = gtop.get_widget("jump_to") person_map = database.getPersonMap() bookmarks = Bookmarks.Bookmarks(database.getBookmarks(),person_map,\ menu,bookmark_callback) @@ -2170,7 +2172,7 @@ def on_preferences_activate(obj): #------------------------------------------------------------------------- def main(arg): - global database, Main + global database, gtop global statusbar global person_list, source_list, pv global topWindow @@ -2187,12 +2189,13 @@ def main(arg): if os.path.isdir(path): Filter.load_filters(path) - Main = libglade.GladeXML(const.gladeFile, "gramps") - topWindow = Main.get_widget("gramps") - statusbar = Main.get_widget("statusbar") - person_list = Main.get_widget("person_list") - source_list = Main.get_widget("source_list") - filter_list = Main.get_widget("filter_list") + gtop = libglade.GladeXML(const.gladeFile, "gramps") + + statusbar = gtop.get_widget("statusbar") + topWindow = gtop.get_widget("gramps") + person_list = gtop.get_widget("person_list") + source_list = gtop.get_widget("source_list") + filter_list = gtop.get_widget("filter_list") myMenu = GtkMenu() for filter in Filter.filterList: @@ -2204,7 +2207,7 @@ def main(arg): menuitem.show() filter_list.set_menu(myMenu) - Main.get_widget("filter").set_sensitive(0) + gtop.get_widget("filter").set_sensitive(0) # set the window icon topWindow.set_icon(GtkPixmap(topWindow,const.logo)) @@ -2212,9 +2215,9 @@ def main(arg): person_list.column_titles_active() 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_reports_clicked" : on_reports_clicked, "on_person_list1_activate": on_person_list1_activate, @@ -2273,16 +2276,16 @@ def main(arg): database = RelDataBase() Config.loadConfig(full_update) - Main.get_widget(NOTEBOOK).set_show_tabs(Config.usetabs) - Main.get_widget("child_list").set_column_visibility(4,Config.show_detail) + gtop.get_widget(NOTEBOOK).set_show_tabs(Config.usetabs) + gtop.get_widget("child_list").set_column_visibility(4,Config.show_detail) if arg != None: read_file(arg) elif Config.lastfile != None and Config.lastfile != "" and Config.autoload: read_file(Config.lastfile) - Main.get_widget("export1").set_submenu(Plugins.export_menu(export_callback)) - Main.get_widget("import1").set_submenu(Plugins.import_menu(import_callback)) + gtop.get_widget("export1").set_submenu(Plugins.export_menu(export_callback)) + gtop.get_widget("import1").set_submenu(Plugins.import_menu(import_callback)) database.setResearcher(Config.owner) mainloop() diff --git a/gramps/src/latin_utf8.py b/gramps/src/latin_utf8.py index 97f3a6b71..b43a79a96 100644 --- a/gramps/src/latin_utf8.py +++ b/gramps/src/latin_utf8.py @@ -25,7 +25,7 @@ if sys.version[0] != '1': return s.encode('latin-1') def latin_to_utf8(s): - return s.encode('utf-8') + return s else: try: diff --git a/gramps/src/plugins/ReadGedcom.py b/gramps/src/plugins/ReadGedcom.py index 29245f5a2..5784f0890 100644 --- a/gramps/src/plugins/ReadGedcom.py +++ b/gramps/src/plugins/ReadGedcom.py @@ -1283,7 +1283,7 @@ class GedcomParser: self.backup() return 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) elif matches[1] == "PHON": addr.phone = matches[2]