diff --git a/gramps/src/AddSpouse.py b/gramps/src/AddSpouse.py index 783163c3a..2b52ede5b 100644 --- a/gramps/src/AddSpouse.py +++ b/gramps/src/AddSpouse.py @@ -175,10 +175,11 @@ class AddSpouse: self.person.addFamily(family) spouse.addFamily(family) - if self.person.getGender() == RelLib.Person.male: + if (self.person.getGender() == RelLib.Person.male + or spouse.getGender() == RelLib.Person.female): family.setMother(spouse) family.setFather(self.person) - else: + else: family.setFather(spouse) family.setMother(self.person) @@ -322,11 +323,18 @@ class SetSpouse: return Utils.modified() - if self.family.getFather() == self.person: + + # Recompute the family relation. self.person is already + # a father or mother, but in case (s)he had an unknown + # gender, adding a spouse might swap roles. + if (self.person.getGender() == RelLib.Person.male + or spouse.getGender() == RelLib.Person.female): self.family.setMother(spouse) + self.family.setFather(self.person) else: self.family.setFather(spouse) - + self.family.setMother(self.person) + spouse.addFamily(self.family) reltype = self.relation_type.get_text() diff --git a/gramps/src/docgen/LaTeXDoc.py b/gramps/src/docgen/LaTeXDoc.py index 5068c4d0e..0d12be42d 100644 --- a/gramps/src/docgen/LaTeXDoc.py +++ b/gramps/src/docgen/LaTeXDoc.py @@ -623,13 +623,23 @@ class LaTeXDoc(TextDoc): self.f.write('\\includegraphics[%s]{%s}\\hspace*{\\fill}\n' % (mysize,picf)) else: self.f.write('\\hspace*{\\fill}\\includegraphics[%s]{%s}\hspace*{\\fill}\n' % (mysize,picf)) - + def write_text(self,text): """Write the text to the file""" if not self.in_listing: + # Quote unsafe characters. + text = string.replace(text,'\\','\\\\') + text = string.replace(text,'$','\\$') + text = string.replace(text,'&','\\&') + text = string.replace(text,'%','\\%') + text = string.replace(text,'#','\\#') + text = string.replace(text,'{','\\{') + text = string.replace(text,'}','\\}') + text = string.replace(text,'_','\\_') + text = string.replace(text,'^','\\verb+^+') + text = string.replace(text,'~','\\verb+~+') if text == '\n': text = '\\newline\n' - text = string.replace(text,'#','\#') self.f.write(text) if text: self.last_char_written = text[-1] diff --git a/gramps/src/plugins/Check.py b/gramps/src/plugins/Check.py index a59652352..62b6ec3c4 100644 --- a/gramps/src/plugins/Check.py +++ b/gramps/src/plugins/Check.py @@ -121,8 +121,8 @@ class CheckIntegrity: if father.getGender() == mother.getGender(): family.setRelationship("Partners") self.fam_rel.append(family) - elif father.getGender() != RelLib.Person.male or \ - mother.getGender() != RelLib.Person.female: + elif (father.getGender() == RelLib.Person.female or + mother.getGender() == RelLib.Person.male): family.setFather(mother) family.setMother(father) self.fam_rel.append(family)