Bug fixes
svn: r1466
This commit is contained in:
		@@ -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):
 | 
			
		||||
 
 | 
			
		||||
@@ -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:
 | 
			
		||||
 
 | 
			
		||||
@@ -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()
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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:
 | 
			
		||||
 
 | 
			
		||||
@@ -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()
 | 
			
		||||
 
 | 
			
		||||
@@ -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:
 | 
			
		||||
 
 | 
			
		||||
@@ -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):
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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()))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user