forked from nvaccess/nvda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUIAHandler.py
39 lines (34 loc) · 967 Bytes
/
UIAHandler.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#UIAHandler.py
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2008-2016 NV Access Limited
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
import winVersion
from comtypes import COMError
import config
from logHandler import log
handler=None
isUIAAvailable=False
if config.conf and config.conf["UIA"]["enabled"]:
winver=winVersion.winVersion.major+(winVersion.winVersion.minor/10.0)
if winver>=config.conf["UIA"]["minWindowsVersion"]:
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
try:
handler=UIAHandler()
except COMError:
handler=None
raise RuntimeError("UIA not available")
def terminate():
global handler
if handler:
handler.terminate()
handler=None