* src/PedView.py (load_canvas): Produce generation labels based on

the anchor.


svn: r2582
This commit is contained in:
Alex Roitman 2004-01-02 07:02:12 +00:00
parent 70bfd2f908
commit b9e01111ba
2 changed files with 21 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2004-01-02 Alex Roitman <shura@alex.neuro.umn.edu>
* src/PedView.py (load_canvas): Produce generation labels based on
the anchor.
2004-01-01 Don Allingham <dallingham@users.sourceforge.net> 2004-01-01 Don Allingham <dallingham@users.sourceforge.net>
* src/PedView.py (PedigreeView.load_canvas): switched anchor label from a label * src/PedView.py (PedigreeView.load_canvas): switched anchor label from a label
to a CanvasText to a CanvasText

View File

@ -24,6 +24,13 @@ _PAD = 3
_CANVASPAD = 3 _CANVASPAD = 3
_PERSON = "p" _PERSON = "p"
#-------------------------------------------------------------------------
#
# Python modules
#
#-------------------------------------------------------------------------
from math import log
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# GTK/Gnome modules # GTK/Gnome modules
@ -255,6 +262,16 @@ class PedigreeView:
self.add_parent_button(p[0],x2-_PAD,ypts[2],h) self.add_parent_button(p[0],x2-_PAD,ypts[2],h)
gen_no = 1 gen_no = 1
if self.anchor:
anchor_list = [None]*31
self.find_tree(self.anchor,0,1,anchor_list)
for item in anchor_list:
if item:
if item[0] == self.active_person:
idx = anchor_list.index(item)
gen_no = int(log(idx + 1,2)) + 1
break
for i in range(int(xdiv)): for i in range(int(xdiv)):
item = self.root.add(gnome.canvas.CanvasText, x=(cw*i/xdiv + cpad), y=h, item = self.root.add(gnome.canvas.CanvasText, x=(cw*i/xdiv + cpad), y=h,
text=str(gen_no), text=str(gen_no),