mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 15:27:07 +00:00
For search highlighting, use pango attrlists instead of markup
This commit is contained in:
parent
80263e1416
commit
99c871ba4a
1 changed files with 7 additions and 9 deletions
|
@ -728,23 +728,21 @@ class MessageColumn (TextColumn):
|
||||||
|
|
||||||
def get_data_func (self):
|
def get_data_func (self):
|
||||||
|
|
||||||
|
from pango import AttrList, AttrBackground, AttrForeground
|
||||||
highlight = self.highlight
|
highlight = self.highlight
|
||||||
escape = gobject.markup_escape_text
|
|
||||||
|
|
||||||
def message_data_func (props, value, path):
|
def message_data_func (props, value, path):
|
||||||
|
|
||||||
line_index = path[0]
|
line_index = path[0]
|
||||||
|
props.text = value
|
||||||
if line_index in highlight:
|
if line_index in highlight:
|
||||||
props.text = None
|
|
||||||
start, end = highlight[line_index]
|
start, end = highlight[line_index]
|
||||||
props.markup = escape (value[:start]) + \
|
attrlist = AttrList ()
|
||||||
"<span background='blue' foreground='white'>" + \
|
attrlist.insert (AttrBackground (0, 0, 65535, start, end))
|
||||||
escape (value[start:end]) + \
|
attrlist.insert (AttrForeground (65535, 65535, 65535, start, end))
|
||||||
"</span>" + \
|
props.attributes = attrlist
|
||||||
escape (value[end:])
|
|
||||||
else:
|
else:
|
||||||
props.markup = None
|
props.attributes = None
|
||||||
props.text = value
|
|
||||||
|
|
||||||
return message_data_func
|
return message_data_func
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue