Fix default foreground colour in list views for dark themes

Issue #7749.
This commit is contained in:
Nick Hall 2017-12-18 23:39:36 +00:00
parent e74dc2fa8c
commit 6bdac08358
11 changed files with 18 additions and 17 deletions

View File

@ -67,7 +67,7 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext _ = glocale.translation.sgettext
from ..ddtargets import DdTargets from ..ddtargets import DdTargets
from ..plug.quick import create_quickreport_menu, create_web_connect_menu from ..plug.quick import create_quickreport_menu, create_web_connect_menu
from ..utils import is_right_click from ..utils import is_right_click, rgb_to_hex
from ..widgets.interactivesearchbox import InteractiveSearchBox from ..widgets.interactivesearchbox import InteractiveSearchBox
#---------------------------------------------------------------- #----------------------------------------------------------------
@ -281,11 +281,12 @@ class ListView(NavigationView):
function because we don't want to set the color of untagged rows. function because we don't want to set the color of untagged rows.
''' '''
fg_color = model.get_value(iter_, model.color_column()) fg_color = model.get_value(iter_, model.color_column())
#for color errors, typically color column is badly set if not fg_color:
if fg_color: context = self.list.get_style_context()
renderer.set_property('foreground', fg_color) color = context.get_color(Gtk.StateFlags.ACTIVE)
else: fg_color = rgb_to_hex((color.red, color.green, color.blue))
LOG.debug('Bad color set: ' + str(fg_color))
renderer.set_property('foreground', fg_color)
def set_active(self): def set_active(self):
""" """

View File

@ -138,7 +138,7 @@ class CitationBaseModel(object):
tag_handle = data[0] tag_handle = data[0]
cached, tag_color = self.get_cached_value(tag_handle, "TAG_COLOR") cached, tag_color = self.get_cached_value(tag_handle, "TAG_COLOR")
if not cached: if not cached:
tag_color = "#000000000000" tag_color = ""
tag_priority = None tag_priority = None
for handle in data[COLUMN_TAGS]: for handle in data[COLUMN_TAGS]:
tag = self.db.get_tag_from_handle(handle) tag = self.db.get_tag_from_handle(handle)
@ -297,7 +297,7 @@ class CitationBaseModel(object):
tag_handle = data[0] tag_handle = data[0]
cached, tag_color = self.get_cached_value(tag_handle, "TAG_COLOR") cached, tag_color = self.get_cached_value(tag_handle, "TAG_COLOR")
if not cached: if not cached:
tag_color = "#000000000000" tag_color = ""
tag_priority = None tag_priority = None
for handle in data[COLUMN2_TAGS]: for handle in data[COLUMN2_TAGS]:
tag = self.db.get_tag_from_handle(handle) tag = self.db.get_tag_from_handle(handle)

View File

@ -208,7 +208,7 @@ class EventModel(FlatBaseModel):
tag_handle = data[0] tag_handle = data[0]
cached, tag_color = self.get_cached_value(tag_handle, "TAG_COLOR") cached, tag_color = self.get_cached_value(tag_handle, "TAG_COLOR")
if not cached: if not cached:
tag_color = "#000000000000" tag_color = ""
tag_priority = None tag_priority = None
for handle in data[COLUMN_TAGS]: for handle in data[COLUMN_TAGS]:
tag = self.db.get_tag_from_handle(handle) tag = self.db.get_tag_from_handle(handle)

View File

@ -220,7 +220,7 @@ class FamilyModel(FlatBaseModel):
tag_handle = data[0] tag_handle = data[0]
cached, tag_color = self.get_cached_value(tag_handle, "TAG_COLOR") cached, tag_color = self.get_cached_value(tag_handle, "TAG_COLOR")
if not cached: if not cached:
tag_color = "#000000000000" tag_color = ""
tag_priority = None tag_priority = None
for handle in data[13]: for handle in data[13]:
tag = self.db.get_tag_from_handle(handle) tag = self.db.get_tag_from_handle(handle)

