Topics

How to silence reading control types.

Pawel Urbanski
 

Dear Everyone,
Since I am not that deeply knowledgeable about NVDA
s internals, I reached out to some of you with a few questions. I read
through the sources before, but could not find the way to achieve the
following:
How can I silence speaking the control type?

I'm developing/improving an add-on for a few IDEs. All of them provide
code completion.
When completion popup shows up its type is spoken. After completion is
inserted the role for editable text is spoken as well.
I tried the following on the level of the app module or custom control
class and events, but it did not work in certain cases:
controlTypes.silentRolesOnFocus.add(ControlTypes.ROLE_EDITABLETEXT)
controlTypes.silentValuesForRoles.add(controlTypes.ROLE_EDITABLETEXT)

It seems to me that the control label for role is read first. While I
managed to discard useless states, which add the noise, I cannot make
the roles silent.

The only hack, which I would like to avoid, but works is to rename the
type role labels:
controlTypes.roleLabels[controlTypes.ROLE_EDITABLETEXT] = "" # Empty string.
I rename it back to the standard: "edit" in the terminate method call.

Any help or hints will be more than appriciated...

All the best...

Pawel Urbanski
 

Hi Everyone,
I finally, after lots of digging found a workaround:
Using: roleText and roleTextBraille to overwrite the properties, set
them before calling super() method on the subclassed control.

The idea for the core dev team:
Rename those properties to:
roleLabelSpeech and roleLabelBraille - respectively.
There are only around 50 calls to current roleText and roleTextBraille
properties in the NVDA's codebase - easy to refactor.

The 'label' name gives a stronger hint to its purpose. At first I
thought that it is some kind of text returned and not useful for
setting values.
Marking them as 'speech' and 'braille' gives a hint to the effect. We
currently have the roleTextBraille variant, which somehow hints that
both are related.
Additionally, some kind of class constants as: 'ROLE_SILENT' and
'ROLE_HIDDEN' would be useful to skip speaking or displaying when set
as part of some event procedure.

I could try to create a branch and try to hack something...

Best,
Pawel

On 25/02/2020, Pawel Urbanski via Groups.Io
<pawel=e-urbanski.com@groups.io> wrote:
Dear Everyone,
Since I am not that deeply knowledgeable about NVDA
s internals, I reached out to some of you with a few questions. I read
through the sources before, but could not find the way to achieve the
following:
How can I silence speaking the control type?

I'm developing/improving an add-on for a few IDEs. All of them provide
code completion.
When completion popup shows up its type is spoken. After completion is
inserted the role for editable text is spoken as well.
I tried the following on the level of the app module or custom control
class and events, but it did not work in certain cases:
controlTypes.silentRolesOnFocus.add(ControlTypes.ROLE_EDITABLETEXT)
controlTypes.silentValuesForRoles.add(controlTypes.ROLE_EDITABLETEXT)

It seems to me that the control label for role is read first. While I
managed to discard useless states, which add the noise, I cannot make
the roles silent.

The only hack, which I would like to avoid, but works is to rename the
type role labels:
controlTypes.roleLabels[controlTypes.ROLE_EDITABLETEXT] = "" # Empty
string.
I rename it back to the standard: "edit" in the terminate method call.

Any help or hints will be more than appriciated...

All the best...