Fanchart: allow reorder of background combo, default color as gradient

svn: r20334
This commit is contained in:
Benny Malengier 2012-09-05 18:36:15 +00:00
parent 0250908e2a
commit 09806437b8
2 changed files with 13 additions and 9 deletions

View File

@ -94,6 +94,7 @@ class FanChartWidget(Gtk.DrawingArea):
BACKGROUND_GENDER = 2
BACKGROUND_WHITE = 3
BACKGROUND_GRAD_GEN = 4
BACKGROUND_GRAD_AGE = 5
GENCOLOR = {
BACKGROUND_SCHEME1: ((255, 63, 0),
(255,175, 15),
@ -171,7 +172,7 @@ class FanChartWidget(Gtk.DrawingArea):
self.center_xy = [0, 0] # distance from center (x, y)
self.center = 50 # pixel radius of center
#default values
self.reset(9, self.BACKGROUND_SCHEME1, True, True, 'Sans', '#0000FF',
self.reset(9, self.BACKGROUND_GRAD_GEN, True, True, 'Sans', '#0000FF',
'#FF0000')
self.set_size_request(120, 120)

View File

@ -60,7 +60,7 @@ class FanChartView(FanChartGrampsGUI, NavigationView):
#settings in the config file
CONFIGSETTINGS = (
('interface.fanview-maxgen', 9),
('interface.fanview-background', 0),
('interface.fanview-background', 4),
('interface.fanview-childrenring', True),
('interface.fanview-radialtext', True),
('interface.fanview-font', 'Sans'),
@ -267,11 +267,11 @@ class FanChartView(FanChartGrampsGUI, NavigationView):
_('Background'),
2, 'interface.fanview-background',
(
(0, _('Color scheme 1')),
(1, _('Color scheme 2')),
(2, _('Gender colors')),
(3, _('White')),
(4, _('Generation based gradient')),
(self.fan.BACKGROUND_GENDER, _('Gender colors')),
(self.fan.BACKGROUND_GRAD_GEN, _('Generation based gradient')),
(self.fan.BACKGROUND_WHITE, _('White')),
(self.fan.BACKGROUND_SCHEME1, _('Color scheme classic report')),
(self.fan.BACKGROUND_SCHEME2, _('Color scheme classic view')),
),
callback=self.cb_update_background)
#colors, stored as hex values
@ -312,8 +312,11 @@ class FanChartView(FanChartGrampsGUI, NavigationView):
def cb_update_background(self, obj, constant):
entry = obj.get_active()
self._config.set(constant, entry)
self.background = int(entry)
Gtk.TreePath.new_from_string('%d' % entry)
val = int(obj.get_model().get_value(
obj.get_model().get_iter_from_string('%d' % entry), 0))
self._config.set(constant, val)
self.background = val
self.update()
def cb_update_childrenring(self, client, cnxn_id, entry, data):