Commit c67e2f9d authored by Samuel Thibault's avatar Samuel Thibault

event_monitor: Highlight region-changed events from screen reader

parent 4ebca6ca
......@@ -22,6 +22,7 @@ import os.path
import gettext, os, sys, locale
from accerciser.plugin import ViewportPlugin
from accerciser.i18n import _, N_, DOMAIN
from accerciser import node
UI_FILE = os.path.join(os.path.dirname(__file__),
'event_monitor.ui')
......@@ -334,6 +335,18 @@ class EventMonitor(ViewportPlugin):
hyperlink = self._createHyperlink(event.sender)
self._writeText(str(event.sender), hyperlink)
self._writeText('\n')
if event.type == "screen-reader:region-changed":
try:
text = event.source.queryText()
(x, y, width, height) = text.getRangeExtents(event.detail1, event.detail2, pyatspi.DESKTOP_COORDS)
if width > 0 and height > 0:
ah = node._HighLight(x, y, width, height,
node.FILL_COLOR, node.FILL_ALPHA,
node.BORDER_COLOR, node.BORDER_ALPHA,
2.0, 0)
ah.highlight(node.HL_DURATION)
except:
pass
def _writeText(self, text, *tags):
'''
......
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