From 09806437b8e38542f4558e3f367181baea49e43b Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Wed, 5 Sep 2012 18:36:15 +0000 Subject: [PATCH] Fanchart: allow reorder of background combo, default color as gradient svn: r20334 --- src/gui/widgets/fanchart.py | 3 ++- src/plugins/view/fanchartview.py | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/gui/widgets/fanchart.py b/src/gui/widgets/fanchart.py index 86a39cbaf..8784c7706 100644 --- a/src/gui/widgets/fanchart.py +++ b/src/gui/widgets/fanchart.py @@ -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) diff --git a/src/plugins/view/fanchartview.py b/src/plugins/view/fanchartview.py index 210384692..20678ff1e 100644 --- a/src/plugins/view/fanchartview.py +++ b/src/plugins/view/fanchartview.py @@ -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):