Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions source/NVDAObjects/UIA/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@
from UIAUtils import *
from NVDAObjects.window import Window
from NVDAObjects import NVDAObjectTextInfo, InvalidNVDAObject
from NVDAObjects.behaviors import ProgressBar, EditableTextWithoutAutoSelectDetection, Dialog, Notification, EditableTextWithSuggestions
from NVDAObjects.behaviors import (
ProgressBar,
EditableTextWithoutAutoSelectDetection,
EditableTextWithAutoSelectDetection,
Dialog,
Notification,
EditableTextWithSuggestions
)
import braille
from locationHelper import RectLTWH
import ui
Expand Down Expand Up @@ -867,7 +874,10 @@ def findOverlayClasses(self,clsList):
winConsoleUIA.findExtraOverlayClasses(self, clsList)
# Add editableText support if UIA supports a text pattern
if self.TextInfo==UIATextInfo:
clsList.append(EditableTextWithoutAutoSelectDetection)
if UIAHandler.autoSelectDetectionAvailable:
clsList.append(EditableTextWithAutoSelectDetection)
else:
clsList.append(EditableTextWithoutAutoSelectDetection)

clsList.append(UIA)

Expand Down Expand Up @@ -1451,7 +1461,7 @@ def event_UIA_elementSelected(self):
self.event_stateChange()

def event_valueChange(self):
if isinstance(self, EditableTextWithoutAutoSelectDetection):
if issubclass(self.TextInfo, UIATextInfo):
return
return super(UIA, self).event_valueChange()

Expand Down
11 changes: 7 additions & 4 deletions source/NVDAObjects/window/winword.py
Original file line number Diff line number Diff line change
Expand Up @@ -1431,6 +1431,13 @@ def script_changeLineSpacing(self,gesture):
# Translators: a message when switching to 1.5 line spaceing in Microsoft word
ui.message(_("1.5 line spacing"))

def initOverlayClass(self):
if isinstance(self, EditableTextWithoutAutoSelectDetection):
self.bindGesture("kb:alt+shift+home", "caret_changeSelection")
self.bindGesture("kb:alt+shift+end", "caret_changeSelection")
self.bindGesture("kb:alt+shift+pageUp", "caret_changeSelection",)
self.bindGesture("kb:alt+shift+pageDown", "caret_changeSelection",)

__gestures = {
"kb:control+[":"increaseDecreaseFontSize",
"kb:control+]":"increaseDecreaseFontSize",
Expand Down Expand Up @@ -1458,10 +1465,6 @@ def script_changeLineSpacing(self,gesture):
"kb:control+5":"changeLineSpacing",
"kb:tab": "tab",
"kb:shift+tab": "tab",
"kb:alt+shift+home":"caret_changeSelection",
"kb:alt+shift+end":"caret_changeSelection",
"kb:alt+shift+pageUp":"caret_changeSelection",
"kb:alt+shift+pageDown":"caret_changeSelection",
"kb:control+pageUp": "caret_moveByLine",
"kb:control+pageDown": "caret_moveByLine",
}
Expand Down
5 changes: 0 additions & 5 deletions source/UIABrowseMode.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,3 @@ def __contains__(self,obj):
except LookupError:
return False
return True

def event_caret(self,obj,nextHandler):
pass


32 changes: 23 additions & 9 deletions source/_UIAHandler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#_UIAHandler.py
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2011-2019 NV Access Limited, Joseph Lee, Babbage B.V.
#Copyright (C) 2011-2019 NV Access Limited, Joseph Lee, Babbage B.V., Leonard de Ruijter
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.

Expand Down Expand Up @@ -144,16 +144,20 @@
UIA_SelectionItem_ElementAddedToSelectionEventId:"stateChange",
UIA_SelectionItem_ElementRemovedFromSelectionEventId:"stateChange",
#UIA_MenuModeEndEventId:"menuModeEnd",
#UIA_Text_TextSelectionChangedEventId:"caret",
UIA_ToolTipOpenedEventId:"UIA_toolTipOpened",
#UIA_AsyncContentLoadedEventId:"documentLoadComplete",
#UIA_ToolTipClosedEventId:"hide",
UIA_Window_WindowOpenedEventId:"UIA_window_windowOpen",
UIA_SystemAlertEventId:"UIA_systemAlert",
}

autoSelectDetectionAvailable = False
if winVersion.isWin10():
UIAEventIdsToNVDAEventNames[UIA_Text_TextChangedEventId] = "textChange"
UIAEventIdsToNVDAEventNames.update({
UIA_Text_TextChangedEventId:"textChange",
UIA_Text_TextSelectionChangedEventId:"caret",
})
autoSelectDetectionAvailable = True

ignoreWinEventsMap = {
UIA_AutomationPropertyChangedEventId: list(UIAPropertyIdsToNVDAEventNames.keys()),
Expand Down Expand Up @@ -272,20 +276,25 @@ def IUIAutomationEventHandler_HandleAutomationEvent(self,sender,eventID):
NVDAEventName=UIAEventIdsToNVDAEventNames.get(eventID,None)
if not NVDAEventName:
return
if not self.isNativeUIAElement(sender):
focus=api.getFocusObject()
import NVDAObjects.UIA
if (
isinstance(focus, NVDAObjects.UIA.UIA)
and self.clientObject.compareElements(focus.UIAElement, sender)
):
pass
elif not self.isNativeUIAElement(sender):
return
window=self.getNearestWindowHandle(sender)
if window and not eventHandler.shouldAcceptEvent(NVDAEventName,windowHandle=window):
return
import NVDAObjects.UIA
obj=NVDAObjects.UIA.UIA(UIAElement=sender)
if (
not obj
or (NVDAEventName=="gainFocus" and not obj.shouldAllowUIAFocusEvent)
or (NVDAEventName=="liveRegionChange" and not obj._shouldAllowUIALiveRegionChangeEvent)
):
return
focus=api.getFocusObject()
if obj==focus:
obj=focus
eventHandler.queueEvent(NVDAEventName,obj)
Expand Down Expand Up @@ -327,16 +336,21 @@ def IUIAutomationPropertyChangedEventHandler_HandlePropertyChangedEvent(self,sen
NVDAEventName=UIAPropertyIdsToNVDAEventNames.get(propertyId,None)
if not NVDAEventName:
return
if not self.isNativeUIAElement(sender):
focus = api.getFocusObject()
import NVDAObjects.UIA
if (
isinstance(focus, NVDAObjects.UIA.UIA)
and self.clientObject.compareElements(focus.UIAElement, sender)
):
pass
elif not self.isNativeUIAElement(sender):
return
window=self.getNearestWindowHandle(sender)
if window and not eventHandler.shouldAcceptEvent(NVDAEventName,windowHandle=window):
return
import NVDAObjects.UIA
obj=NVDAObjects.UIA.UIA(UIAElement=sender)
if not obj:
return
focus=api.getFocusObject()
if obj==focus:
obj=focus
eventHandler.queueEvent(NVDAEventName,obj)
Expand Down