Hilight image links on click
This commit is contained in:
parent
6633e31c37
commit
f6e7fa2982
@ -40,3 +40,11 @@ You can also format <b>bold</b> and <i>italic</i> text as well combinations of <
|
||||
|
||||
Images may be relative to the documentation root directory (<mono>/usr/share/help</mono>) or absolute paths.
|
||||
|
||||
Images look like this:
|
||||
<mono>
|
||||
<img src="/usr/share/logo_login.png"></img>
|
||||
</mono>
|
||||
<img src="/usr/share/logo_login.png"></img>
|
||||
You can also make links out of images, like this:
|
||||
<link target="special:contents"><img src="/usr/share/icons/48/help.png"></img></link>
|
||||
|
||||
|
@ -209,7 +209,10 @@ You can also <link target=\"special:contents\">check the Table of Contents</link
|
||||
r = False
|
||||
if self.down_text and e != self.down_text:
|
||||
for u in self.down_text.tag_group:
|
||||
u.set_font(self.down_font[u])
|
||||
if u.unit_type == 4:
|
||||
u.set_extra('hilight',False)
|
||||
else:
|
||||
u.set_font(self.down_font[u])
|
||||
del self.down_font
|
||||
self.down_text = None
|
||||
self.update_text_buffer()
|
||||
@ -217,9 +220,12 @@ You can also <link target=\"special:contents\">check the Table of Contents</link
|
||||
if e and 'link' in e.extra and e.tag_group:
|
||||
self.down_font = {}
|
||||
for u in e.tag_group:
|
||||
new_font = toaru_fonts.Font(u.font.font_number,u.font.font_size,0xFFFF0000)
|
||||
self.down_font[u] = u.font
|
||||
u.set_font(new_font)
|
||||
if u.unit_type == 4:
|
||||
u.set_extra('hilight',True)
|
||||
else:
|
||||
new_font = toaru_fonts.Font(u.font.font_number,u.font.font_size,0xFFFF0000)
|
||||
self.down_font[u] = u.font
|
||||
u.set_font(new_font)
|
||||
self.update_text_buffer()
|
||||
r = True
|
||||
self.down_text = e
|
||||
@ -233,7 +239,10 @@ You can also <link target=\"special:contents\">check the Table of Contents</link
|
||||
return True
|
||||
elif self.down_text:
|
||||
for u in self.down_text.tag_group:
|
||||
u.set_font(self.down_font[u])
|
||||
if u.unit_type == 4:
|
||||
u.set_extra('hilight',False)
|
||||
else:
|
||||
u.set_font(self.down_font[u])
|
||||
del self.down_font
|
||||
self.down_text = None
|
||||
self.update_text_buffer()
|
||||
|
@ -372,6 +372,10 @@ class TextRegion(object):
|
||||
cr.save()
|
||||
extra = 3
|
||||
cr.translate(self.x + left_align, self.y + current_height + top_align)
|
||||
if 'hilight' in unit.extra and unit.extra['hilight']:
|
||||
cr.rectangle(0,-self.line_height+extra,unit.extra['img'].get_width(),self.line_height)
|
||||
cr.set_source_rgb(1,0,0)
|
||||
cr.fill()
|
||||
cr.rectangle(0,-self.line_height+extra,unit.extra['img'].get_width(),self.line_height)
|
||||
cr.set_source_surface(unit.extra['img'],0,-unit.extra['offset']-self.line_height+extra)
|
||||
cr.fill()
|
||||
|
Loading…
Reference in New Issue
Block a user