fanchart: configure option to set the duplicate color

svn: r20414
This commit is contained in:
Benny Malengier 2012-09-18 19:51:20 +00:00
parent 59bfeb3e70
commit 7dc043f4a1
3 changed files with 20 additions and 9 deletions

View File

@ -100,12 +100,12 @@ class FanChartDescWidget(FanChartBaseWidget):
See main() of FanChartGramplet for example of model format.
"""
self.set_values(None, 9, BACKGROUND_GRAD_GEN, 'Sans', '#0000FF',
'#FF0000', None, 0.5, FORM_CIRCLE, ANGLE_WEIGHT)
'#FF0000', None, 0.5, FORM_CIRCLE, ANGLE_WEIGHT, '#888a85')
FanChartBaseWidget.__init__(self, dbstate, uistate, callback_popup)
def set_values(self, root_person_handle, maxgen, background,
fontdescr, grad_start, grad_end,
filter, alpha_filter, form, angle_algo):
filter, alpha_filter, form, angle_algo, dupcolor):
"""
Reset the values to be used:
root_person_handle = person to show
@ -114,8 +114,10 @@ class FanChartDescWidget(FanChartBaseWidget):
fontdescr = string describing the font to use
grad_start, grad_end: colors to use for background procedure
filter = the person filter to apply to the people in the chart
alpha = the alpha transparency value (0-1) to apply to filtered out data
alpha_filter = the alpha transparency value (0-1) to apply to filtered out data
form = the FORM_ constant for the fanchart
angle_algo = alorithm to use to calculate the sizes of the boxes
dupcolor = color to use for people or families that occur a second or more time
"""
self.rootpersonh = root_person_handle
self.generations = maxgen
@ -127,6 +129,7 @@ class FanChartDescWidget(FanChartBaseWidget):
self.alpha_filter = alpha_filter
self.form = form
self.anglealgo = angle_algo
self.dupcolor = gui.utils.hex_to_rgb(dupcolor)
def gen_pixels(self):
"""
@ -518,7 +521,7 @@ class FanChartDescWidget(FanChartBaseWidget):
else:
#duplicate color
a = 1
r, g, b = (136, 138, 133)
r, g, b = self.dupcolor #(136, 138, 133)
# If max generation, and they have children:
if (not family and generation == self.generations - 1
and self._have_children(person)):
@ -707,6 +710,6 @@ class FanChartDescGrampsGUI(FanChartGrampsGUI):
self.fan.set_values(root_person_handle, self.maxgen, self.background,
self.fonttype, self.grad_start, self.grad_end,
self.generic_filter, self.alpha_filter, self.form,
self.angle_algo)
self.angle_algo, self.dupcolor)
self.fan.reset()
self.fan.queue_draw()

View File

@ -65,6 +65,7 @@ class FanChartDescGramplet(FanChartDescGrampsGUI, Gramplet):
self.fonttype = 'Sans'
self.grad_start = '#0000FF'
self.grad_end = '#FF0000'
self.dupcolor = '#888A85' #light grey
self.generic_filter = None
self.alpha_filter = 0.2
self.form = FORM_HALFCIRCLE

View File

@ -65,6 +65,7 @@ class FanChartDescView(fanchartdesc.FanChartDescGrampsGUI, NavigationView):
('interface.color-start-grad', '#ef2929'),
('interface.color-end-grad', '#3d37e9'),
('interface.angle-algorithm', fanchartdesc.ANGLE_WEIGHT),
('interface.duplicate-color', '#888a85')
)
def __init__(self, pdata, dbstate, uistate, nav_group=0):
self.dbstate = dbstate
@ -85,6 +86,7 @@ class FanChartDescView(fanchartdesc.FanChartDescGrampsGUI, NavigationView):
self.grad_end = self._config.get('interface.color-end-grad')
self.form = self._config.get('interface.fanview-form')
self.angle_algo = self._config.get('interface.angle-algorithm')
self.dupcolor = self._config.get('interface.duplicate-color')
self.generic_filter = None
self.alpha_filter = 0.2
@ -266,7 +268,7 @@ class FanChartDescView(fanchartdesc.FanChartDescGrampsGUI, NavigationView):
"""
Function that builds the widget in the configuration dialog
"""
nrentry = 7
nrentry = 8
table = Gtk.Table(6, 3)
table.set_border_width(12)
table.set_col_spacings(6)
@ -308,15 +310,17 @@ class FanChartDescView(fanchartdesc.FanChartDescGrampsGUI, NavigationView):
'interface.color-start-grad', col=1)
configdialog.add_color(table, _('End gradient/2nd color'), 4,
'interface.color-end-grad', col=1)
configdialog.add_color(table, _('Color for duplicates'), 5,
'interface.duplicate-color', col=1)
# form of the fan
configdialog.add_combo(table, _('Fan chart type'), 5,
configdialog.add_combo(table, _('Fan chart type'), 6,
'interface.fanview-form',
((fanchart.FORM_CIRCLE, _('Full Circle')),
(fanchart.FORM_HALFCIRCLE, _('Half Circle')),
(fanchart.FORM_QUADRANT, _('Quadrant'))),
callback=self.cb_update_form)
# algo for the fan angle distribution
configdialog.add_combo(table, _('Fan chart distribution'), 6,
configdialog.add_combo(table, _('Fan chart distribution'), 7,
'interface.angle-algorithm',
((fanchartdesc.ANGLE_CHEQUI,
_('Homogeneous children distribution')),
@ -337,6 +341,8 @@ class FanChartDescView(fanchartdesc.FanChartDescGrampsGUI, NavigationView):
self.cb_update_color)
self._config.connect('interface.color-end-grad',
self.cb_update_color)
self._config.connect('interface.duplicate-color',
self.cb_update_color)
def cb_update_maxgen(self, spinbtn, constant):
self.maxgen = spinbtn.get_value_as_int()
@ -370,6 +376,7 @@ class FanChartDescView(fanchartdesc.FanChartDescGrampsGUI, NavigationView):
"""
self.grad_start = self._config.get('interface.color-start-grad')
self.grad_end = self._config.get('interface.color-end-grad')
self.dupcolor = self._config.get('interface.duplicate-color')
self.update()
def cb_update_font(self, obj, constant):