Added navigation buttons on pedegree window

svn: r403
This commit is contained in:
Don Allingham 2001-09-13 15:08:36 +00:00
parent 95d7165215
commit 4862d3b34d
2 changed files with 800 additions and 757 deletions

View File

@ -2343,11 +2343,12 @@ def load_canvas():
cpad = max(h+4,CANVASPAD) cpad = max(h+4,CANVASPAD)
cw = (cx2-cx1-(2*cpad)) cw = (cx2-cx1-(2*cpad))
ch = (cy2-cy1-(2*cpad))
if 5*w < cw and 24*h < cy2: if 5*w < cw and 24*h < ch:
gen = 31 gen = 31
xdiv = 5.0 xdiv = 5.0
elif 4*w < cw and 12*h < cy2: elif 4*w < cw and 12*h < ch:
gen = 15 gen = 15
xdiv = 4.0 xdiv = 4.0
else: else:
@ -2358,7 +2359,7 @@ def load_canvas():
c.destroy() c.destroy()
xpts = build_x_coords(cw/xdiv,cpad) xpts = build_x_coords(cw/xdiv,cpad)
ypts = build_y_coords(cy2/32.0) ypts = build_y_coords(ch/32.0)
childcnt = 0 childcnt = 0
for family in active_person.getFamilyList(): for family in active_person.getFamilyList():
@ -2366,27 +2367,32 @@ def load_canvas():
childcnt = 1 childcnt = 1
break break
a = GtkArrow(at=GTK.ARROW_LEFT)
cnv_button = GtkButton()
cnv_button.add(a)
a.show()
cnv_button.connect("clicked",on_arrow_left_clicked)
if childcnt != 0: if childcnt != 0:
a = GtkArrow(at=GTK.ARROW_LEFT)
cnv_button = GtkButton()
cnv_button.add(a)
a.show()
cnv_button.connect("clicked",on_arrow_left_clicked)
cnv_button.show() cnv_button.show()
item = root.add("widget", item = root.add("widget",
widget=cnv_button, widget=cnv_button,
x=cx1, x=cx1,
y=ypts[0]+(h/2.0), #cy2/2.0, #+(h+PAD)/2.0, y=ypts[0]+(h/2.0),
height=h, height=h,
width=h, width=h,
size_pixels=1, size_pixels=1,
anchor=GTK.ANCHOR_WEST) anchor=GTK.ANCHOR_WEST)
canvas_items = [item, cnv_button, a] canvas_items = [item, cnv_button, a]
else: else:
cnv_button.hide()
canvas_items = [] canvas_items = []
if list[1]:
l = add_parent_button(root,canvas_items,list[1],cx2-PAD,ypts[1],h)
if list[2]:
l = add_parent_button(root,canvas_items,list[2],cx2-PAD,ypts[2],h)
for i in range(gen): for i in range(gen):
if list[i]: if list[i]:
if i < int(gen/2): if i < int(gen/2):
@ -2400,6 +2406,27 @@ def load_canvas():
ypts[mindex], h, w, list[mindex], style) ypts[mindex], h, w, list[mindex], style)
add_box(root,xpts[i],ypts[i],w,h,list[i],style) add_box(root,xpts[i],ypts[i],w,h,list[i],style)
def add_parent_button(root,item_list,parent,x,y,h):
a = GtkArrow(at=GTK.ARROW_RIGHT)
cnv_button = GtkButton()
cnv_button.add(a)
a.show()
cnv_button.connect("clicked",change_to_parent)
cnv_button.set_data("p",parent)
cnv_button.show()
item = root.add("widget", widget=cnv_button, x=x, y=y+(h/2), height=h,
width=h, size_pixels=1, anchor=GTK.ANCHOR_EAST)
item_list.append(a)
item_list.append(item)
item_list.append(cnv_button)
def change_to_parent(obj):
person = obj.get_data("p")
change_active_person(person)
load_canvas()
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# #

File diff suppressed because it is too large Load Diff