Commit 239b34f4 authored by Philipp Hörist's avatar Philipp Hörist
Browse files

Dont use deprecated Gdk.Color

parent b86c5afa
......@@ -1253,8 +1253,8 @@ def print_name(self, name, kind, other_tags_for_name, direction_mark='',
def _add_new_colour_tags(self, tag, name):
if self._buffer.get_tag_table().lookup(tag) is not None:
gdk_color = Gdk.Color.from_floats(*text_to_color(name))
self._buffer.create_tag(tag, foreground_gdk=gdk_color)
rgba = Gdk.RGBA(*text_to_color(name))
self._buffer.create_tag(tag, foreground_rgba=rgba)
def print_subject(self, subject, iter_=None):
if subject: # if we have subject, show it too!
......@@ -193,10 +193,11 @@
('font-weight: bold', 'font-style: oblique')[_weight])
def _parse_css_color(color):
if color.startswith('rgb(') and color.endswith(')'):
red, green, blue = [int(c)*257 for c in color[4:-1].split(',')]
return Gdk.Color(red, green, blue)
return Gdk.color_parse(color)
rgba = Gdk.RGBA()
success = rgba.parse(color)
if not success:
log.warning('Can\'t parse color: %s', color)
return rgba
def style_iter(style):
return ([x.strip() for x in item.split(':', 1)] for item in style.split(';')\
......@@ -237,13 +238,13 @@ def _get_points_from_pixels(self, pixels):
def _parse_style_color(tag, value):
color = _parse_css_color(value)
tag.set_property('foreground-gdk', color)
tag.set_property('foreground-rgba', color)
def _parse_style_background_color(tag, value):
color = _parse_css_color(value)
tag.set_property('background-gdk', color)
tag.set_property('paragraph-background-gdk', color)
tag.set_property('background-rgba', color)
tag.set_property('paragraph-background-rgba', color)
def __parse_length_frac_size_allocate(_textview, allocation, frac,
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