Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion source/NVDAObjects/IAccessible/sysTreeView32.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import speech
import UIAHandler
from . import IAccessible
if UIAHandler.isUIAAvailable: from ..UIA import UIA
from ..UIA import UIA
from .. import NVDAObject
from logHandler import log
import watchdog
Expand Down
8 changes: 4 additions & 4 deletions source/NVDAObjects/UIA/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _get_controlFieldNVDAObjectClass(self):
UIAHandler.UIA_AriaPropertiesPropertyId,
UIAHandler.UIA_LevelPropertyId,
UIAHandler.UIA_IsEnabledPropertyId,
} if UIAHandler.isUIAAvailable else set()
}

def _get__controlFieldUIACacheRequest(self):
""" The UIA cacheRequest object that will be used when fetching all UIA elements needed when generating control fields for this TextInfo's content."""
Expand All @@ -108,7 +108,7 @@ def _get__controlFieldUIACacheRequest(self):
UIAHandler.TextUnit_Format,
UIAHandler.TextUnit_Word,
UIAHandler.TextUnit_Character
] if UIAHandler.isUIAAvailable else []
]

def find(self,text,caseSensitive=False,reverse=False):
tempRange=self._rangeObj.clone()
Expand Down Expand Up @@ -379,7 +379,7 @@ def _get_bookmark(self):
UIAHandler.UIA_TabItemControlTypeId,
UIAHandler.UIA_TextControlTypeId,
UIAHandler.UIA_SplitButtonControlTypeId
} if UIAHandler.isUIAAvailable else None
}


def _getControlFieldForObject(self, obj,isEmbedded=False,startOfNode=False,endOfNode=False):
Expand Down Expand Up @@ -1186,7 +1186,7 @@ def _get_keyboardShortcut(self):
UIAHandler.UIA_IsSelectionItemPatternAvailablePropertyId,
UIAHandler.UIA_IsEnabledPropertyId,
UIAHandler.UIA_IsOffscreenPropertyId,
} if UIAHandler.isUIAAvailable else set()
}

def _get_states(self):
states=set()
Expand Down
18 changes: 5 additions & 13 deletions source/UIAHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,24 @@
from comtypes import COMError
import config
from logHandler import log
# Maintain backwards compatibility: F403 (unable to detect undefined names) flake8 warning.
from _UIAHandler import * # noqa: F403

# Make the _UIAHandler._isDebug function available to this module,
# ignoring the fact that it is not used here directly.
from _UIAHandler import _isDebug # noqa: F401

handler=None
isUIAAvailable=False

if config.conf and config.conf["UIA"]["enabled"]:
# Because Windows 7 SP1 (NT 6.1) or later is supported, just assume UIA can be used unless told otherwise.
try:
from _UIAHandler import *
isUIAAvailable=True
except ImportError:
log.debugWarning("Unable to import _UIAHandler",exc_info=True)
pass

def initialize():
global handler
if not isUIAAvailable:
raise NotImplementedError
if not config.conf["UIA"]["enabled"]:
raise RuntimeError("UIA forcefully disabled in configuration")
try:
handler=UIAHandler()
except COMError:
handler=None
raise RuntimeError("UIA not available")
raise

def terminate():
global handler
Expand Down
24 changes: 12 additions & 12 deletions source/appModules/logonui.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
import appModuleHandler
import eventHandler
import UIAHandler
if UIAHandler.isUIAAvailable:
from NVDAObjects.UIA import UIA
from NVDAObjects.UIA import UIA

"""App module for the Windows Logon screen
"""
Expand All @@ -35,16 +34,17 @@ def event_gainFocus(self):

return super(LogonDialog, self).event_gainFocus()

if UIAHandler.isUIAAvailable:
class Win8PasswordField(UIA):

#This UIA object has no invoke pattern, at least set focus.
# #6024: Affects both Windows 8.x and 10.
def doAction(self,index=None):
if not index:
self.setFocus()
else:
super(Win8PasswordField,self).doAction(index)
class Win8PasswordField(UIA):

# This UIA object has no invoke pattern, at least set focus.
# #6024: Affects both Windows 8.x and 10.
def doAction(self, index=None):
if not index:
self.setFocus()
else:
super().doAction(index)


class XPPasswordField(IAccessible):

Expand Down Expand Up @@ -82,7 +82,7 @@ def event_NVDAObject_init(self, obj):
def chooseNVDAObjectOverlayClasses(self, obj, clsList):
windowClass = obj.windowClassName

if UIAHandler.isUIAAvailable:
if UIAHandler.handler:
if isinstance(obj,UIA) and obj.UIAElement.cachedClassName in ("TouchEditInner", "PasswordBox") and obj.role==controlTypes.ROLE_EDITABLETEXT:
clsList.insert(0,Win8PasswordField)
# #6010: Allow Windows 10 version to be recognized as well.
Expand Down
4 changes: 2 additions & 2 deletions source/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,8 @@ def handlePowerStatusChange(self):
log.debug("Initializing UIA support")
try:
UIAHandler.initialize()
except NotImplementedError:
log.warning("UIA not available")
except RuntimeError:
log.warning("UIA disabled in configuration")
except:
log.error("Error initializing UIA support", exc_info=True)
import IAccessibleHandler
Expand Down