Change for request 1962
svn: r10559
This commit is contained in:
parent
4524d43b4d
commit
20aac61668
@ -54,6 +54,14 @@ from ReportBase import Report, ReportUtils, MenuReportOptions, \
|
|||||||
from PluginUtils import register_report, EnumeratedListOption, BooleanOption, \
|
from PluginUtils import register_report, EnumeratedListOption, BooleanOption, \
|
||||||
NumberOption, ColourOption, PersonListOption, SurnameColourOption
|
NumberOption, ColourOption, PersonListOption, SurnameColourOption
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Constant options items
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
_COLORS = [ { 'name' : _("B&W outline"), 'value' : "outline" },
|
||||||
|
{ 'name' : _("Coloured outline"), 'value' : "colored" },
|
||||||
|
{ 'name' : _("Colour fill"), 'value' : "filled" }]
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -163,6 +171,15 @@ class FamilyLinesOptions(MenuReportOptions):
|
|||||||
_('The maximum number of children to include.'))
|
_('The maximum number of children to include.'))
|
||||||
menu.add_option(category, 'FLmaxChildren', self.max_children)
|
menu.add_option(category, 'FLmaxChildren', self.max_children)
|
||||||
|
|
||||||
|
color = EnumeratedListOption(_("Graph coloring"), "filled")
|
||||||
|
for i in range( 0, len(_COLORS) ):
|
||||||
|
color.add_item(_COLORS[i]["value"], _COLORS[i]["name"])
|
||||||
|
color.set_help(_("Males will be shown with blue, females "
|
||||||
|
"with red, unless otherwise set above for filled."
|
||||||
|
" If the sex of an individual "
|
||||||
|
"is unknown it will be shown with gray."))
|
||||||
|
menu.add_option(category, "FLcolor", color)
|
||||||
|
|
||||||
# --------------------
|
# --------------------
|
||||||
category = _('Images')
|
category = _('Images')
|
||||||
# --------------------
|
# --------------------
|
||||||
@ -246,6 +263,19 @@ class FamilyLinesReport(Report):
|
|||||||
"""
|
"""
|
||||||
Report.__init__(self, database, options)
|
Report.__init__(self, database, options)
|
||||||
|
|
||||||
|
colored = {
|
||||||
|
'male': 'dodgerblue4',
|
||||||
|
'female': 'deeppink',
|
||||||
|
'unknown': 'black',
|
||||||
|
'family': 'darkgreen'
|
||||||
|
}
|
||||||
|
filled = {
|
||||||
|
'male': 'lightblue',
|
||||||
|
'female': 'lightpink',
|
||||||
|
'unknown': 'lightgray',
|
||||||
|
'family': 'lightyellow'
|
||||||
|
}
|
||||||
|
|
||||||
# initialize several convenient variables
|
# initialize several convenient variables
|
||||||
self.options = options
|
self.options = options
|
||||||
self.db = database
|
self.db = database
|
||||||
@ -291,6 +321,11 @@ class FamilyLinesReport(Report):
|
|||||||
colour = tmp.pop(0)
|
colour = tmp.pop(0)
|
||||||
self.surnameColours[surname] = colour
|
self.surnameColours[surname] = colour
|
||||||
|
|
||||||
|
self.colorize = options.handler.options_dict['FLcolor']
|
||||||
|
if self.colorize == 'colored':
|
||||||
|
self.colors = colored
|
||||||
|
elif self.colorize == 'filled':
|
||||||
|
self.colors = filled
|
||||||
|
|
||||||
def begin_report(self):
|
def begin_report(self):
|
||||||
# inherited method; called by report() in _ReportDialog.py
|
# inherited method; called by report() in _ReportDialog.py
|
||||||
@ -756,13 +791,40 @@ class FamilyLinesReport(Report):
|
|||||||
if imagePath:
|
if imagePath:
|
||||||
label += '</TD></TR></TABLE>'
|
label += '</TD></TR></TABLE>'
|
||||||
|
|
||||||
self.doc.add_node(
|
gender = person.get_gender()
|
||||||
id=person.get_gramps_id(),
|
shape = "box"
|
||||||
label=label,
|
style = ""
|
||||||
shape='box',
|
color = ""
|
||||||
fillcolor=colour,
|
fill = ""
|
||||||
htmloutput=bUseHtmlOutput)
|
if gender == person.MALE:
|
||||||
|
shape = "box"
|
||||||
|
style = "solid"
|
||||||
|
elif gender == person.FEMALE:
|
||||||
|
shape = "box"
|
||||||
|
style = "rounded"
|
||||||
|
else:
|
||||||
|
shape = "hexagon"
|
||||||
|
if self.colorize == 'colored':
|
||||||
|
if gender == person.MALE:
|
||||||
|
color = self.colors['male']
|
||||||
|
elif gender == person.FEMALE:
|
||||||
|
color = self.colors['female']
|
||||||
|
else:
|
||||||
|
color = self.colors['unknown']
|
||||||
|
elif self.colorize == 'filled':
|
||||||
|
if style != "":
|
||||||
|
style += ",filled"
|
||||||
|
fill = colour
|
||||||
|
else:
|
||||||
|
style = "filled"
|
||||||
|
|
||||||
|
self.doc.add_node(id=person.get_gramps_id(),
|
||||||
|
label=label,
|
||||||
|
shape=shape,
|
||||||
|
color=color,
|
||||||
|
style=style,
|
||||||
|
fillcolor=fill,
|
||||||
|
htmloutput=bUseHtmlOutput)
|
||||||
|
|
||||||
def writeFamilies(self):
|
def writeFamilies(self):
|
||||||
|
|
||||||
@ -821,7 +883,16 @@ class FamilyLinesReport(Report):
|
|||||||
if label != '':
|
if label != '':
|
||||||
label += '\\n'
|
label += '\\n'
|
||||||
label += '%s' % childrenStr
|
label += '%s' % childrenStr
|
||||||
self.doc.add_node(fgid, label, "ellipse", "", "filled", self.colourFamilies)
|
|
||||||
|
color = ""
|
||||||
|
fill = ""
|
||||||
|
style = "solid"
|
||||||
|
if self.colorize == 'colored':
|
||||||
|
color = self.colors['family']
|
||||||
|
elif self.colorize == 'filled':
|
||||||
|
fill = self.colourFamilies
|
||||||
|
style = "filled"
|
||||||
|
self.doc.add_node(fgid, label, "ellipse", color, style, fill)
|
||||||
|
|
||||||
|
|
||||||
# now that we have the families written, go ahead and link the parents and children to the families
|
# now that we have the families written, go ahead and link the parents and children to the families
|
||||||
|
Loading…
Reference in New Issue
Block a user