Bug fixes

svn: r1466
This commit is contained in:
Don Allingham 2003-04-20 03:52:54 +00:00
parent d46827fd47
commit 5fd107adc8
9 changed files with 56 additions and 43 deletions

View File

@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
dnl May need to run automake && aclocal first dnl May need to run automake && aclocal first
AC_INIT(src/gramps.py) AC_INIT(src/gramps.py)
AM_INIT_AUTOMAKE(gramps, 0.9.1) AM_INIT_AUTOMAKE(gramps, 0.9.1)
RELEASE=rc1 RELEASE=1
VERSIONSTRING=$VERSION VERSIONSTRING=$VERSION
if test x"$RELEASE" != "x" if test x"$RELEASE" != "x"

View File

@ -143,12 +143,12 @@ class AutoCombo(AutoCompBase):
AutoCompBase.__init__(self,widget,plist,source) AutoCompBase.__init__(self,widget,plist,source)
self.entry = widget self.entry = widget
widget.entry.connect("insert-text",self.insert_text) 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.vals = [""]
self.inb = 0 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): def setval(self,widget):
"""Callback task called on the button release""" """Callback task called on the button release"""
@ -164,11 +164,15 @@ class AutoCombo(AutoCompBase):
combo button that activates the dropdown menu is pressed combo button that activates the dropdown menu is pressed
""" """
self.inb = 1 self.inb = 1
if self.vals[0] == "": if len(self.vals) > 0:
self.entry.set_popdown_strings([self.entry.entry.get_text()]) if self.vals[0] == "":
self.entry.set_popdown_strings([self.entry.entry.get_text()])
else:
self.entry.set_popdown_strings(self.vals)
else: else:
self.entry.set_popdown_strings(self.vals) self.entry.set_popdown_strings([""])
return 1 return 1
def timer_callback(self,entry): def timer_callback(self,entry):

View File

@ -266,8 +266,15 @@ class ChooseParents:
Called with the OK button nis pressed. Saves the selected people as parents Called with the OK button nis pressed. Saves the selected people as parents
of the main perosn. of the main perosn.
""" """
mother_rel = const.childRelations[self.mother_rel.get_text()] try:
father_rel = const.childRelations[self.father_rel.get_text()] 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.father or self.mother:
if self.mother and not self.father: if self.mother and not self.father:

View File

@ -1290,6 +1290,7 @@ class EditPerson:
if not self.person.getBirth().are_equal(self.birth): if not self.person.getBirth().are_equal(self.birth):
self.person.setBirth(self.birth) self.person.setBirth(self.birth)
Utils.modified()
# Update each of the families child lists to reflect any # Update each of the families child lists to reflect any
# change in ordering due to the new birth date # change in ordering due to the new birth date
@ -1306,6 +1307,7 @@ class EditPerson:
if not self.person.getDeath().are_equal(self.death): if not self.person.getDeath().are_equal(self.death):
self.person.setDeath(self.death) self.person.setDeath(self.death)
Utils.modified()
male = self.is_male.get_active() male = self.is_male.get_active()
female = self.is_female.get_active() female = self.is_female.get_active()
@ -1382,6 +1384,7 @@ class EditPerson:
self.update_lists() self.update_lists()
if self.callback: if self.callback:
self.callback(self,self.add_places) self.callback(self,self.add_places)
self.gallery.close() self.gallery.close()
self.window.destroy() self.window.destroy()

View File

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

View File

@ -72,6 +72,8 @@ def importData(database, filename, callback):
f.close() f.close()
except IOError,msg: except IOError,msg:
use_gzip = 0 use_gzip = 0
except ValueError, msg:
use_gzip = 1
else: else:
use_gzip = 0 use_gzip = 0
@ -99,18 +101,7 @@ def importData(database, filename, callback):
_("The file is probably either corrupt or not a valid GRAMPS database.")) _("The file is probably either corrupt or not a valid GRAMPS database."))
return 0 return 0
except ValueError, msg: except ValueError, msg:
if str(msg)[0:16] == "Incorrect length": pass
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
except: except:
import DisplayTrace import DisplayTrace
DisplayTrace.DisplayTrace() DisplayTrace.DisplayTrace()

View File

@ -912,6 +912,8 @@ class Name(DataObj):
return 0 return 0
if self.Surname != other.Surname: if self.Surname != other.Surname:
return 0 return 0
if self.Prefix != other.Prefix:
return 0
if self.Suffix != other.Suffix: if self.Suffix != other.Suffix:
return 0 return 0
if self.Title != other.Title: if self.Title != other.Title:

View File

@ -247,7 +247,6 @@ class SourceEditor:
self.conf_menu.set_history(srcref.getConfidence()) self.conf_menu.set_history(srcref.getConfidence())
self.list = [] self.list = []
self.title_menu.list.select_item(0) self.title_menu.list.select_item(0)
self.title_menu.list.remove_items(self.title_menu.list.get_selection()) self.title_menu.list.remove_items(self.title_menu.list.get_selection())
@ -259,7 +258,7 @@ class SourceEditor:
else: else:
self.active_source = None self.active_source = None
self.draw() self.draw(self.active_source)
self.set_button() self.set_button()
self.sourceDisplay.show() self.sourceDisplay.show()
@ -312,10 +311,13 @@ class SourceEditor:
if self.active_source == src: if self.active_source == src:
sel_child = c sel_child = c
self.title_menu.list.append_items(self.list) if len(self.list) > 0:
self.title_menu.list.append_items(self.list)
if sel_child: self.title_menu.set_sensitive(1)
self.title_menu.list.select_child(sel_child) if sel_child:
self.title_menu.list.select_child(sel_child)
else:
self.title_menu.set_sensitive(0)
def on_sourceok_clicked(self,obj): def on_sourceok_clicked(self,obj):

View File

@ -1,7 +1,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # 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 # 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 # it under the terms of the GNU General Public License as published by
@ -31,6 +31,7 @@ import string
import time import time
import shutil import shutil
import os import os
import codecs
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -100,7 +101,7 @@ class XmlWriter:
def __init__(self,db,callback,strip_photos,compress=1): 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 db - database to write
callback - function to provide progress indication callback - function to provide progress indication
@ -114,39 +115,43 @@ class XmlWriter:
def write(self,filename): def write(self,filename):
""" """
Write the database to the specfied file. Write the database to the specified file.
""" """
self.fileroot = os.path.dirname(filename) self.fileroot = os.path.dirname(filename)
if self.compress: if self.compress:
try: try:
self.g = gzip.open(filename,"wb") g = gzip.open(filename,"wb")
except: except:
self.g = open(filename,"w") g = open(filename,"w")
else: else:
self.g = open(filename,"w") g = open(filename,"w")
self.g = codecs.getwriter("utf8")(g)
self.write_xml_data() self.write_xml_data()
self.g.close() g.close()
def write_handle(self,handle): def write_handle(self,handle):
""" """
Write the database to the specfied file handle. Write the database to the specified file handle.
""" """
use_g = 0 use_g = 0
if self.compress: if self.compress:
try: try:
self.g = gzip.GzipFile(mode="wb",fileobj=handle) g = gzip.GzipFile(mode="wb",fileobj=handle)
use_g = 1 use_g = 1
except: except:
self.g = handle g = handle
else: else:
self.g = handle g = handle
self.g = codecs.getwriter("utf8")(g)
self.write_xml_data() self.write_xml_data()
self.g.close()
if use_g: if use_g:
self.g.close() g.close()
def write_xml_data(self): def write_xml_data(self):
date = string.split(time.ctime(time.time())) date = string.split(time.ctime(time.time()))