chiark / gitweb /
changed graphs to manual dot file; added pictures; faffed about with text
[familyTree.git] / cgiFiles / smallGraph.py
1 #!/usr/bin/python
2
3 import cgi
4 import cgitb
5 import make_dot as d
6
7 cgitb.enable()
8
9 def make_graph(Self,parents,children,otherparents,spouses):
10         d.start_dot()   
11
12         d.add_highlight(Self)
13         
14         countSame = 2;
15         for i in range(1,len(parents)):
16                 if parents[i]==parents[i-1]:
17                         parents[1]=parents[1] + ' '+str(countSame)
18                         countSame = countSame +1
19
20         d.add_marriage(parents[0],parents[1],[Self],1)
21
22         for i in range(len(otherparents)):
23                 c = children[i]
24                 op = otherparents[i]
25                 d.add_marriage(Self,op,[c],1)
26
27         for i in range(len(spouses)):
28                 s = spouses[i]
29                 d.add_marriage(Self,s,[],1)
30
31
32         d.subgraphs.append(children)
33
34         d.add_subgraphs()
35         
36         d.end_dot()
37                 
38         d.render_dot()
39
40
41 form = cgi.FieldStorage()
42
43 Self = form.getvalue('Self')
44 p = form.getlist('p')
45 c = form.getlist('c')
46 op = form.getlist('op')
47 s = form.getlist('s')
48
49 make_graph(Self,p,c,op,s)