8824 Fix Pedigreeview crash when selecting Compact view

This commit is contained in:
Hivernat Emmanuel 2015-08-21 16:44:18 +10:00 committed by Sam Manzi
parent a5cad3488a
commit 5bb4021b2a

View File

@ -150,7 +150,7 @@ class _PersonWidgetBase(Gtk.DrawingArea):
self.view.cb_childmenu_changed(None, self.person.get_handle()) self.view.cb_childmenu_changed(None, self.person.get_handle())
return True return True
return False return False
def get_image(self, dbstate, person): def get_image(self, dbstate, person):
""" """
Return a thumbnail image for the given person. Return a thumbnail image for the given person.
@ -197,7 +197,7 @@ class PersonBoxWidgetCairo(_PersonWidgetBase):
self.bgcolor = hex_to_rgb_float(self.bgcolor) self.bgcolor = hex_to_rgb_float(self.bgcolor)
self.bordercolor = hex_to_rgb_float(self.bordercolor) self.bordercolor = hex_to_rgb_float(self.bordercolor)
self.img_surf = None self.img_surf = None
if image: if image:
image_path = self.get_image(dbstate, person) image_path = self.get_image(dbstate, person)
if image_path and os.path.exists(image_path): if image_path and os.path.exists(image_path):
@ -981,7 +981,7 @@ class PedigreeView(NavigationView):
rela = lst[2*i+1][1] rela = lst[2*i+1][1]
line = LineWidget2(1, rela, self.tree_direction) line = LineWidget2(1, rela, self.tree_direction)
if lst[((i+1) // 2) - 1] and lst[((i+1) // 2) - 1][2]: if lst[i] and lst[i][2]:
# Required for popup menu # Required for popup menu
line.add_events(Gdk.EventMask.BUTTON_PRESS_MASK) line.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
line.connect("button-press-event", line.connect("button-press-event",
@ -1019,7 +1019,7 @@ class PedigreeView(NavigationView):
if self.tree_style == 0 and level == size - 1: if self.tree_style == 0 and level == size - 1:
height -= 2 height -= 2
y_pos += 1 y_pos += 1
if i > 0 and i % 2 == 0 and (pbw or last_pbw): if i > 0 and i % 2 == 0 and (pbw or last_pbw):
frela = mrela = None frela = mrela = None
if lst[i]: if lst[i]:
@ -1031,8 +1031,8 @@ class PedigreeView(NavigationView):
last_pbw, frela, last_pbw, frela,
pbw, mrela, pbw, mrela,
self.tree_direction) self.tree_direction)
if lst[i] and lst[i][2]: if lst[((i+1) // 2) - 1] and lst[((i+1) // 2) - 1][2]:
# Required for popup menu # Required for popup menu
line.add_events(Gdk.EventMask.BUTTON_PRESS_MASK) line.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
line.connect("button-press-event", line.connect("button-press-event",