* src/Config/_GrampsGconfKeys.py (get_default): Allow other types.

* src/GrampsCfg.py (reset_colors): Emit color-set signal to
	trigget hex text updates.


svn: r6643
This commit is contained in:
Alex Roitman 2006-05-13 05:53:47 +00:00
parent 7244395156
commit 04f07a9290
3 changed files with 19 additions and 5 deletions

View File

@ -9,6 +9,9 @@
2006-05-12 Alex Roitman <shura@gramps-project.org>
* data/gramps.schemas.in: Brighter colors to use with foreground.
* src/GrampsCfg.py (add_color): Update text label after color change.
* src/Config/_GrampsGconfKeys.py (get_default): Allow other types.
* src/GrampsCfg.py (reset_colors): Emit color-set signal to
trigget hex text updates.
2006-05-12 Don Allingham <don@gramps-project.org>
* src/ViewManager.py: move ScratchPad to Edit

View File

@ -150,6 +150,15 @@ def set_string(key,val,test_func=None):
def sync():
client.suggest_sync()
def get_default(key):
def get_default(key,sample=''):
token = "/apps/gramps/%s/%s" % (key[0],key[1])
return client.get_default_from_schema(token).get_string()
value = client.get_default_from_schema(token)
if value == None:
raise Errors.GConfSchemaError("No default value for key "+key[1])
if type(sample) in (str,unicode):
return value.get_string()
elif type(sample) == int:
return value.get_int()
elif type(sample) == bool:
return value.get_bool()
return None

View File

@ -189,9 +189,9 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
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)
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)
@ -200,6 +200,8 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
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))
for widget in [self.comp_color,self.todo_color,self.custom_color]:
widget.emit('color-set')
def add_formats_panel(self):
table = gtk.Table(3,8)