diff --git a/ChangeLog b/ChangeLog index e12cb9dc1..5d0582637 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-05-12 Don Allingham + * src/GrampsCfg.py: add revert option for colors + * src/Config/_GrampsGconfKeys.py: added get_default + * src/Config/_GrampsIniKeys.py: added get_default + 2006-05-12 Alex Roitman * data/gramps.schemas.in: Brighter colors to use with foreground. * src/GrampsCfg.py (add_color): Update text label after color change. diff --git a/src/Config/_GrampsGconfKeys.py b/src/Config/_GrampsGconfKeys.py index fe91d1c08..a38294952 100644 --- a/src/Config/_GrampsGconfKeys.py +++ b/src/Config/_GrampsGconfKeys.py @@ -149,3 +149,7 @@ def set_string(key,val,test_func=None): def sync(): client.suggest_sync() + +def get_default(key): + token = "/apps/gramps/%s/%s" % (key[0],key[1]) + return client.get_default_from_schema(token) diff --git a/src/Config/_GrampsIniKeys.py b/src/Config/_GrampsIniKeys.py index 5cf672c8e..1557b90c7 100644 --- a/src/Config/_GrampsIniKeys.py +++ b/src/Config/_GrampsIniKeys.py @@ -245,3 +245,5 @@ def set_string(key, val, test_func=None): def sync(): client.suggest_sync() +def get_default(key): + return default_value[key] diff --git a/src/GrampsCfg.py b/src/GrampsCfg.py index d21c6c479..61aed079c 100644 --- a/src/GrampsCfg.py +++ b/src/GrampsCfg.py @@ -175,11 +175,32 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): table.set_col_spacings(12) table.set_row_spacings(6) - self.add_color(table, _("Complete"), 0, Config.COMPLETE_COLOR) - self.add_color(table, _("ToDo"), 1, Config.TODO_COLOR) - self.add_color(table, _("Custom"), 2, Config.CUSTOM_MARKER_COLOR) + self.comp_color = self.add_color(table, _("Complete"), 0, + Config.COMPLETE_COLOR) + self.todo_color = self.add_color(table, _("ToDo"), 1, + Config.TODO_COLOR) + self.custom_color = self.add_color(table, _("Custom"), 2, + Config.CUSTOM_MARKER_COLOR) + + button = gtk.Button(stock=gtk.STOCK_REVERT_TO_SAVED) + button.connect('clicked', self.reset_colors) + table.attach(button, 1, 2, 3, 4, yoptions=0, xoptions=0) return table + def reset_colors(self, obj): + + def_comp = Config.get_default(Config.COMPLETE_COLOR) + def_todo = Config.get_default(Config.TODO_COLOR) + def_cust = Config.get_default(Config.CUSTOM_MARKER_COLOR) + + Config.set(Config.COMPLETE_COLOR, def_comp) + Config.set(Config.TODO_COLOR, def_todo) + Config.set(Config.CUSTOM_MARKER_COLOR, def_cust) + + self.comp_color.set_color(gtk.gdk.color_parse(def_comp)) + self.todo_color.set_color(gtk.gdk.color_parse(def_todo)) + self.custom_color.set_color(gtk.gdk.color_parse(def_cust)) + def add_formats_panel(self): table = gtk.Table(3,8) table.set_border_width(12) @@ -278,6 +299,7 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): xoptions=gtk.FILL) table.attach(entry, 1, 2, index, index+1, yoptions=0, xoptions=0) table.attach(color_hex_label, 2, 3, index, index+1, yoptions=0) + return entry def update_entry(self, obj, constant): Config.set(constant, unicode(obj.get_text()))