Customizable output
svn: r135
This commit is contained in:
parent
68f4cef171
commit
c1b67df6b6
@ -70,18 +70,18 @@ class AncestorReport:
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
def __init__(self,database,person,output,doc, max):
|
def __init__(self,database,display,person,output,doc,max):
|
||||||
self.doc = doc
|
self.doc = doc
|
||||||
self.doc.creator(database.getResearcher().getName())
|
self.doc.creator(database.getResearcher().getName())
|
||||||
self.map = {}
|
self.map = {}
|
||||||
self.text = {}
|
self.text = {}
|
||||||
self.database = database
|
|
||||||
self.start = person
|
self.start = person
|
||||||
self.max_generations = max
|
self.max_generations = max
|
||||||
self.output = output
|
self.output = output
|
||||||
self.box_width = 0
|
self.box_width = 0
|
||||||
self.height = 0
|
self.height = 0
|
||||||
self.lines = 0
|
self.lines = 0
|
||||||
|
self.display = display
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -94,23 +94,36 @@ class AncestorReport:
|
|||||||
if person == None or index >= 2**self.max_generations:
|
if person == None or index >= 2**self.max_generations:
|
||||||
return
|
return
|
||||||
self.map[index] = person
|
self.map[index] = person
|
||||||
self.text[index] = [ person.getPrimaryName().getName() ]
|
|
||||||
|
|
||||||
birth = person.getBirth()
|
self.text[index] = []
|
||||||
if birth.getDate() != "":
|
|
||||||
self.text[index].append("b. %s" % birth.getDate())
|
n = person.getPrimaryName().getRegularName()
|
||||||
death = person.getDeath()
|
N = person.getPrimaryName().getName()
|
||||||
if death.getDate() != "":
|
b = person.getBirth().getDate()
|
||||||
self.text[index].append("d. %s" % death.getDate())
|
d = person.getDeath().getDate()
|
||||||
if Config.status_bar == 1:
|
B = person.getBirth().getPlace()
|
||||||
self.text[index].append("id: %s" % person.getId())
|
D = person.getDeath().getPlace()
|
||||||
elif Config.status_bar == 2:
|
i = "%s" % person.getId()
|
||||||
for attr in active_person.getAttributeList():
|
A = Config.attr_name
|
||||||
|
a = ""
|
||||||
|
for attr in person.getAttributeList():
|
||||||
if attr.getType() == Config.attr_name:
|
if attr.getType() == Config.attr_name:
|
||||||
txt = "%s: %s" % (Config.attr_name,attr.getValue())
|
a = attr.getValue()
|
||||||
self.text[index].append(txt)
|
|
||||||
break
|
break
|
||||||
|
|
||||||
|
for line in self.display:
|
||||||
|
line = string.replace(line,"$n",n)
|
||||||
|
line = string.replace(line,"$N",N)
|
||||||
|
line = string.replace(line,"$b",b)
|
||||||
|
line = string.replace(line,"$B",B)
|
||||||
|
line = string.replace(line,"$d",d)
|
||||||
|
line = string.replace(line,"$D",D)
|
||||||
|
line = string.replace(line,"$i",i)
|
||||||
|
line = string.replace(line,"$a",a)
|
||||||
|
line = string.replace(line,"$A",A)
|
||||||
|
line = string.replace(line,"$$",'$')
|
||||||
|
self.text[index].append(line)
|
||||||
|
|
||||||
self.font = self.doc.style_list["Normal"].get_font()
|
self.font = self.doc.style_list["Normal"].get_font()
|
||||||
for line in self.text[index]:
|
for line in self.text[index]:
|
||||||
self.box_width = max(self.box_width,string_width(self.font,line))
|
self.box_width = max(self.box_width,string_width(self.font,line))
|
||||||
@ -165,7 +178,6 @@ class AncestorReport:
|
|||||||
width = 0
|
width = 0
|
||||||
self.filter(self.start,1)
|
self.filter(self.start,1)
|
||||||
|
|
||||||
print self.lines
|
|
||||||
self.height = self.lines*pt2cm(1.2*self.font.get_size())
|
self.height = self.lines*pt2cm(1.2*self.font.get_size())
|
||||||
self.box_width = pt2cm(self.box_width+20)
|
self.box_width = pt2cm(self.box_width+20)
|
||||||
|
|
||||||
@ -340,14 +352,16 @@ def on_save_clicked(obj):
|
|||||||
paper = paper_obj.get_data("i")
|
paper = paper_obj.get_data("i")
|
||||||
orien_obj = topDialog.get_widget("orientation").get_menu().get_active()
|
orien_obj = topDialog.get_widget("orientation").get_menu().get_active()
|
||||||
orien = orien_obj.get_data("i")
|
orien = orien_obj.get_data("i")
|
||||||
|
|
||||||
max_gen = topDialog.get_widget("generations").get_value_as_int()
|
max_gen = topDialog.get_widget("generations").get_value_as_int()
|
||||||
|
text = topDialog.get_widget("display_text").get_chars(0,-1)
|
||||||
|
text = string.split(text,'\n')
|
||||||
|
|
||||||
|
styles = topDialog.get_widget("style_menu").get_menu().get_active().get_data("d")
|
||||||
item = topDialog.get_widget("format").get_menu().get_active()
|
item = topDialog.get_widget("format").get_menu().get_active()
|
||||||
format = item.get_data("name")
|
format = item.get_data("name")
|
||||||
doc = FindDoc.make_draw_doc(styles,format,paper,orien)
|
doc = FindDoc.make_draw_doc(styles,format,paper,orien)
|
||||||
|
|
||||||
MyReport = AncestorReport(db,active_person,outputName,doc,max_gen)
|
MyReport = AncestorReport(db,text,active_person,outputName,doc,max_gen)
|
||||||
|
|
||||||
MyReport.write_report()
|
MyReport.write_report()
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@
|
|||||||
<widget>
|
<widget>
|
||||||
<class>GtkTable</class>
|
<class>GtkTable</class>
|
||||||
<name>table1</name>
|
<name>table1</name>
|
||||||
<rows>3</rows>
|
<rows>4</rows>
|
||||||
<columns>2</columns>
|
<columns>2</columns>
|
||||||
<homogeneous>False</homogeneous>
|
<homogeneous>False</homogeneous>
|
||||||
<row_spacing>0</row_spacing>
|
<row_spacing>0</row_spacing>
|
||||||
@ -434,6 +434,67 @@
|
|||||||
<yfill>False</yfill>
|
<yfill>False</yfill>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkScrolledWindow</class>
|
||||||
|
<name>scrolledwindow1</name>
|
||||||
|
<height>55</height>
|
||||||
|
<hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
|
||||||
|
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
|
||||||
|
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
|
||||||
|
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
|
||||||
|
<child>
|
||||||
|
<left_attach>1</left_attach>
|
||||||
|
<right_attach>2</right_attach>
|
||||||
|
<top_attach>3</top_attach>
|
||||||
|
<bottom_attach>4</bottom_attach>
|
||||||
|
<xpad>5</xpad>
|
||||||
|
<ypad>5</ypad>
|
||||||
|
<xexpand>False</xexpand>
|
||||||
|
<yexpand>False</yexpand>
|
||||||
|
<xshrink>False</xshrink>
|
||||||
|
<yshrink>False</yshrink>
|
||||||
|
<xfill>True</xfill>
|
||||||
|
<yfill>True</yfill>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkText</class>
|
||||||
|
<name>display_text</name>
|
||||||
|
<tooltip>Allows you to customize the data in the boxes in the report</tooltip>
|
||||||
|
<can_focus>True</can_focus>
|
||||||
|
<editable>True</editable>
|
||||||
|
<text>$n
|
||||||
|
b. $b
|
||||||
|
d. $d</text>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkLabel</class>
|
||||||
|
<name>label16</name>
|
||||||
|
<label>Display Format</label>
|
||||||
|
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||||
|
<wrap>False</wrap>
|
||||||
|
<xalign>1</xalign>
|
||||||
|
<yalign>0</yalign>
|
||||||
|
<xpad>5</xpad>
|
||||||
|
<ypad>5</ypad>
|
||||||
|
<child>
|
||||||
|
<left_attach>0</left_attach>
|
||||||
|
<right_attach>1</right_attach>
|
||||||
|
<top_attach>3</top_attach>
|
||||||
|
<bottom_attach>4</bottom_attach>
|
||||||
|
<xpad>0</xpad>
|
||||||
|
<ypad>0</ypad>
|
||||||
|
<xexpand>False</xexpand>
|
||||||
|
<yexpand>False</yexpand>
|
||||||
|
<xshrink>False</xshrink>
|
||||||
|
<yshrink>False</yshrink>
|
||||||
|
<xfill>True</xfill>
|
||||||
|
<yfill>True</yfill>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
Loading…
Reference in New Issue
Block a user