Skip to content

Commit 633196b

Browse files
authored
Merge cee6e71 into 3f9f9d4
2 parents 3f9f9d4 + cee6e71 commit 633196b

File tree

5 files changed

+21
-32
lines changed

5 files changed

+21
-32
lines changed

source/NVDAObjects/IAccessible/sysTreeView32.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import speech
1313
import UIAHandler
1414
from . import IAccessible
15-
if UIAHandler.isUIAAvailable: from ..UIA import UIA
15+
from ..UIA import UIA
1616
from .. import NVDAObject
1717
from logHandler import log
1818
import watchdog

source/NVDAObjects/UIA/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def _get_controlFieldNVDAObjectClass(self):
9090
UIAHandler.UIA_AriaPropertiesPropertyId,
9191
UIAHandler.UIA_LevelPropertyId,
9292
UIAHandler.UIA_IsEnabledPropertyId,
93-
} if UIAHandler.isUIAAvailable else set()
93+
}
9494

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

113113
def find(self,text,caseSensitive=False,reverse=False):
114114
tempRange=self._rangeObj.clone()
@@ -379,7 +379,7 @@ def _get_bookmark(self):
379379
UIAHandler.UIA_TabItemControlTypeId,
380380
UIAHandler.UIA_TextControlTypeId,
381381
UIAHandler.UIA_SplitButtonControlTypeId
382-
} if UIAHandler.isUIAAvailable else None
382+
}
383383

384384

385385
def _getControlFieldForObject(self, obj,isEmbedded=False,startOfNode=False,endOfNode=False):
@@ -1186,7 +1186,7 @@ def _get_keyboardShortcut(self):
11861186
UIAHandler.UIA_IsSelectionItemPatternAvailablePropertyId,
11871187
UIAHandler.UIA_IsEnabledPropertyId,
11881188
UIAHandler.UIA_IsOffscreenPropertyId,
1189-
} if UIAHandler.isUIAAvailable else set()
1189+
}
11901190

11911191
def _get_states(self):
11921192
states=set()

source/UIAHandler.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,23 @@
77
from comtypes import COMError
88
import config
99
from logHandler import log
10+
from _UIAHandler import *
1011

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

1516
handler=None
16-
isUIAAvailable=False
17-
18-
if config.conf and config.conf["UIA"]["enabled"]:
19-
# Because Windows 7 SP1 (NT 6.1) or later is supported, just assume UIA can be used unless told otherwise.
20-
try:
21-
from _UIAHandler import *
22-
isUIAAvailable=True
23-
except ImportError:
24-
log.debugWarning("Unable to import _UIAHandler",exc_info=True)
25-
pass
2617

2718
def initialize():
2819
global handler
29-
if not isUIAAvailable:
30-
raise NotImplementedError
20+
if not config.conf["UIA"]["enabled"]:
21+
raise RuntimeError("UIA forcefully disabled in configuration")
3122
try:
3223
handler=UIAHandler()
3324
except COMError:
3425
handler=None
35-
raise RuntimeError("UIA not available")
26+
raise
3627

3728
def terminate():
3829
global handler

source/appModules/logonui.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
import appModuleHandler
1414
import eventHandler
1515
import UIAHandler
16-
if UIAHandler.isUIAAvailable:
17-
from NVDAObjects.UIA import UIA
16+
from NVDAObjects.UIA import UIA
1817

1918
"""App module for the Windows Logon screen
2019
"""
@@ -35,16 +34,15 @@ def event_gainFocus(self):
3534

3635
return super(LogonDialog, self).event_gainFocus()
3736

38-
if UIAHandler.isUIAAvailable:
39-
class Win8PasswordField(UIA):
37+
class Win8PasswordField(UIA):
4038

41-
#This UIA object has no invoke pattern, at least set focus.
42-
# #6024: Affects both Windows 8.x and 10.
43-
def doAction(self,index=None):
44-
if not index:
45-
self.setFocus()
46-
else:
47-
super(Win8PasswordField,self).doAction(index)
39+
#This UIA object has no invoke pattern, at least set focus.
40+
# #6024: Affects both Windows 8.x and 10.
41+
def doAction(self,index=None):
42+
if not index:
43+
self.setFocus()
44+
else:
45+
super(Win8PasswordField,self).doAction(index)
4846

4947
class XPPasswordField(IAccessible):
5048

@@ -82,7 +80,7 @@ def event_NVDAObject_init(self, obj):
8280
def chooseNVDAObjectOverlayClasses(self, obj, clsList):
8381
windowClass = obj.windowClassName
8482

85-
if UIAHandler.isUIAAvailable:
83+
if UIAHandler.handler:
8684
if isinstance(obj,UIA) and obj.UIAElement.cachedClassName in ("TouchEditInner", "PasswordBox") and obj.role==controlTypes.ROLE_EDITABLETEXT:
8785
clsList.insert(0,Win8PasswordField)
8886
# #6010: Allow Windows 10 version to be recognized as well.

source/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,8 @@ def handlePowerStatusChange(self):
435435
log.debug("Initializing UIA support")
436436
try:
437437
UIAHandler.initialize()
438-
except NotImplementedError:
439-
log.warning("UIA not available")
438+
except RuntimeError:
439+
log.warning("UIA disabled in configuration")
440440
except:
441441
log.error("Error initializing UIA support", exc_info=True)
442442
import IAccessibleHandler

0 commit comments

Comments
 (0)