View File

@ -187,7 +187,7 @@ class MediaModel(FlatBaseModel):
tag_handle = data[0] tag_handle = data[0]
cached, tag_color = self.get_cached_value(tag_handle, "TAG_COLOR") cached, tag_color = self.get_cached_value(tag_handle, "TAG_COLOR")
if not cached: if not cached:
tag_color = "#000000000000" tag_color = ""
tag_priority = None tag_priority = None
for handle in data[11]: for handle in data[11]:
tag = self.db.get_tag_from_handle(handle) tag = self.db.get_tag_from_handle(handle)

View File

@ -150,7 +150,7 @@ class NoteModel(FlatBaseModel):
tag_handle = data[0] tag_handle = data[0]
cached, value = self.get_cached_value(tag_handle, "TAG_COLOR") cached, value = self.get_cached_value(tag_handle, "TAG_COLOR")
if not cached: if not cached:
tag_color = "#000000000000" tag_color = ""
tag_priority = None tag_priority = None
for handle in data[Note.POS_TAGS]: for handle in data[Note.POS_TAGS]:
tag = self.db.get_tag_from_handle(handle) tag = self.db.get_tag_from_handle(handle)

View File

@ -545,7 +545,7 @@ class PeopleBaseModel(BaseModel):
tag_handle = data[0] tag_handle = data[0]
cached, value = self.get_cached_value(tag_handle, "TAG_COLOR") cached, value = self.get_cached_value(tag_handle, "TAG_COLOR")
if not cached: if not cached:
tag_color = "#000000000000" tag_color = ""
tag_priority = None tag_priority = None
for handle in data[COLUMN_TAGS]: for handle in data[COLUMN_TAGS]:
tag = self.db.get_tag_from_handle(handle) tag = self.db.get_tag_from_handle(handle)

View File

@ -200,7 +200,7 @@ class PlaceBaseModel(object):
tag_handle = data[0] tag_handle = data[0]
cached, value = self.get_cached_value(tag_handle, "TAG_COLOR") cached, value = self.get_cached_value(tag_handle, "TAG_COLOR")
if not cached: if not cached:
tag_color = "#000000000000" tag_color = ""
tag_priority = None tag_priority = None
for handle in data[16]: for handle in data[16]:
tag = self.db.get_tag_from_handle(handle) tag = self.db.get_tag_from_handle(handle)

View File

@ -253,7 +253,7 @@ class RepositoryModel(FlatBaseModel):
tag_handle = data[0] tag_handle = data[0]
cached, tag_color = self.get_cached_value(tag_handle, "TAG_COLOR") cached, tag_color = self.get_cached_value(tag_handle, "TAG_COLOR")
if not cached: if not cached:
tag_color = "#000000000000" tag_color = ""
tag_priority = None tag_priority = None
for handle in data[8]: for handle in data[8]:
tag = self.db.get_tag_from_handle(handle) tag = self.db.get_tag_from_handle(handle)

View File

@ -143,7 +143,7 @@ class SourceModel(FlatBaseModel):
tag_handle = data[0] tag_handle = data[0]
cached, value = self.get_cached_value(tag_handle, "TAG_COLOR") cached, value = self.get_cached_value(tag_handle, "TAG_COLOR")
if not cached: if not cached:
tag_color = "#000000000000" tag_color = ""
tag_priority = None tag_priority = None
for handle in data[11]: for handle in data[11]:
tag = self.db.get_tag_from_handle(handle) tag = self.db.get_tag_from_handle(handle)

View File

@ -897,7 +897,7 @@ class TreeBaseModel(GObject.GObject, Gtk.TreeModel, BaseModel):
# Header rows dont get the foreground color set # Header rows dont get the foreground color set
if col == self.color_column(): if col == self.color_column():
#color must not be utf-8 #color must not be utf-8
return "#000000000000" return ""
# Return the node name for the first column # Return the node name for the first column
if col == 0: if col == 0: