[nvda-addons] Re: Capturing changes to screen review text

  • From: James Teh <jamie@xxxxxxxxxxxx>
  • To: nvda-addons@xxxxxxxxxxxxx
  • Date: Mon, 9 Jan 2017 07:54:51 +1000

There's actually a base class which handles this kind of thing:
NVDAObjects.window.DisplayModelLiveText. You want to make sure that gets
used as an overlay class for your "unknown" chat log object. Then, at some
appropriate point, you fetch that object and call its startMonitoring
method. Henceforth, any new text added to the control will be reported.
Once you're done monitoring, you call its stopMonitoring method.

The big question is when is appropriate to start and stop monitoring. You
could do this whenever the app module gains and loses focus. In the mirc
app module, we do it whenever the input area gains or loses focus, which I
feel is most appropriate since it really shouldn't be reporting output text
while you're in menus, a dialog or similar. That requires a bit more work,
though. See the mirc app module for how it's done.

Jamie

On Mon, Jan 9, 2017 at 3:19 AM, James Scholes <james@xxxxxxxxxxxxx> wrote:

Hi all,

I'm working with an application which is somewhat accessible, but
requires a lot of screen review usage to operate as the controls are all
seen as "unknown" by NVDA.  One of these controls is a chat log of
sorts, and the text changes frequently.  NVDA sees these changes, and
the text can be reviewed using screen review.  My questions:

1. How do I get access to the screen review text from an app module?  To
get access to a TextInfo object, I've tried:

textinfo, obj = review.getScreenPosition(api.getNavigatorObject())
text = textinfo.getTextInChunks(textInfos.UNIT_LINE)

But I get:

AttributeError: 'NoneType' object has no attribute 'location'

2. Once I've captured the text, which NVDA event should I use to be
notified of changes to it?  Whenever a line is added, I want to parse it
and then speak some information to the user.

Thanks.
--
James Scholes
http://twitter.com/JamesScholes
----------------------------------------------------------------
NVDA add-ons: A list to discuss add-on code enhancements and for reporting
bugs.

Community addons are available from: http://addons.nvda-project.org
To send a message to the list: nvda-addons@xxxxxxxxxxxxx
To change your list settings/unsubscribe: //www.freelists.org/list/
nvda-addons
To contact list moderators: nvda-addons-moderators@xxxxxxxxxxxxx

Other related posts: