Re: Customize say all

Alberto Buffolino

Il 11/08/2022 11.02, Abdel ha scritto:
There are classes that inherit from the treeInterceptorHandler.TreeInterceptor class that add extra features.
If we stick with this logic, these extra features are not considered and we always extend the features present in the treeInterceptorHandler.TreeInterceptor class.
Hi Abdel,
I think it's exactly my problem, but with TextInfo.
Let it be clear that we just discuss about coding and object oriented programming, not about personal solutions if they work.
Anyway, I discovered in last days I have messed up the NVDA object and its TextInfo instance, and for the moment I partially solved operating over TextInfo instance only, and patching the _getTextRange method with a new module method, so:
originalFunc = None

def getPartialObj(obj):
global originalFunc
originalFunc = obj._getTextRange
obj._getTextRange = _getPartialTextRange
return obj

def _getPartialTextRange(self, *args, **kwargs):
tempText = originalFunc(self, *args, **kwargs)"TempText: %s"%tempText)
newText = ' '.join(filter(lambda i: len(i)>=4, tempText.split(" ")))"NewText: %s"%newText)
return newText
It works now, but only in simple text editor like notepad and notepad++. I must study a bit more the various mechanisms involved (getTextWithFields, maybe) to cover also Word and browsers, for example.

Join to automatically receive all group messages.