Handle list colors for python 2, fix broken family links
svn: r1014
This commit is contained in:
parent
5771c12f21
commit
4bac61b9e3
@ -25,6 +25,12 @@ oddfg = (0,0,0)
|
|||||||
evenfg = (0,0,0)
|
evenfg = (0,0,0)
|
||||||
ancestorfg = (0,0,0)
|
ancestorfg = (0,0,0)
|
||||||
|
|
||||||
|
def to_signed(a):
|
||||||
|
if a & 0x8000:
|
||||||
|
return a - 0x10000
|
||||||
|
else:
|
||||||
|
return a
|
||||||
|
|
||||||
class ColorList:
|
class ColorList:
|
||||||
def __init__(self,clist,increment):
|
def __init__(self,clist,increment):
|
||||||
self.index = 0
|
self.index = 0
|
||||||
@ -34,10 +40,10 @@ class ColorList:
|
|||||||
self.color_ok = 1
|
self.color_ok = 1
|
||||||
try:
|
try:
|
||||||
cmap = clist.get_colormap()
|
cmap = clist.get_colormap()
|
||||||
self.oddbg = cmap.alloc(oddbg[0],oddbg[1],oddbg[2])
|
self.oddbg = cmap.alloc(to_signed(oddbg[0]),to_signed(oddbg[1]),to_signed(oddbg[2]))
|
||||||
self.oddfg = cmap.alloc(oddfg[0],oddfg[1],oddfg[2])
|
self.oddfg = cmap.alloc(to_signed(oddfg[0]),to_signed(oddfg[1]),to_signed(oddfg[2]))
|
||||||
self.evenbg = cmap.alloc(evenbg[0],evenbg[1],evenbg[2])
|
self.evenbg = cmap.alloc(to_signed(evenbg[0]),to_signed(evenbg[1]),to_signed(evenbg[2]))
|
||||||
self.evenfg = cmap.alloc(evenfg[0],evenfg[1],evenfg[2])
|
self.evenfg = cmap.alloc(to_signed(evenfg[0]),to_signed(evenfg[1]),to_signed(evenfg[2]))
|
||||||
except OverflowError:
|
except OverflowError:
|
||||||
self.color_ok = 0
|
self.color_ok = 0
|
||||||
|
|
||||||
|
@ -901,7 +901,7 @@ class Gramps:
|
|||||||
|
|
||||||
def delete_person_response(self):
|
def delete_person_response(self):
|
||||||
for family in self.active_person.getFamilyList():
|
for family in self.active_person.getFamilyList():
|
||||||
if self.active_person.getGender == Person.male:
|
if self.active_person == family.getFather():
|
||||||
if family.getMother() == None:
|
if family.getMother() == None:
|
||||||
for child in family.getChildList():
|
for child in family.getChildList():
|
||||||
child.removeAltFamily(family)
|
child.removeAltFamily(family)
|
||||||
|
@ -62,6 +62,7 @@ class CheckIntegrity:
|
|||||||
self.bad_photo = []
|
self.bad_photo = []
|
||||||
self.empty_family = []
|
self.empty_family = []
|
||||||
self.broken_links = []
|
self.broken_links = []
|
||||||
|
self.broken_parent_links = []
|
||||||
self.fam_rel = []
|
self.fam_rel = []
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -73,6 +74,17 @@ class CheckIntegrity:
|
|||||||
self.broken_links = []
|
self.broken_links = []
|
||||||
family_list = self.db.getFamilyMap().values()[:]
|
family_list = self.db.getFamilyMap().values()[:]
|
||||||
for family in family_list:
|
for family in family_list:
|
||||||
|
father = family.getFather()
|
||||||
|
mother = family.getMother()
|
||||||
|
|
||||||
|
if father and family not in father.getFamilyList():
|
||||||
|
Utils.modified()
|
||||||
|
self.broken_parent_links.append((father,family))
|
||||||
|
father.addFamily(family)
|
||||||
|
if mother and family not in mother.getFamilyList():
|
||||||
|
Utils.modified()
|
||||||
|
self.broken_parent_links.append((mother,family))
|
||||||
|
mother.addFamily(family)
|
||||||
for child in family.getChildList():
|
for child in family.getChildList():
|
||||||
if family == child.getMainParents():
|
if family == child.getMainParents():
|
||||||
continue
|
continue
|
||||||
@ -153,6 +165,7 @@ class CheckIntegrity:
|
|||||||
photos = len(self.bad_photo)
|
photos = len(self.bad_photo)
|
||||||
efam = len(self.empty_family)
|
efam = len(self.empty_family)
|
||||||
blink = len(self.broken_links)
|
blink = len(self.broken_links)
|
||||||
|
plink = len(self.broken_parent_links)
|
||||||
rel = len(self.fam_rel)
|
rel = len(self.fam_rel)
|
||||||
|
|
||||||
errors = blink + efam + photos + rel
|
errors = blink + efam + photos + rel
|
||||||
@ -164,9 +177,9 @@ class CheckIntegrity:
|
|||||||
text = ""
|
text = ""
|
||||||
if blink > 0:
|
if blink > 0:
|
||||||
if blink == 1:
|
if blink == 1:
|
||||||
text = text + _("1 broken family link was fixed\n")
|
text = text + _("1 broken child/family link was fixed\n")
|
||||||
else:
|
else:
|
||||||
text = text + _("%d broken family links were found\n") % blink
|
text = text + _("%d broken child/family links were found\n") % blink
|
||||||
for c in self.broken_links:
|
for c in self.broken_links:
|
||||||
cn = c[0].getPrimaryName().getName()
|
cn = c[0].getPrimaryName().getName()
|
||||||
f = c[1].getFather()
|
f = c[1].getFather()
|
||||||
@ -180,6 +193,26 @@ class CheckIntegrity:
|
|||||||
pn = m.getPrimaryName().getName()
|
pn = m.getPrimaryName().getName()
|
||||||
text = text + '\t' + \
|
text = text + '\t' + \
|
||||||
_("%s was removed from the family of %s\n") % (cn,pn)
|
_("%s was removed from the family of %s\n") % (cn,pn)
|
||||||
|
|
||||||
|
if plink > 0:
|
||||||
|
if plink == 1:
|
||||||
|
text = text + _("1 broken spouse/family link was fixed\n")
|
||||||
|
else:
|
||||||
|
text = text + _("%d broken spouse/family links were found\n") % plink
|
||||||
|
for c in self.broken_parent_links:
|
||||||
|
cn = c[0].getPrimaryName().getName()
|
||||||
|
f = c[1].getFather()
|
||||||
|
m = c[1].getMother()
|
||||||
|
if f and m:
|
||||||
|
pn = _("%s and %s") % (f.getPrimaryName().getName(),\
|
||||||
|
m.getPrimaryName().getName())
|
||||||
|
elif f:
|
||||||
|
pn = f.getPrimaryName().getName()
|
||||||
|
else:
|
||||||
|
pn = m.getPrimaryName().getName()
|
||||||
|
text = text + '\t' + \
|
||||||
|
_("%s was restored to the family of %s\n") % (cn,pn)
|
||||||
|
|
||||||
if efam == 1:
|
if efam == 1:
|
||||||
text = text + _("1 empty family was found\n")
|
text = text + _("1 empty family was found\n")
|
||||||
elif efam > 1:
|
elif efam > 1:
|
||||||
|
Loading…
Reference in New Issue
Block a user