Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial support for the upcoming version of the Kindle app #6247

Merged
merged 20 commits into from Sep 16, 2016
Merged

Conversation

@michaelDCurran
Copy link
Member

@michaelDCurran michaelDCurran commented Aug 8, 2016

Specifically:
* Browse mode allowing for moving through the content by character, word, line etc with the arrow keys.
* Automatic page turns when reaching the start/end of a page with the arrow keys / Say All.
* Automatic reporting of page labels or numbers if available
* Reporting of current location within a book (including percentage) via NVDA's report location command (NVDA+numpadDelete).

This PR contains various small changes to treeInterceptors and textInfos,handling page turns in braille, and fixes for QT5. Fixes #4300.

…y methods to be abstract enough to not have to specifically handle _rangeObj. _rangeObj only exists for certain TextInfos (UIA, MS Word, MSHTML) but not IA2Text etc.
…tStart which just returns the NVDAObject the TextInfo is for (obj).
…_getNVDAObjectFromOffset which returns the NVDAObject the textInfo is for, and _getOffsetFromNVDAObject which if given the textInfo's object, returns the offset from 0 to story length.
…an MSAA role of client and a sysmenu should not be enough to force this to True. Rather it should also have event_objectID of client and a childID of 0, explicitly meaning this is the client root of the window.
… if the object implements DocumentWithPageTurns.
Specifically:
* Browse mode allowing for moving through the content by character, word, line etc with the arrow keys.
* Automatic page turns when reaching the start/end of a page with the arrow keys / Say All.
* Automatic reporting of page labels or numbers if available
* Reporting of current location within a book (including percentage) via NVDA's report location command (NVDA+numpadDelete).
…: only detect possible selection changes if there is no pending focus event. Some frameworks such as QT clear the selection in an edit field before moving focus away.
…ed to QT5.

qt.Container: shouldAllowIAccessibleFocusEvent should always be true if there is an activeChild. QT5 does not set the focused state on the list or an ancestor in this instance. correct.
@@ -1300,7 +1300,7 @@ def event_selectionWithIn(self):

def _get_isPresentableFocusAncestor(self):
IARole = self.IAccessibleRole
if IARole == oleacc.ROLE_SYSTEM_CLIENT and self.windowStyle & winUser.WS_SYSMENU:
if IARole == oleacc.ROLE_SYSTEM_CLIENT and self.event_objectID==winUser.OBJID_CLIENT and self.event_childID==0 and self.windowStyle & winUser.WS_SYSMENU:

This comment has been minimized.

@jcsteh

jcsteh Aug 24, 2016
Contributor

I think we should have a comment in this block explaining this, as it's a bit obscure. Something like this:

# This is the root object of a top level window.
# #4300: We check the object and child ids as well because there can be "clients" other than the root.

def copy(self):
return self.__class__(self.obj,None,_rangeObj=self.innerTextInfo._rangeObj)
innerCopy=self.innerTextInfo.copy()
return self.__class__(self.obj,innerCopy)

def _get__rangeObj(self):
return self.innerTextInfo._rangeObj

def _set__rangeObj(self,r):
self.innerTextInfo._rangeObj=r

This comment has been minimized.

@jcsteh

jcsteh Aug 24, 2016
Contributor

Do we still need this _rangeObj property now that the constructor and copy don't depend on _rageObj?

This comment has been minimized.

@michaelDCurran

michaelDCurran Aug 31, 2016
Author Member

I think so, yes. There may be still code in UIA or MS word browse modes that may depend on accessing it. We should look into removing them if logically possible, but not in this particular PR. The change here was to specifically allow copying with no _rangeObj.

def isAlive(self):
if not winUser.isWindow(self.rootNVDAObject.windowHandle):
return False
return True

This comment has been minimized.

@jcsteh

jcsteh Aug 24, 2016
Contributor

This can be simplified to just:

return winUser.isWindow(self.rootNVDAObject.windowHandle)

from scriptHandler import willSayAllResume, isScriptWaiting
import controlTypes
import treeInterceptorHandler
import IAccessibleHandler

This comment has been minimized.

@jcsteh

jcsteh Aug 24, 2016
Contributor

Unused import.

from browseMode import BrowseModeDocumentTreeInterceptor
import textInfos
from textInfos import DocumentWithPageTurns
from NVDAObjects.IAccessible import IAccessible, IA2TextTextInfo, getNVDAObjectFromEvent

This comment has been minimized.

@jcsteh

jcsteh Aug 24, 2016
Contributor

getNVDAObjectFromEvent is an unused import.


def _get_InnerTextInfoClass(self):
return self.obj.rootNVDAObject.TextInfo
self.InnerTextInfoClass=self.obj.rootNVDAObject.TextInfo

This comment has been minimized.

@jcsteh

jcsteh Aug 24, 2016
Contributor

I'm concerned this will break Word, which seems to set InnerTextInfoClass to WordDocumentTextInfoForTreeInterceptor, which overrides shouldIncludeLayoutTables.

This comment has been minimized.

@michaelDCurran

michaelDCurran Aug 31, 2016
Author Member

I agree. I'll change that back.


def turnPage(self,previous=False):
try:
self.rootNVDAObject.appModule.inPageTurn=True

This comment has been minimized.

@jcsteh

jcsteh Aug 24, 2016
Contributor

Why is this needed? I think we need a comment here, possibly referring to the focus ignorer thingy.

def _get_shouldAllowIAccessibleFocusEvent(self):
if self.appModule.inPageTurn:
return False
return super(PageTurnFocusIgnorer,self).shouldAllowIAccessibleFocusEvent

This comment has been minimized.

@jcsteh

jcsteh Aug 24, 2016
Contributor

Why is this necessary? What extraneous focus gets fired during a page turn? Please comment.

jcsteh added a commit that referenced this pull request Sep 1, 2016
@jcsteh jcsteh merged commit 41136b8 into master Sep 16, 2016
@nvaccessAuto nvaccessAuto added this to the 2016.4 milestone Sep 16, 2016
@jcsteh jcsteh deleted the kindleReader branch Sep 16, 2016
@vgjh2005
Copy link

@vgjh2005 vgjh2005 commented Sep 21, 2016

Hi Mic:
Can you provide the download link of this app? Thanks!

@jcsteh
Copy link
Contributor

@jcsteh jcsteh commented Sep 21, 2016

jcsteh added a commit that referenced this pull request Dec 2, 2016
… Kindle app.

The version of Kindle supported by this code will not be released. Instead, a later version will be released with more features, but this also requires newer NVDA code which will not be included as part of this release.
This older NVDA code won't cause any major problems, but it won't work as expected. Therefore, we shouldn't mention this in the What's New, but there's no need to remove the code at this late stage.
Re #6247.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants