Skip to content

Commit ae97234

Browse files
authored
Merge 0e0e957 into cdfda57
2 parents cdfda57 + 0e0e957 commit ae97234

File tree

10 files changed

+220
-31
lines changed

10 files changed

+220
-31
lines changed

devDocs/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_build/
2+
*.rst

devDocs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

devDocs/conf.py

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
#A part of NonVisual Desktop Access (NVDA)
2+
#Copyright (C) 2019 NV Access Limited, Leonard de RUijter
3+
#This file is covered by the GNU General Public License.
4+
#See the file COPYING for more details.
5+
6+
# Configuration file for the Sphinx documentation builder.
7+
8+
# -- Path setup --------------------------------------------------------------
9+
10+
import os
11+
import sys
12+
sys.path.insert(0, os.path.abspath('../source'))
13+
import sourceEnv
14+
15+
# Initialize languageHandler so that sphinx is able to deal with translatable strings.
16+
import languageHandler
17+
languageHandler.setLanguage("en")
18+
19+
# Initialize globalvars.appArgs to something sensible.
20+
import globalVars
21+
class AppArgs:
22+
# Set an empty comnfig path
23+
# This is never used as we don't initialize config, but some modules expect this to be set.
24+
configPath = ""
25+
secure = False
26+
disableAddons = True
27+
launcher = False
28+
globalVars.appArgs = AppArgs()
29+
30+
# Import NVDA's versionInfo module.
31+
import versionInfo
32+
# Set a suitable updateVersionType for the updateCheck module to be imported
33+
versionInfo.updateVersionType = "stable"
34+
35+
# -- Project information -----------------------------------------------------
36+
37+
project = versionInfo.name
38+
copyright = versionInfo.copyright
39+
author = versionInfo.publisher
40+
41+
# The major project version
42+
version = versionInfo.formatVersionForGUI(versionInfo.version_year, versionInfo.version_major, versionInfo.version_minor)
43+
44+
# The full version, including alpha/beta/rc tags
45+
release = versionInfo.version
46+
47+
# -- General configuration ---------------------------------------------------
48+
49+
default_role = 'py:obj'
50+
51+
# Add any Sphinx extension module names here, as strings. They can be
52+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
53+
# ones.
54+
extensions = [
55+
'sphinx.ext.autodoc',
56+
]
57+
58+
# Add any paths that contain templates here, relative to this directory.
59+
templates_path = ['_templates']
60+
61+
# List of patterns, relative to source directory, that match files and
62+
# directories to ignore when looking for source files.
63+
# This pattern also affects html_static_path and html_extra_path.
64+
exclude_patterns = [
65+
"_build"
66+
]
67+
68+
69+
# -- Options for HTML output -------------------------------------------------
70+
71+
# The theme to use for HTML and HTML Help pages.
72+
73+
html_theme = 'alabaster'
74+
75+
# Add any paths that contain custom static files (such as style sheets) here,
76+
# relative to this directory. They are copied after the builtin static files,
77+
# so a file named "default.css" will overwrite the builtin "default.css".
78+
html_static_path = ['_static']
79+
80+
# -- Extension configuration -------------------------------------------------
81+
82+
# sphinx.ext.autodoc configuration
83+
84+
autoclass_content = "both" # Both the class’ and the __init__ method’s docstring are concatenated and inserted.
85+
autodoc_member_order = 'bysource'
86+
autodoc_mock_imports = [
87+
"config",
88+
"louis",
89+
]
90+
91+
# SUpport for auto generation of API docs
92+
# Based on code published in https://github.com/readthedocs/readthedocs.org/issues/1139#issuecomment-398083449
93+
94+
def run_apidoc(_):
95+
ignore_paths = [
96+
'_buildVersion.py',
97+
'comInterfaces',
98+
'images',
99+
'lib',
100+
'lib64',
101+
'libArm64',
102+
'locale',
103+
'louis', # Not our project
104+
'typelibs',
105+
'waves',
106+
"mathType.py", # Fails when not installed
107+
'oleTypes.py', # Not our code
108+
'setup.py', # Py2exe
109+
'sourceEnv.py', # Only available when running from source
110+
]
111+
argv = [
112+
"--force", # overwrite existing files
113+
"-P", # Include private modules
114+
"--module-first", # put module documentation before submodule documentation
115+
"--output-dir", ".",
116+
sys.path[0] # Module sources
117+
] + [os.path.join(sys.path[0], path) for path in ignore_paths]
118+
119+
from sphinx.ext import apidoc
120+
apidoc.main(argv)
121+
122+
def setup(app):
123+
app.connect('builder-inited', run_apidoc)

devDocs/index.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.. NVDA documentation master file, created by
2+
sphinx-quickstart on Sat Jul 20 08:52:09 2019.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
Welcome to NVDA's documentation!
7+
================================
8+
9+
.. toctree::
10+
:maxdepth: 2
11+
:caption: Contents:
12+
13+
14+
15+
Indices and tables
16+
==================
17+
18+
* :ref:`genindex`
19+
* :ref:`modindex`
20+
* :ref:`search`

devDocs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=.
11+
set BUILDDIR=_build
12+
13+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.http://sphinx-doc.org/
25+
exit /b 1
26+
)
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

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: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,18 @@
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:

source/addonHandler/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def lastTestedNVDAVersion(self):
276276
class Addon(AddonBase):
277277
""" Represents an Add-on available on the file system."""
278278
def __init__(self, path):
279-
""" Constructs an L[Addon} from.
279+
""" Constructs an L{Addon} from.
280280
@param path: the base directory for the addon data.
281281
@type path: string
282282
"""
@@ -431,7 +431,7 @@ def loadModule(self, name):
431431
""" loads a python module from the addon directory
432432
@param name: the module name
433433
@type name: string
434-
@returns the python module with C[name}
434+
@returns the python module with C{name}
435435
@rtype python module
436436
"""
437437
log.debug("Importing module %s from plugin %s", name, self.name)

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.

0 commit comments

Comments
 (0)