From 7978cf7317d9d25d6796bffe32bc924783cf5414 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sun, 20 Apr 2003 03:52:54 +0000 Subject: [PATCH] Bug fixes svn: r1466 --- configure.in | 2 +- src/AutoComp.py | 20 ++++++++++++-------- src/ChooseParents.py | 11 +++++++++-- src/EditPerson.py | 3 +++ src/PedView.py | 1 - src/ReadXML.py | 15 +++------------ src/RelLib.py | 2 ++ src/Sources.py | 14 ++++++++------ src/WriteXML.py | 31 ++++++++++++++++++------------- 9 files changed, 56 insertions(+), 43 deletions(-) diff --git a/configure.in b/configure.in index 9a080d4a7..d91555d9a 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script. dnl May need to run automake && aclocal first AC_INIT(src/gramps.py) AM_INIT_AUTOMAKE(gramps, 0.9.1) -RELEASE=rc1 +RELEASE=1 VERSIONSTRING=$VERSION if test x"$RELEASE" != "x" diff --git a/src/AutoComp.py b/src/AutoComp.py index b318165bd..8c464f813 100644 --- a/src/AutoComp.py +++ b/src/AutoComp.py @@ -143,12 +143,12 @@ class AutoCombo(AutoCompBase): AutoCompBase.__init__(self,widget,plist,source) self.entry = widget widget.entry.connect("insert-text",self.insert_text) -# button1 = widget.get_children()[1] -# button1.connect("pressed",self.build_list) -# button1.connect("released",self.setval) self.vals = [""] self.inb = 0 - widget.set_popdown_strings(plist) + if len(plist) > 0: + widget.set_popdown_strings(plist) + else: + widget.set_popdown_strings([""]) def setval(self,widget): """Callback task called on the button release""" @@ -164,11 +164,15 @@ class AutoCombo(AutoCompBase): combo button that activates the dropdown menu is pressed """ self.inb = 1 - - if self.vals[0] == "": - self.entry.set_popdown_strings([self.entry.entry.get_text()]) + + if len(self.vals) > 0: + if self.vals[0] == "": + self.entry.set_popdown_strings([self.entry.entry.get_text()]) + else: + self.entry.set_popdown_strings(self.vals) else: - self.entry.set_popdown_strings(self.vals) + self.entry.set_popdown_strings([""]) + return 1 def timer_callback(self,entry): diff --git a/src/ChooseParents.py b/src/ChooseParents.py index a59704d41..6327fac9c 100644 --- a/src/ChooseParents.py +++ b/src/ChooseParents.py @@ -266,8 +266,15 @@ class ChooseParents: Called with the OK button nis pressed. Saves the selected people as parents of the main perosn. """ - mother_rel = const.childRelations[self.mother_rel.get_text()] - father_rel = const.childRelations[self.father_rel.get_text()] + try: + mother_rel = const.childRelations[self.mother_rel.get_text()] + except KeyError: + mother_rel = const.childRelations["Birth"] + + try: + father_rel = const.childRelations[self.father_rel.get_text()] + except KeyError: + father_rel = const.childRelations["Birth"] if self.father or self.mother: if self.mother and not self.father: diff --git a/src/EditPerson.py b/src/EditPerson.py index ae0e63858..73c728b85 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -1290,6 +1290,7 @@ class EditPerson: if not self.person.getBirth().are_equal(self.birth): self.person.setBirth(self.birth) + Utils.modified() # Update each of the families child lists to reflect any # change in ordering due to the new birth date @@ -1306,6 +1307,7 @@ class EditPerson: if not self.person.getDeath().are_equal(self.death): self.person.setDeath(self.death) + Utils.modified() male = self.is_male.get_active() female = self.is_female.get_active() @@ -1382,6 +1384,7 @@ class EditPerson: self.update_lists() if self.callback: self.callback(self,self.add_places) + self.gallery.close() self.window.destroy() diff --git a/src/PedView.py b/src/PedView.py index 8d83a8582..dfdb5a394 100644 --- a/src/PedView.py +++ b/src/PedView.py @@ -184,7 +184,6 @@ class PedigreeView: for n in [GrampsCfg.nameof(t[0]), 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: diff --git a/src/ReadXML.py b/src/ReadXML.py index 6d63bf4c7..6440994be 100644 --- a/src/ReadXML.py +++ b/src/ReadXML.py @@ -72,6 +72,8 @@ def importData(database, filename, callback): f.close() except IOError,msg: use_gzip = 0 + except ValueError, msg: + use_gzip = 1 else: use_gzip = 0 @@ -99,18 +101,7 @@ def importData(database, filename, callback): _("The file is probably either corrupt or not a valid GRAMPS database.")) return 0 except ValueError, msg: - if str(msg)[0:16] == "Incorrect length": - WarningDialog(_("A Data Compression Problem Was Encountered"), - _("Your database has encountered an error in the library " - "that compresses the data. Your data should be okay, but " - "you may want to consider disabling compression. " - "This can be disabled in the Properties dialog. Once you " - "have disabled compression, this error will go away after " - "the next time you save the database.")) - else: - import DisplayTrace - DisplayTrace.DisplayTrace() - return 0 + pass except: import DisplayTrace DisplayTrace.DisplayTrace() diff --git a/src/RelLib.py b/src/RelLib.py index ed47e9031..bb5837c14 100644 --- a/src/RelLib.py +++ b/src/RelLib.py @@ -912,6 +912,8 @@ class Name(DataObj): return 0 if self.Surname != other.Surname: return 0 + if self.Prefix != other.Prefix: + return 0 if self.Suffix != other.Suffix: return 0 if self.Title != other.Title: diff --git a/src/Sources.py b/src/Sources.py index 331187a03..c31e4bf65 100644 --- a/src/Sources.py +++ b/src/Sources.py @@ -247,7 +247,6 @@ class SourceEditor: self.conf_menu.set_history(srcref.getConfidence()) self.list = [] - self.title_menu.list.select_item(0) self.title_menu.list.remove_items(self.title_menu.list.get_selection()) @@ -259,7 +258,7 @@ class SourceEditor: else: self.active_source = None - self.draw() + self.draw(self.active_source) self.set_button() self.sourceDisplay.show() @@ -312,10 +311,13 @@ class SourceEditor: if self.active_source == src: sel_child = c - self.title_menu.list.append_items(self.list) - - if sel_child: - self.title_menu.list.select_child(sel_child) + if len(self.list) > 0: + self.title_menu.list.append_items(self.list) + self.title_menu.set_sensitive(1) + if sel_child: + self.title_menu.list.select_child(sel_child) + else: + self.title_menu.set_sensitive(0) def on_sourceok_clicked(self,obj): diff --git a/src/WriteXML.py b/src/WriteXML.py index 5b4b8a112..4799eb2a5 100644 --- a/src/WriteXML.py +++ b/src/WriteXML.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000 Donald N. Allingham +# Copyright (C) 2000, 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 @@ -31,6 +31,7 @@ import string import time import shutil import os +import codecs #------------------------------------------------------------------------- # @@ -100,7 +101,7 @@ class XmlWriter: def __init__(self,db,callback,strip_photos,compress=1): """ - Initializes, but nots not write, and XML file. + Initializes, but does not write, an XML file. db - database to write callback - function to provide progress indication @@ -114,39 +115,43 @@ class XmlWriter: def write(self,filename): """ - Write the database to the specfied file. + Write the database to the specified file. """ self.fileroot = os.path.dirname(filename) if self.compress: try: - self.g = gzip.open(filename,"wb") + g = gzip.open(filename,"wb") except: - self.g = open(filename,"w") + g = open(filename,"w") else: - self.g = open(filename,"w") + g = open(filename,"w") + self.g = codecs.getwriter("utf8")(g) self.write_xml_data() - self.g.close() + g.close() def write_handle(self,handle): """ - Write the database to the specfied file handle. + Write the database to the specified file handle. """ use_g = 0 if self.compress: try: - self.g = gzip.GzipFile(mode="wb",fileobj=handle) + g = gzip.GzipFile(mode="wb",fileobj=handle) use_g = 1 except: - self.g = handle + g = handle else: - self.g = handle + g = handle + + self.g = codecs.getwriter("utf8")(g) self.write_xml_data() + self.g.close() if use_g: - self.g.close() - + g.close() + def write_xml_data(self): date = string.split(time.ctime(time.time()))