Skip to content
Permalink
Tree: 92458e986f
Commits on Jul 12, 2019
  1. Python 3: Fix several local overrides of range function (PR #9912)

    leonardder authored and feerrenrut committed Jul 12, 2019
    We were using range as a name of a local attribute or function parameter. In at least one case (uia _getBoundingRectsFromUIARange), this fails, as were also calling the range function in that method.
    
    Looked for every instance of range as a local attribute. In most cases, rename it to textRange.
  2. Python 3: Fix loading of espeak variants (PR #9920)

    leonardder authored and feerrenrut committed Jul 12, 2019
    Fixes mistake introduced in #9853
  3. Python 3: Use built-in "input" instread of "raw_input" (PR #9908)

    josephsl authored and feerrenrut committed Jul 12, 2019
    NVDA slave module was using the raw_input function to scrape stdin, which raises NameError in Python 3.
    In Python 3 raw_input has been replaced with the functional equal input. For more information see:
    https://www.python.org/dev/peps/pep-3111/
Commits on Jul 11, 2019
  1. Python 3: Remove Python 2 specific workarounds (PR #9889)

    leonardder authored and feerrenrut committed Jul 11, 2019
    Our Python 2 code contained some workarounds  and code paths that are no longer necessary or confusing when on Python 3.
    
    1. Most notably, this is related to functions with `*args` and `**kwargs` catch all handlers which also required a specific keyword argument. Once of these was part of the `hwIo` module and has already been removed in an earlier state.
       - Code where we pop a particular argument from `kwargs` now contains that argument as a keyword only argument in the signature of the function.
    2. Furthermore, there was a workaround in the `gui` code to register support for the `cp65001` codec in Python 2, which is a known codec in Python 3.
       - This is removed
    3. The `scriptHandler.script` decorator checked whether the decorated script was a routine. This also returned `True` for bound instance methods, and therefore no warning was raised when trying to decorate a bound instance method (which is unsupported). Now, such a warning will be raised. See also #9884 
       - When decorating a script, we now use `isinstance(script, types.FunctionType)`
    4. `config.AggregatedSection` still had an `iteritems` method.
       - `config.AggregatedSection.iteritems` has been renamed to items.
  2. Python 3: Clean the current words buffer in more cases (PR #9877)

    leonardder authored and feerrenrut committed Jul 11, 2019
    Speech refactor introduced a new way to clear the current words buffer for speech. However, in some cases, this buffer wasn't cleared, particularly in the following cases:
    
    - In legacy windows consoles, when typing a word and pressing enter, pressing space still reported the previous word that was already sent to the console.
    - When moving by sentence in Word, the buffer wasn't cleared.
    
    To fix this:
    - in EditableText, the logic to clear the buffer was moved from _caretMovementScriptHelper to _caretScriptPostMovedHelper. This ensures that the buffer is also cleared when navigating by sentence, while not clearing it when the cart hasn't moved, such as when trying sentence nav in an application that doesn't implement it.
    - I copied the flush_queuedChars from winConsoleUIA to winConsole.
    
    Fixes #9769
  3. Python 3: MoveFileEx - catch WindowsError instead of WinError (PR #9876)

    josephsl authored and feerrenrut committed Jul 11, 2019
    Fixes an issue in #9847: catch WindowsError because WinError is not an exception type.
  4. Python 3: Fix adobe reader int/str to NoneType comparisons as well as…

    leonardder authored and feerrenrut committed Jul 11, 2019
    … other identified cases (PR: #9881)
    
    Reading documents in Adobe Reader was raising a TypeError
    Fixed this int to NoneType comparison, identified some others while at it.
Commits on Jul 10, 2019
  1. Python 3: Remove many instances of "py3 review required" comments (PR #…

    leonardder authored and feerrenrut committed Jul 10, 2019
    …9890)
    
    These comments are no longer required, they have now been reviewed.
  2. Python 3: Fix error with accPropServer (PR #9900)

    feerrenrut committed Jul 10, 2019
    Fixes #9768
    
    The VARIANT out-param was not being initialised correctly. Calling VariantClear on an uninitialised VARIANT is an error.
    
    Comtypes was not initialising VARIANT.vt to VT_EMPTY, and attempting to call VariantClear (oleauto.h) before assigning it the value returned from getProp.
    Instead, we implement a low-level getProp method by requiring an unused "this" param. This low-levl getProp method is provided pointers to the out-params, allowing it to manually initialise the VARIANT correctly before assigning a value.
Commits on Jul 9, 2019
  1. Python 3: When processing xml coming from virtual buffers, make sure …

    leonardder authored and feerrenrut committed Jul 9, 2019
    …that surrogate characters are handled properly (PR #9897)
    
    Before this change, in virtual buffers, emoji are shown as two surrogate characters instead of the actual emoji character.
    This is because virtual buffers output in UTF-16, and surrogate characters are not allowed in xml. Therefore, the XML contains integer values for the surrogate characters, and they are converted to real characters in the xmlFormatting module. As surrogate characters are perfectly valid within Python 3 and even a surrogate pair is allowed, Python 3 does not collapse two surrogate characters into one 32-bit character.
    
    If a low surrogate character is handled, add it to the currently buffered text, and quickly encode and decode the text to/from UTF-16. This ensures that surrogate pairs are properly decoded to the associated 32-bit character. The decision to do this for low surrogates only is intentional. A high surrogate is usually followed by a low surrogate. Therefore it doesn't make sense to re-encode if processing a high surrogate. We also want to avoid just re-encoding anything.
  2. Python 3: use UTF-8 decoding for font name with Scintilla controls (PR

    josephsl authored and feerrenrut committed Jul 9, 2019
    …#9893)
    
    Fixes #9892
    
    Format info command fails in Notepad++ and other Scintilla controls because font name is a bytes-like object.
    Font name is decoded using UTF-8.
  3. Python3: Fix save scripts in lockapp (PR #9884)

    leonardder authored and feerrenrut committed Jul 9, 2019
    Fixes #9883
    
    On the Windows 10 lock screen, invoked with Windows+L. The user copy of NVDA is still active. As the screen is locked, there is a set of safe scripts on the appmodule for the lock screen to make sure that the NVDA configuration isn't changed when on the lock screen. However, this SAFE_SCRIPTS set expected scripts on globalCommands.GlobalCommands to be unbound methods, so for every script, it took the __func__ attribute on the unbound method to get to the actual function. In python 3 unbound methods are gone.
    
    SAFE_SCRIPTS now just contains the raw scripts from globalCommands.GlobalCommands, which are now functions, no longer unbound methods. When comparing a bound script with the SAFE_SCRIPTS, we're dealing with a bound method and thus we still have to traverse up to the __func__ attribute on the bound script. I added an explanatory comment for that.
  4. Python 3: Fix missing import, remove unused imports (PR #9901)

    feerrenrut committed Jul 9, 2019
Commits on Jul 8, 2019
  1. Python 3: Fix usages of "open" function (PR #9853)

    leonardder authored and feerrenrut committed Jul 8, 2019
    Searched for, inspected, and fixed usages of "open" function
    Used `git grep "\Wopen("` to search of usages of "open"
    
    Fixes #9838
    
    Python can open a file in binary mode and in text mode. In python 2, this difference was less distinct than in Python 3. In python 3, reading a file in text mode returns unicode strings, whereas binary mode returns bytes objects. Therefore, a call of open without supplying proper arguments would open a file in text mode with the default system encoding assumed. 
    
    1. #9838: wrong encoding assumed when decoding add-on manifests. As open didn't have an encoding specified, the default text encoding of the system was specified. This failed for Japanese systems.
    2. To read Espeak VARIANT DATA, NVDA parses files in the espeak data folder. For this, the open function was also used without an encoding. This resulted in the inability to load espeak on systems where the beta option "Use Unicode UTF-8 for worldwide language support" was enabled.
    3. To open calls in NVDAHelper and watchdog are used to open a file without actually writing or reading to it using Python directly. These files are now opened in binary mode. While not strictly necessary, this makes it clearer from a code perspective that we aren't dealing with Python's ability to write or read encoded text files.
    4. The logViewer now consistently uses open instead of codecs.open
  2. Merge remote-tracking branch 'origin/threshold' into threshold_py3_st…

    feerrenrut committed Jul 8, 2019
    …aging
  3. Fix api back compat version number

    feerrenrut committed Jul 8, 2019
  4. Merge remote-tracking branch 'origin/threshold' into threshold_py3_st…

    feerrenrut committed Jul 8, 2019
    …aging
  5. Fix buildversion for threshold branch

    feerrenrut committed Jul 8, 2019
Commits on Jul 5, 2019
  1. Fix merge: inspected diff for Py3 errors

    feerrenrut committed Jul 5, 2019
  2. Merge remote-tracking branch 'origin/threshold' into threshold_py3_st…

    feerrenrut committed Jul 5, 2019
    …aging
    
    Resolved Conflicts:
    	readme.md
    	source/NVDAObjects/IAccessible/__init__.py
    	source/brailleDisplayDrivers/handyTech.py
    	source/gui/settingsDialogs.py
    	source/pythonConsole.py
  3. Fix merge: missing priority argument

    feerrenrut committed Jul 5, 2019
  4. Merge remote-tracking branch 'origin/master' into threshold

    feerrenrut committed Jul 5, 2019
    Resolved Conflicts:
    	source/speech/__init__.py
    	user_docs/en/changes.t2t
  5. WinKernel: create a wrapper for MoveFileExW function and associated f…

    josephsl authored and feerrenrut committed Jul 5, 2019
    …lag constants (PR #9849)
    
    Fixes #9847
    Fixes #9825
    
    Add a wrapper for kernel32.dll::MoveFileExW function, along with flag constants. This then allows any module/function/class to use this wrapper instead of defining their own. Re: #9847
    
    Update check: use winKernel.moveFileEx instead of os.renames after postponing an update. Re #9825.
    Python 3.7's `os.renames` function no longer allows copies across disk drives, it raises `OSError` with ERROR_NOT_SAME_DEVICE. 
    The extended description of this error is "The system cannot move the file to a different disk drive". 
    This can cause an error when updating a portable copy of NVDA"
    See https://bugs.python.org/issue28356 for information about the change to os.rename / os.renames
  6. Python 3: sys.exec_prefix > sys.prefix for nvda_slave (PR #9871)

    leonardder authored and feerrenrut committed Jul 5, 2019
    Fixes #9870
  7. Python 3: fix say all for DisplayModelEditableText (PR #9866)

    leonardder authored and feerrenrut committed Jul 5, 2019
    Fixes #9860
  8. Python 3 one core: Don't check for sys.frozen in the check method. (PR

    leonardder authored and feerrenrut committed Jul 5, 2019
    …#9857)
    
    When running a python 2 copy from source, NVDA is unable to detect if it is running under Windows 10. Therefore, the oneCore synthesizer contains a work around in its check method, always listing the synthesizer in the synthesizer list when running from source, even on Windows versions older than Windows 10.
    On Python 3 however, the manifest of the main Python targets Windows 10 and therefore, this workaround is no longer necessary.
Commits on Jul 3, 2019
  1. Update UIAutomationCore.dll comtypes module to version 10.0.18362 (PR #…

    leonardder authored and feerrenrut committed Jul 3, 2019
    …9829)
    
    Ran `comtypes.client.GetModule("UIAutomationCore.dll")` from a Python 3.7.3 interpreter with `comtypes 1.1.7`.
    
    UIAutomationCore.dll File info"
    - File version: 7.2.18362.1
    - Product version: 10.0.18362.1
  2. Remove duplicate entry in changes file

    feerrenrut committed Jul 3, 2019
  3. Python 3: Update py2exe to fix several issues (PR #9856)

    leonardder authored and feerrenrut committed Jul 3, 2019
    * Exclude win32wnet
    * No longer strip the base path from tracebacks when running a frozen build
    * Update py2exe-bin
  4. Changes file: push back to 2019.2 release

    feerrenrut committed Jul 3, 2019
    These features will be included in the 2019.2 release, adjusted the changes file to reflect this.
  5. Update changes file for PR #9854

    feerrenrut committed Jul 3, 2019
  6. Update Espeak-ng to commit 67324cc. (PR #9854)

    codeofdusk authored and feerrenrut committed Jul 3, 2019
Commits on Jul 2, 2019
  1. textUtils module to deal with offset differences between Python 3 str…

    leonardder authored and feerrenrut committed Jul 2, 2019
    …ings and Windows wide character strings with surrogate characters (PR #9545)
    
    Closes #8981
    
    On Windows, wide characters are two bytes in size. This is also the case in python 2. This is best explained with an example:
    
    Python 2:
    >>> len(u"😉")
    2
    
    In Python 3 however, strings are saved using a variable byte size, based on the number of bytes that is needed to store the highest code point in the string. One index always corresponds with one code point.
    
    A much more detailed description of the problem can be found in #8981.
    
    This commit introduces a new textUtils module that intends to mitigate issues introduced with the Python 3 transition. Most offset based TextInfos are based on a two bytes wide character string representation. For example, uniscribe uses 2 byte wide characters, and therefore 😉 is treated as two characters by uniscribe whereas Python 3 treats it as one.
    
    This is where textUtils.WideStringOffsetConverter comes into view. This new class keeps the decoded and encoded form of a string in one object. This object can be used to convert string offsets between two implementations, namely the Python 3 one offset per code point implementation, and the Windows wide character implementation with surrogate offsets.
Commits on Jul 1, 2019
  1. Update changes file for PR #9781

    feerrenrut committed Jul 1, 2019
  2. Allow pasting multiple lines in the Python Console (PR #9781)

    JulienCochuyt authored and feerrenrut committed Jul 1, 2019
    In the Python Console, the input field now supports pasting multiple lines from the clipboard.
    
    Fixes #9776
Older
You can’t perform that action at this time.