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

Merged
merged 20 commits into from Sep 16, 2016

Conversation

Projects
None yet
4 participants
@michaelDCurran
Contributor

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.

michaelDCurran added some commits Jun 17, 2016

treeInterceptorHandler.RootProxyTextInfo: rewrite constructor and cop…
…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.
textInfos.TextInfo: add a base implementation of focusableNVDAObjectA…
…tStart which just returns the NVDAObject the TextInfo is for (obj).
textInfos.offsets.OffsetsTextInfo: provide fuller implementations of …
…_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.
IAccessible NVDAObject's isPresentableFocusAncestor property: having …
…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.
CursorManager caret movement scripts now will do automatic page turns…
… if the object implements DocumentWithPageTurns.
Support for reading book content in Kindle Reader.
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).
NVDAObjects.behaviors.EditableTextWithAutoSelectDetection.event_caret…
…: 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.
Work arounds for QT application, list and Tree controls now are appli…
…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.
@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?

@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

Contributor

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.

@michaelDCurran

michaelDCurran Aug 31, 2016

Contributor

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.

source/appModules/kindle.py
+ 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)

@jcsteh

jcsteh Aug 24, 2016

Contributor

This can be simplified to just:

return winUser.isWindow(self.rootNVDAObject.windowHandle)

source/appModules/kindle.py
+from scriptHandler import willSayAllResume, isScriptWaiting
+import controlTypes
+import treeInterceptorHandler
+import IAccessibleHandler

This comment has been minimized.

@jcsteh

jcsteh Aug 24, 2016

Contributor

Unused import.

@jcsteh

jcsteh Aug 24, 2016

Contributor

Unused import.

source/appModules/kindle.py
+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.

@jcsteh

jcsteh Aug 24, 2016

Contributor

getNVDAObjectFromEvent is an unused import.

source/treeInterceptorHandler.py
-
- 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.

@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

Contributor

I agree. I'll change that back.

@michaelDCurran

michaelDCurran Aug 31, 2016

Contributor

I agree. I'll change that back.

source/appModules/kindle.py
+
+ 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.

@jcsteh

jcsteh Aug 24, 2016

Contributor

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

source/appModules/kindle.py
+ 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

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

This comment has been minimized.

Show comment
Hide comment
@vgjh2005

vgjh2005 Sep 21, 2016

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

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

@jcsteh

This comment has been minimized.

Show comment
Hide comment
@jcsteh

jcsteh Sep 21, 2016

Contributor
Contributor

jcsteh commented Sep 21, 2016

jcsteh added a commit that referenced this pull request Dec 2, 2016

What's New: Remove mention of support for the upcoming version of the…
… 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