Skip to content

Commit

Permalink
Merge 0e0e957 into cdfda57
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonarddeR committed Dec 3, 2019
2 parents cdfda57 + 0e0e957 commit ae97234
Show file tree
Hide file tree
Showing 10 changed files with 220 additions and 31 deletions.
2 changes: 2 additions & 0 deletions devDocs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
_build/
*.rst
20 changes: 20 additions & 0 deletions devDocs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
123 changes: 123 additions & 0 deletions devDocs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2019 NV Access Limited, Leonard de RUijter
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.

# Configuration file for the Sphinx documentation builder.

# -- Path setup --------------------------------------------------------------

import os
import sys
sys.path.insert(0, os.path.abspath('../source'))
import sourceEnv

# Initialize languageHandler so that sphinx is able to deal with translatable strings.
import languageHandler
languageHandler.setLanguage("en")

# Initialize globalvars.appArgs to something sensible.
import globalVars
class AppArgs:
# Set an empty comnfig path
# This is never used as we don't initialize config, but some modules expect this to be set.
configPath = ""
secure = False
disableAddons = True
launcher = False
globalVars.appArgs = AppArgs()

# Import NVDA's versionInfo module.
import versionInfo
# Set a suitable updateVersionType for the updateCheck module to be imported
versionInfo.updateVersionType = "stable"

# -- Project information -----------------------------------------------------

project = versionInfo.name
copyright = versionInfo.copyright
author = versionInfo.publisher

# The major project version
version = versionInfo.formatVersionForGUI(versionInfo.version_year, versionInfo.version_major, versionInfo.version_minor)

# The full version, including alpha/beta/rc tags
release = versionInfo.version

# -- General configuration ---------------------------------------------------

default_role = 'py:obj'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = [
"_build"
]


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages.

html_theme = 'alabaster'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

# -- Extension configuration -------------------------------------------------

# sphinx.ext.autodoc configuration

autoclass_content = "both" # Both the class’ and the __init__ method’s docstring are concatenated and inserted.
autodoc_member_order = 'bysource'
autodoc_mock_imports = [
"config",
"louis",
]

# SUpport for auto generation of API docs
# Based on code published in https://github.com/readthedocs/readthedocs.org/issues/1139#issuecomment-398083449

def run_apidoc(_):
ignore_paths = [
'_buildVersion.py',
'comInterfaces',
'images',
'lib',
'lib64',
'libArm64',
'locale',
'louis', # Not our project
'typelibs',
'waves',
"mathType.py", # Fails when not installed
'oleTypes.py', # Not our code
'setup.py', # Py2exe
'sourceEnv.py', # Only available when running from source
]
argv = [
"--force", # overwrite existing files
"-P", # Include private modules
"--module-first", # put module documentation before submodule documentation
"--output-dir", ".",
sys.path[0] # Module sources
] + [os.path.join(sys.path[0], path) for path in ignore_paths]

from sphinx.ext import apidoc
apidoc.main(argv)

def setup(app):
app.connect('builder-inited', run_apidoc)
20 changes: 20 additions & 0 deletions devDocs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.. NVDA documentation master file, created by
sphinx-quickstart on Sat Jul 20 08:52:09 2019.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to NVDA's documentation!
================================

.. toctree::
:maxdepth: 2
:caption: Contents:



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
35 changes: 35 additions & 0 deletions devDocs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
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
15 changes: 3 additions & 12 deletions source/UIAHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,18 @@
from comtypes import COMError
import config
from logHandler import log
from _UIAHandler import *

# 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:
Expand Down
4 changes: 2 additions & 2 deletions source/addonHandler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def lastTestedNVDAVersion(self):
class Addon(AddonBase):
""" Represents an Add-on available on the file system."""
def __init__(self, path):
""" Constructs an L[Addon} from.
""" Constructs an L{Addon} from.
@param path: the base directory for the addon data.
@type path: string
"""
Expand Down Expand Up @@ -431,7 +431,7 @@ def loadModule(self, name):
""" loads a python module from the addon directory
@param name: the module name
@type name: string
@returns the python module with C[name}
@returns the python module with C{name}
@rtype python module
"""
log.debug("Importing module %s from plugin %s", name, self.name)
Expand Down
22 changes: 10 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,15 @@ def event_gainFocus(self):

return super(LogonDialog, self).event_gainFocus()

if UIAHandler.isUIAAvailable:
class Win8PasswordField(UIA):
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)
#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 XPPasswordField(IAccessible):

Expand Down Expand Up @@ -82,7 +80,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

0 comments on commit ae97234

Please sign in to comment.