From 3c88cb4ce50f297261fc74077f1973bb8f0ab9ca Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Wed, 24 May 2006 04:49:05 +0000 Subject: [PATCH] 2006-05-23 Don Allingham * src/DataViews/_RelationView.py: make shading optional * src/GrampsCfg.py: make shading optional * src/Config/_GrampsConfigKeys.py: make shading optional * data/gramps.schemas.in: make shading optional svn: r6769 --- gramps2/ChangeLog | 6 ++++++ gramps2/data/gramps.schemas.in | 12 +++++++++++ gramps2/src/Config/_GrampsConfigKeys.py | 2 ++ gramps2/src/DataViews/_RelationView.py | 27 +++++++++++++++++++------ gramps2/src/GrampsCfg.py | 1 + 5 files changed, 42 insertions(+), 6 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 7b6ae1ea0..48fbf2ff6 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,9 @@ +2006-05-23 Don Allingham + * src/DataViews/_RelationView.py: make shading optional + * src/GrampsCfg.py: make shading optional + * src/Config/_GrampsConfigKeys.py: make shading optional + * data/gramps.schemas.in: make shading optional + 2006-05-23 Alex Roitman * src/GrampsDb/_GrampsBSDDB.py (gramps_upgrade_9): Upgrade LdsOrd. diff --git a/gramps2/data/gramps.schemas.in b/gramps2/data/gramps.schemas.in index 86db99a2b..ddc5033ec 100644 --- a/gramps2/data/gramps.schemas.in +++ b/gramps2/data/gramps.schemas.in @@ -3,6 +3,18 @@ + + /schemas/apps/gramps/preferences/relation-shade + /apps/gramps/preferences/relation-shade + gramps + bool + 1 + + Use shading to highlight data in Relationship View + If True, shading is used to highlight data in Relationship View + + + /schemas/apps/gramps/preferences/online-maps /apps/gramps/preferences/online-maps diff --git a/gramps2/src/Config/_GrampsConfigKeys.py b/gramps2/src/Config/_GrampsConfigKeys.py index 0095f6c0c..0d049da31 100644 --- a/gramps2/src/Config/_GrampsConfigKeys.py +++ b/gramps2/src/Config/_GrampsConfigKeys.py @@ -1,3 +1,4 @@ +RELATION_SHADE = ('preferences','relation-shade', 0) ONLINE_MAPS = ('preferences','online-maps', 0) FAMILY_DETAILS = ('preferences','family-details', 0) COMPLETE_COLOR = ('preferences','complete-color', 2) @@ -53,6 +54,7 @@ WEBSITE_DIRECTORY = ('paths','website-directory', 2) default_value = { + RELATION_SHADE : True, ONLINE_MAPS : False, FAMILY_DETAILS : True, COMPLETE_COLOR : '#008b00', diff --git a/gramps2/src/DataViews/_RelationView.py b/gramps2/src/DataViews/_RelationView.py index 20dd43fbe..dbad67d24 100644 --- a/gramps2/src/DataViews/_RelationView.py +++ b/gramps2/src/DataViews/_RelationView.py @@ -90,8 +90,17 @@ class RelationshipView(PageView.PersonNavView): self.show_details = Config.get(Config.FAMILY_DETAILS) self.connect_to_db(dbstate.db) self.redrawing = False + self.use_shade = Config.get(Config.RELATION_SHADE) self.color = gtk.TextView().style.white + #self.color = gtk.Label().style.light[gtk.STATE_NORMAL] self.child = None + Config.client.notify_add("/apps/gramps/preferences/relation-shade", + self.shade_update) + + def shade_update(self, client, cnxn_id, entry, data): + self.use_shade = Config.get(Config.RELATION_SHADE) + self.uistate.modify_statusbar() + self.redraw() def build_tree(self): if self.active: @@ -361,7 +370,8 @@ class RelationshipView(PageView.PersonNavView): table.attach(hbox, 0, 2, 0, 1) eventbox = gtk.EventBox() - eventbox.modify_bg(gtk.STATE_NORMAL, self.color) + if self.use_shade: + eventbox.modify_bg(gtk.STATE_NORMAL, self.color) table.attach(eventbox, 1, 2, 1, 2) subtbl = gtk.Table(3, 3) subtbl.set_col_spacings(12) @@ -539,7 +549,8 @@ class RelationshipView(PageView.PersonNavView): label = _("Siblings") if child_list: eventbox = gtk.EventBox() - eventbox.modify_bg(gtk.STATE_NORMAL, self.color) + if self.use_shade: + eventbox.modify_bg(gtk.STATE_NORMAL, self.color) vbox = gtk.VBox() label_cell = self.build_label_cell(_('Siblings')) label_cell.set_alignment(0,0) @@ -576,7 +587,8 @@ class RelationshipView(PageView.PersonNavView): if handle: link_label = GrampsWidgets.LinkLabel(self.get_name(handle, True), self.button_press, handle) - link_label.modify_bg(gtk.STATE_NORMAL, self.color) + if self.use_shade: + link_label.modify_bg(gtk.STATE_NORMAL, self.color) button = GrampsWidgets.IconButton(self.edit_button_press, handle) vbox.pack_start(GrampsWidgets.LinkBox(link_label, button)) else: @@ -591,7 +603,8 @@ class RelationshipView(PageView.PersonNavView): vbox.pack_start(GrampsWidgets.BasicLabel(value)) eventbox = gtk.EventBox() - eventbox.modify_bg(gtk.STATE_NORMAL, self.color) + if self.use_shade: + eventbox.modify_bg(gtk.STATE_NORMAL, self.color) eventbox.add(vbox) self.attach.attach(eventbox, _PDATA_START, _PDATA_STOP, @@ -610,7 +623,8 @@ class RelationshipView(PageView.PersonNavView): def write_child(self, vbox, handle): link_label = GrampsWidgets.LinkLabel(self.get_name(handle, True), self.button_press, handle) - link_label.modify_bg(gtk.STATE_NORMAL, self.color) + if self.use_shade: + link_label.modify_bg(gtk.STATE_NORMAL, self.color) link_label.set_padding(3, 0) button = GrampsWidgets.IconButton(self.edit_button_press, handle) vbox.pack_start(GrampsWidgets.LinkBox(link_label, button)) @@ -720,7 +734,8 @@ class RelationshipView(PageView.PersonNavView): child_list = family.get_child_ref_list() if child_list: eventbox = gtk.EventBox() - eventbox.modify_bg(gtk.STATE_NORMAL, self.color) + if self.use_shade: + eventbox.modify_bg(gtk.STATE_NORMAL, self.color) vbox = gtk.VBox() label_cell = self.build_label_cell(_('Children')) label_cell.set_alignment(0,0) diff --git a/gramps2/src/GrampsCfg.py b/gramps2/src/GrampsCfg.py index 17d606b2a..2949b089b 100644 --- a/gramps2/src/GrampsCfg.py +++ b/gramps2/src/GrampsCfg.py @@ -269,6 +269,7 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): self.add_checkbox(table, _('Enable spelling checker'), 1, Config.SPELLCHECK) self.add_checkbox(table, _('Display Tip of the Day'), 2, Config.USE_TIPS) self.add_checkbox(table, _('Download maps online'), 3, Config.ONLINE_MAPS) + self.add_checkbox(table, _('Use shading in Relationship View'), 4, Config.RELATION_SHADE) return table