Commit b8715c7f authored by Hugo Sena Ribeiro's avatar Hugo Sena Ribeiro

issue: #icon-tint-Gdk.Color - EmblemCellRenderer crashes if you try to give it...

issue: #icon-tint-Gdk.Color - EmblemCellRenderer crashes if you try to give it a Gdk.Color property; commit: Doc say that if type isnt bool, str, int or float tuple of property must have only 4 items
https://python-gtk-3-tutorial.readthedocs.io/en/latest/objects.html#GObject.GObject.__gproperties__

"First shalt thou take out the Holy Pin.
Then, shalt thou count to Four, no more, no less.
Four shall be the number thou shalt count, and the number of the counting shall be Four.
Five shalt thou not count, nor either count thou Three, excepting that thou then proceed to Four.
Six is right out! Once the number Four, being the fourth number, be reached,
then lobbest thou thy Holy Hand Grenade of Antioch towards thou foe, who being naughty in my sight, shall snuff it."
parent bb173259
......@@ -33,7 +33,7 @@ from meld.vc._vc import ( # noqa: F401
COL_PATH, COL_STATE, COL_TEXT, COL_ICON, COL_TINT, COL_FG, COL_STYLE, \
COL_WEIGHT, COL_STRIKE, COL_END = list(range(10))
COL_TYPES = (str, str, str, str, str, Gdk.RGBA, Pango.Style,
COL_TYPES = (str, str, str, str, Gdk.RGBA, Gdk.RGBA, Pango.Style,
Pango.Weight, bool)
......@@ -146,10 +146,6 @@ class DiffTreeStore(SearchableTreeStore):
self.set_value(it, col_idx(COL_STATE, pane), str(state))
self.set_value(it, col_idx(COL_TEXT, pane), label)
self.set_value(it, col_idx(COL_ICON, pane), icon)
# FIXME: This is horrible, but EmblemCellRenderer crashes
# if you try to give it a Gdk.Color property
if tint:
tint = tint.to_string() if tint else None
self.set_value(it, col_idx(COL_TINT, pane), tint)
fg, style, weight, strike = self.text_attributes[state]
......
......@@ -35,9 +35,9 @@ class EmblemCellRenderer(Gtk.CellRenderer):
str, "Named secondary emblem icon",
"Name for secondary emblem icon to overlay",
None, GObject.ParamFlags.READWRITE),
"icon-tint": (str, "Icon tint",
"icon-tint": (Gdk.RGBA, "Icon tint",
"GDK-parseable color to be used to tint icon",
None, GObject.ParamFlags.READWRITE),
GObject.ParamFlags.READWRITE),
}
icon_cache = {}
......@@ -48,7 +48,6 @@ class EmblemCellRenderer(Gtk.CellRenderer):
self._emblem_name = None
self._secondary_emblem_name = None
self._icon_tint = None
self._tint_color = None
self._state = None
# FIXME: hardcoded sizes
self._icon_size = 16
......@@ -63,11 +62,6 @@ class EmblemCellRenderer(Gtk.CellRenderer):
self._secondary_emblem_name = value
elif pspec.name == "icon-tint":
self._icon_tint = value
if self._icon_tint:
self._tint_color = Gdk.RGBA()
self._tint_color.parse(value)
else:
self._tint_color = None
else:
raise AttributeError("unknown property %s" % pspec.name)
......@@ -108,8 +102,8 @@ class EmblemCellRenderer(Gtk.CellRenderer):
pixbuf.get_width(), pixbuf.get_height())
context.fill()
if self._tint_color:
c = self._tint_color
if self._icon_tint:
c = self._icon_tint
r, g, b = c.red, c.green, c.blue
# Figure out the difference between our tint colour and an
# empirically determined (i.e., guessed) satisfying luma and
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment