Experimental pedegree replacement

svn: r363
This commit is contained in:
Don Allingham 2001-08-25 02:37:45 +00:00
parent 18273e3e70
commit 6a048ff3c9
3 changed files with 82 additions and 2 deletions

View File

@ -3007,6 +3007,40 @@
<xpad>0</xpad> <xpad>0</xpad>
<ypad>0</ypad> <ypad>0</ypad>
</widget> </widget>
<widget>
<class>GtkScrolledWindow</class>
<name>scrolledwindow28</name>
<hscrollbar_policy>GTK_POLICY_ALWAYS</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<widget>
<class>GnomeCanvas</class>
<name>canvas1</name>
<can_focus>True</can_focus>
<anti_aliased>True</anti_aliased>
<scroll_x1>0</scroll_x1>
<scroll_y1>0</scroll_y1>
<scroll_x2>100</scroll_x2>
<scroll_y2>100</scroll_y2>
<pixels_per_unit>1</pixels_per_unit>
</widget>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>label237</name>
<label>Experimental</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
</widget> </widget>
</widget> </widget>

View File

@ -2336,12 +2336,58 @@ def change_parents(family):
active_mother = None active_mother = None
def load_canvas():
from GDK import *
canvas = gtop.get_widget("canvas1")
cx1,cy1,cx2,cy2 = canvas.get_allocation()
canvas.set_scroll_region(cx1,cy1,cx2,cy2)
root = canvas.root()
for c in canvas.children():
canvas.remove(c)
add_box(root,10,int(cy2/2.0)-15,active_person)
f = active_person.getMainFamily()
if f:
if f.getFather():
y = int(cy2/4.0)
pts = [125,int(cy2/2.0)-15,125,y,int(cx2/3.0),y]
root.add("line",points=pts,fill_color="black")
add_box(root,int(cx2/3.0),y-15,f.getFather())
if f.getMother():
pts = [125,int(cy2/2.0)+15,125,3*y,int(cx2/3.0),3*y]
root.add("line",points=pts,fill_color="black")
add_box(root,int(cx2/3.0),(3*y)-15,f.getMother())
def add_box(root,x,y,person):
name = person.getPrimaryName().getName()
group = root.add("group",x=x,y=y)
fn = "-*-helvetica-bold-r-normal--*-120-*-*-*-*-*-*"
group.add("rect",x1=3,y1=3,x2=203,y2=33,fill_color="black")
group.add("rect",x1=0,y1=0,x2=200,y2=30,fill_color="white")
group.add("text",x=10,y=15,fill_color="black",font=fn,
text=name,anchor=ANCHOR_WEST)
group.connect('event',box_event)
group.set_data('p',person)
def box_event(obj,event):
if event.type == GDK._2BUTTON_PRESS:
if event.button == 1 and event.type == GDK._2BUTTON_PRESS:
load_person(obj.get_data('p'))
elif event.type == GDK.ENTER_NOTIFY:
obj.children()[2].set(fill_color="red")
elif event.type == GDK.LEAVE_NOTIFY:
obj.children()[2].set(fill_color="black")
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# #
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def load_tree(): def load_tree():
load_canvas()
text = {} text = {}
tip = {} tip = {}
for i in range(1,16): for i in range(1,16):

View File

@ -1209,7 +1209,7 @@
<widget> <widget>
<class>GtkButton</class> <class>GtkButton</class>
<name>button120</name> <name>add_photo</name>
<can_default>True</can_default> <can_default>True</can_default>
<can_focus>True</can_focus> <can_focus>True</can_focus>
<signal> <signal>
@ -1224,7 +1224,7 @@
<widget> <widget>
<class>GtkButton</class> <class>GtkButton</class>
<name>button121</name> <name>delete_photo</name>
<can_default>True</can_default> <can_default>True</can_default>
<can_focus>True</can_focus> <can_focus>True</can_focus>
<signal> <signal>