From 838406caa6f4dbe32ec9ac27733b10fd74f58185 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Wed, 12 Oct 2005 23:00:43 +0000 Subject: [PATCH] * src/data/main*.css: improved css styles for ancestor graphs * src/plugins/NavWebPage.py: 4 generation ancestor graph svn: r5306 --- gramps2/ChangeLog | 2 + gramps2/src/data/main1.css | 8 +- gramps2/src/data/main2.css | 8 +- gramps2/src/data/main3.css | 8 +- gramps2/src/data/main4.css | 8 +- gramps2/src/data/main5.css | 8 +- gramps2/src/data/main6.css | 8 +- gramps2/src/plugins/NavWebPage.py | 211 ++++++++++++++++++------------ 8 files changed, 152 insertions(+), 109 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 89a39563d..3a21b39a3 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,6 @@ 2005-10-12 Don Allingham + * src/data/main*.css: improved css styles for ancestor graphs + * src/plugins/NavWebPage.py: 4 generation ancestor graph * src/ReportUtils.py: handle "unknown_gender_name" in parameter arrays 2005-10-11 Don Allingham diff --git a/gramps2/src/data/main1.css b/gramps2/src/data/main1.css index e9179ddf3..06d27c70a 100755 --- a/gramps2/src/data/main1.css +++ b/gramps2/src/data/main1.css @@ -232,12 +232,12 @@ TD.field { #sourcerefs { } #weblinks { } -.box { font-size: 10pt; height: 55px; padding: 5px; } +.box { font-size: 10pt; height: 48px; padding: 5px; vertical-align: middle;} .bvline { position: absolute; background-color: #000000; font-size: 0pt; z-index: 3; height: 1px;} .bhline { position: absolute; background-color: #000000; font-size: 0pt; z-index: 3; width: 1px;} -.border { position: absolute; background-color: #000000; font-size: 0pt; z-index: 4; width: 153px; height: 57px; } -.boxbg { position: absolute; background-color: #cccccc; z-index: 5; width: 151px; height: 55px;} -.shadow { position: absolute; background-color: #999999; z-index: 1; width: 153px; height: 57px; } +.border { position: absolute; background-color: #000000; font-size: 0pt; z-index: 4; width: 160px; height: 50px; } +.boxbg { position: absolute; background-color: #eeeeee; z-index: 5; width: 158px; height: 48px;} +.shadow { position: absolute; background-color: #999999; z-index: 1; width: 158px; height: 48px; } .ghline { position: absolute; background-color: #999999; font-size: 0pt; z-index: 1; width: 1px;} .gvline { position: absolute; background-color: #999999; font-size: 0pt; z-index: 1; height: 1px;} diff --git a/gramps2/src/data/main2.css b/gramps2/src/data/main2.css index 15b5c9e69..3193556e6 100755 --- a/gramps2/src/data/main2.css +++ b/gramps2/src/data/main2.css @@ -234,12 +234,12 @@ TD.field { #sourcerefs { } #weblinks { } -.box { font-size: 10pt; height: 55px; padding: 5px; } +.box { font-size: 10pt; height: 48px; padding: 5px; vertical-align: middle;} .bvline { position: absolute; background-color: #000000; font-size: 0pt; z-index: 3; height: 1px;} .bhline { position: absolute; background-color: #000000; font-size: 0pt; z-index: 3; width: 1px;} -.border { position: absolute; background-color: #000000; font-size: 0pt; z-index: 4; width: 153px; height: 57px; } -.boxbg { position: absolute; background-color: #cccccc; z-index: 5; width: 151px; height: 55px;} -.shadow { position: absolute; background-color: #999999; z-index: 1; width: 153px; height: 57px; } +.border { position: absolute; background-color: #000000; font-size: 0pt; z-index: 4; width: 160px; height: 50px; } +.boxbg { position: absolute; background-color: #e0e0e9; z-index: 5; width: 158px; height: 48px;} +.shadow { position: absolute; background-color: #999999; z-index: 1; width: 158px; height: 48px; } .ghline { position: absolute; background-color: #999999; font-size: 0pt; z-index: 1; width: 1px;} .gvline { position: absolute; background-color: #999999; font-size: 0pt; z-index: 1; height: 1px;} diff --git a/gramps2/src/data/main3.css b/gramps2/src/data/main3.css index 42e16d31c..38260b45b 100755 --- a/gramps2/src/data/main3.css +++ b/gramps2/src/data/main3.css @@ -250,12 +250,12 @@ TD.field { #sourcerefs { } #weblinks { } -.box { font-size: 10pt; height: 55px; padding: 5px; } +.box { font-size: 10pt; height: 48px; padding: 5px; vertical-align: middle;} .bvline { position: absolute; background-color: #000000; font-size: 0pt; z-index: 3; height: 1px;} .bhline { position: absolute; background-color: #000000; font-size: 0pt; z-index: 3; width: 1px;} -.border { position: absolute; background-color: #000000; font-size: 0pt; z-index: 4; width: 153px; height: 57px; } -.boxbg { position: absolute; background-color: #cccccc; z-index: 5; width: 151px; height: 55px;} -.shadow { position: absolute; background-color: #999999; z-index: 1; width: 153px; height: 57px; } +.border { position: absolute; background-color: #000000; font-size: 0pt; z-index: 4; width: 160px; height: 50px; } +.boxbg { position: absolute; background-color: #f6f6f0; z-index: 5; width: 158px; height: 48px;} +.shadow { position: absolute; background-color: #999999; z-index: 1; width: 158px; height: 48px; } .ghline { position: absolute; background-color: #999999; font-size: 0pt; z-index: 1; width: 1px;} .gvline { position: absolute; background-color: #999999; font-size: 0pt; z-index: 1; height: 1px;} diff --git a/gramps2/src/data/main4.css b/gramps2/src/data/main4.css index 57580c9cd..e8e2c5bd6 100755 --- a/gramps2/src/data/main4.css +++ b/gramps2/src/data/main4.css @@ -262,12 +262,12 @@ TD.field { #sourcerefs { } #weblinks { } -.box { font-size: 10pt; height: 55px; padding: 5px; } +.box { font-size: 10pt; height: 48px; padding: 5px; vertical-align: middle;} .bvline { position: absolute; background-color: #000000; font-size: 0pt; z-index: 3; height: 1px;} .bhline { position: absolute; background-color: #000000; font-size: 0pt; z-index: 3; width: 1px;} -.border { position: absolute; background-color: #000000; font-size: 0pt; z-index: 4; width: 153px; height: 57px; } -.boxbg { position: absolute; background-color: #cccccc; z-index: 5; width: 151px; height: 55px;} -.shadow { position: absolute; background-color: #999999; z-index: 1; width: 153px; height: 57px; } +.border { position: absolute; background-color: #000000; font-size: 0pt; z-index: 4; width: 160px; height: 50px; } +.boxbg { position: absolute; background-color: #f0ece6; z-index: 5; width: 158px; height: 48px;} +.shadow { position: absolute; background-color: #999999; z-index: 1; width: 158px; height: 48px; } .ghline { position: absolute; background-color: #999999; font-size: 0pt; z-index: 1; width: 1px;} .gvline { position: absolute; background-color: #999999; font-size: 0pt; z-index: 1; height: 1px;} diff --git a/gramps2/src/data/main5.css b/gramps2/src/data/main5.css index d7c1e88f9..179fa0afe 100755 --- a/gramps2/src/data/main5.css +++ b/gramps2/src/data/main5.css @@ -268,12 +268,12 @@ TD.data { #sourcerefs { } #weblinks { } -.box { font-size: 10pt; height: 55px; padding: 5px; } +.box { font-size: 10pt; height: 48px; padding: 5px; vertical-align: middle;} .bvline { position: absolute; background-color: #000000; font-size: 0pt; z-index: 3; height: 1px;} .bhline { position: absolute; background-color: #000000; font-size: 0pt; z-index: 3; width: 1px;} -.border { position: absolute; background-color: #000000; font-size: 0pt; z-index: 4; width: 153px; height: 57px; } -.boxbg { position: absolute; background-color: #cccccc; z-index: 5; width: 151px; height: 55px;} -.shadow { position: absolute; background-color: #999999; z-index: 1; width: 153px; height: 57px; } +.border { position: absolute; background-color: #000000; font-size: 0pt; z-index: 4; width: 160px; height: 50px; } +.boxbg { position: absolute; background-color: #e0e6e0; z-index: 5; width: 158px; height: 48px;} +.shadow { position: absolute; background-color: #999999; z-index: 1; width: 158px; height: 48px; } .ghline { position: absolute; background-color: #999999; font-size: 0pt; z-index: 1; width: 1px;} .gvline { position: absolute; background-color: #999999; font-size: 0pt; z-index: 1; height: 1px;} diff --git a/gramps2/src/data/main6.css b/gramps2/src/data/main6.css index 2ce31e92c..222838239 100644 --- a/gramps2/src/data/main6.css +++ b/gramps2/src/data/main6.css @@ -256,12 +256,12 @@ SPAN.grampsid { text-align: center; } -.box { font-size: 10pt; height: 55px; padding: 5px; } +.box { font-size: 10pt; height: 48px; padding: 5px; vertical-align: middle;} .bvline { position: absolute; background-color: #000000; font-size: 0pt; z-index: 3; height: 1px;} .bhline { position: absolute; background-color: #000000; font-size: 0pt; z-index: 3; width: 1px;} -.border { position: absolute; background-color: #000000; font-size: 0pt; z-index: 4; width: 153px; height: 57px; } -.boxbg { position: absolute; background-color: #cccccc; z-index: 5; width: 151px; height: 55px;} -.shadow { position: absolute; background-color: #999999; z-index: 1; width: 153px; height: 57px; } +.border { position: absolute; background-color: #000000; font-size: 0pt; z-index: 4; width: 160px; height: 50px; } +.boxbg { position: absolute; background-color: #cccccc; z-index: 5; width: 158px; height: 48px;} +.shadow { position: absolute; background-color: #999999; z-index: 1; width: 158px; height: 48px; } .ghline { position: absolute; background-color: #999999; font-size: 0pt; z-index: 1; width: 1px;} .gvline { position: absolute; background-color: #999999; font-size: 0pt; z-index: 1; height: 1px;} diff --git a/gramps2/src/plugins/NavWebPage.py b/gramps2/src/plugins/NavWebPage.py index 8fee690c6..11da88f2b 100644 --- a/gramps2/src/plugins/NavWebPage.py +++ b/gramps2/src/plugins/NavWebPage.py @@ -75,6 +75,13 @@ from DateHandler import displayer as _dd _NARRATIVE = "narrative.css" _NAME_COL = 3 +WIDTH=160 +HEIGHT=50 +VGAP=10 +HGAP=30 +SHADOW=5 +XOFFSET=5 + _css_files = [ [_("Modern"), 'main1.css'], [_("Business"), 'main2.css'], @@ -1348,6 +1355,55 @@ class IndividualPage(BasePage): self.display_footer(of,db) self.close_file(of) + def draw_box(self,of,center,col,person): + top = center - HEIGHT/2 + xoff = XOFFSET+col*(WIDTH+HGAP) + + of.write('
\n' % (top,xoff+1)) + of.write('
') + person_link = person.handle in self.ind_list + if person_link: + person_name = nameof(person,self.exclude_private) + path = self.build_path(person.handle,"ppl",False) + fname = self.build_name(path,person.handle) + self.person_link(of, fname, person_name) + else: + of.write(nameof(person,self.exclude_private)) + of.write('
\n') + of.write('
\n') + of.write('
\n' % (top+SHADOW,xoff+SHADOW)) + of.write('
\n' % (top-1, xoff)) + + def extend_line(self,of,y0,x0): + of.write('
\n' % + (y0,x0,HGAP/2)) + of.write('
\n' % + (y0+SHADOW,x0,HGAP/2+SHADOW)) + + def connect_line(self,of,y0,y1,col): + if y0 < y1: + y = y0 + else: + y = y1 + + x0 = XOFFSET + col * WIDTH + (col-1)*HGAP + HGAP/2 + of.write('
\n' % + (y1,x0,HGAP/2)) + of.write('
\n' % + (y1+SHADOW,x0+SHADOW,HGAP/2+SHADOW)) + of.write('
\n' % + (y,x0,abs(y0-y1))) + of.write('
\n' % + (y+SHADOW,x0+SHADOW,abs(y0-y1))) + + def draw_connected_box(self,of,center1,center2,col,handle): + if not handle: + return None + person = self.db.get_person_from_handle(handle) + self.draw_box(of,center2,col,person) + self.connect_line(of,center1,center2,col) + return person + def display_tree(self,of): family_handle = self.person.get_main_parents_family_handle() if not family_handle: @@ -1358,115 +1414,100 @@ class IndividualPage(BasePage): of.write('

%s

\n' % _('Ancestors')) of.write('
\n') - # self - - of.write('
\n') - of.write('
%s
\n' % _nd.display(self.person)) - of.write('
\n') - of.write('
\n') - of.write('
\n') + # self - first box, centered, flush left + + GENERATIONS = 4 + + max_in_col = 1 <<(GENERATIONS-1) + max_size = HEIGHT*max_in_col + VGAP*(max_in_col+1) + + center0 = max_size / 2 + self.draw_box(of,center0,0,self.person) + self.extend_line(of,center0,XOFFSET+WIDTH) father_handle = family.get_father_handle() if father_handle: - father = self.db.get_person_from_handle(father_handle) - of.write('
\n') - of.write('
%s
\n' % _nd.display(father)) - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') + center1 = int(max_size/4) + father = self.draw_connected_box(of,center0,center1,1,father_handle) f_family_handle = father.get_main_parents_family_handle() if f_family_handle: - of.write('
\n') - of.write('
\n') - + self.extend_line(of,center1,XOFFSET+2*WIDTH+HGAP) f_family = self.db.get_family_from_handle(f_family_handle) - f_father_handle = f_family.get_father_handle() - if f_father_handle: - f_father = self.db.get_person_from_handle(f_father_handle) - of.write('
\n') - of.write('
%s
\n' % _nd.display(f_father)) - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') + center2 = int(max_size/8) + f_father = self.draw_connected_box(of,center1,center2,2,f_family.get_father_handle()) - f_mother_handle = f_family.get_mother_handle() + if f_father: + ff_family_handle = f_father.get_main_parents_family_handle() + if ff_family_handle: + self.extend_line(of,center2,XOFFSET+3*WIDTH+2*HGAP) + ff_family = self.db.get_family_from_handle(ff_family_handle) - if f_mother_handle: - f_mother = self.db.get_person_from_handle(f_mother_handle) + center3 = int(max_size)/16 + self.draw_connected_box(of,center2,center3,3,ff_family.get_father_handle()) - of.write('
\n') - of.write('
%s
\n' % _nd.display(f_mother)) - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') + center3 = int(max_size)/16*3 + self.draw_connected_box(of,center2,center3,3,ff_family.get_mother_handle()) + + center2 = int(max_size/8)*3 + f_mother = self.draw_connected_box(of,center1,center2,2,f_family.get_mother_handle()) + + if f_mother: + ff_family_handle = f_mother.get_main_parents_family_handle() + if ff_family_handle: + self.extend_line(of,center2,XOFFSET+3*WIDTH+2*HGAP) + ff_family = self.db.get_family_from_handle(ff_family_handle) + + center3 = int(max_size)/16*5 + self.draw_connected_box(of,center2,center3,3,ff_family.get_father_handle()) + + center3 = int(max_size)/16*7 + self.draw_connected_box(of,center2,center3,3,ff_family.get_mother_handle()) mother_handle = family.get_mother_handle() if mother_handle: - mother = self.db.get_person_from_handle(mother_handle) - - of.write('
\n') - of.write('
%s
\n' % _nd.display(mother)) - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') + center1 = int(max_size/4)*3 + mother = self.draw_connected_box(of,center0,center1,1,mother_handle) m_family_handle = mother.get_main_parents_family_handle() if m_family_handle: - of.write('
\n') - of.write('
\n') - + self.extend_line(of,center1,XOFFSET+2*WIDTH+HGAP) m_family = self.db.get_family_from_handle(m_family_handle) - m_father_handle = m_family.get_father_handle() - if m_father_handle: - m_father = self.db.get_person_from_handle(m_father_handle) + center2 = int(max_size/8)*5 + f_father = self.draw_connected_box(of,center1,center2,2,m_family.get_father_handle()) - of.write('
\n') - of.write('
%s
\n' % _nd.display(m_father)) - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') + if f_father: + ff_family_handle = f_father.get_main_parents_family_handle() + if ff_family_handle: + self.extend_line(of,center2,XOFFSET+3*WIDTH+2*HGAP) + ff_family = self.db.get_family_from_handle(ff_family_handle) - m_mother_handle = m_family.get_mother_handle() + center3 = int(max_size)/16*9 + self.draw_connected_box(of,center2,center3,3,ff_family.get_father_handle()) - if m_mother_handle: - m_mother = self.db.get_person_from_handle(m_mother_handle) - of.write('
\n') - of.write('
%s
\n' % _nd.display(m_mother)) - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') - of.write('
\n') + center3 = int(max_size)/16*11 + self.draw_connected_box(of,center2,center3,3,ff_family.get_mother_handle()) + + center2 = int(max_size/8)*7 + f_mother = self.draw_connected_box(of,center1,center2,2,m_family.get_mother_handle()) + + if f_mother: + ff_family_handle = f_mother.get_main_parents_family_handle() + if ff_family_handle: + self.extend_line(of,center2,XOFFSET+3*WIDTH+2*HGAP) + ff_family = self.db.get_family_from_handle(ff_family_handle) + + center3 = int(max_size)/16*13 + self.draw_connected_box(of,center2,center3,3,ff_family.get_father_handle()) + + center3 = int(max_size)/16*15 + self.draw_connected_box(of,center2,center3,3,ff_family.get_mother_handle()) of.write('
\n') - of.write('
\n') + of.write('
\n' % + (max_size,3*WIDTH+2*HGAP+2*XOFFSET)) def display_ind_sources(self,of): sreflist = self.src_refs + self.person.get_source_references()