Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sconstruct
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ def makePot(target, source, env):
"--keyword=pgettext:1c,2",
# Needed because xgettext doesn't recognise the .pyw extension.
"--language=python",
"--from-code=UTF-8",
] + [os.path.relpath(str(f), str(sourceDir)) for f in source]
]) != 0:
raise RuntimeError("xgettext failed")
Expand Down
1 change: 0 additions & 1 deletion source/COMRegistrationFixes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: UTF-8 -*-
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2018 NV Access Limited
#This file is covered by the GNU General Public License.
Expand Down
9 changes: 4 additions & 5 deletions source/JABHandler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: UTF-8 -*-
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2007-2019 NV Access Limited, Peter Vágner, Renaud Paquay, Babbage B.V.
# This file is covered by the GNU General Public License.
Expand Down Expand Up @@ -61,10 +60,10 @@ def _fixBridgeFunc(restype,name,*argtypes,**kwargs):
try:
bridgeDll=getattr(cdll,'windowsAccessBridge-32')
legacyAccessBridge=False
except WindowsError:
except OSError:
try:
bridgeDll=cdll.windowsAccessBridge
except WindowsError:
except OSError:
bridgeDll=None

#Definitions of access bridge types, structs and prototypes
Expand Down Expand Up @@ -344,7 +343,7 @@ def getWindowHandleFromAccContext(vmID,accContext):
else:
return vmIDsToWindowHandles.get(vmID)

class JABContext(object):
class JABContext:

def __init__(self,hwnd=None,vmID=None,accContext=None):
if hwnd and not vmID:
Expand Down Expand Up @@ -416,7 +415,7 @@ def getAccessibleTextSelectionInfo(self):
def getAccessibleTextRange(self,start,end):
length=((end+1)-start)
if length<=0:
return u""
return ""
# Use a string buffer, as from an unicode buffer, we can't get the raw data.
buf = create_string_buffer((length +1) * 2)
bridgeDll.getAccessibleTextRange(self.vmID, self.accContext, start, end, buf, length)
Expand Down
18 changes: 9 additions & 9 deletions source/NVDAHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ def _lookupKeyboardLayoutNameWithHexString(layoutString):
buf=create_unicode_buffer(1024)
bufSize=c_int(2048)
key=HKEY()
if windll.advapi32.RegOpenKeyExW(winreg.HKEY_LOCAL_MACHINE,u"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\"+ layoutString,0,winreg.KEY_QUERY_VALUE,byref(key))==0:
if windll.advapi32.RegOpenKeyExW(winreg.HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\"+ layoutString,0,winreg.KEY_QUERY_VALUE,byref(key))==0:
try:
if windll.advapi32.RegQueryValueExW(key,u"Layout Display Name",0,None,buf,byref(bufSize))==0:
if windll.advapi32.RegQueryValueExW(key,"Layout Display Name",0,None,buf,byref(bufSize))==0:
windll.shlwapi.SHLoadIndirectString(buf.value,buf,1023,None)
return buf.value
if windll.advapi32.RegQueryValueExW(key,u"Layout Text",0,None,buf,byref(bufSize))==0:
if windll.advapi32.RegQueryValueExW(key,"Layout Text",0,None,buf,byref(bufSize))==0:
return buf.value
finally:
windll.advapi32.RegCloseKey(key)
Expand Down Expand Up @@ -147,7 +147,7 @@ def handleInputCompositionEnd(result):
from NVDAObjects.inputComposition import InputComposition
from NVDAObjects.IAccessible.mscandui import ModernCandidateUICandidateItem
focus=api.getFocusObject()
result=result.lstrip(u'\u3000 ')
result=result.lstrip('\u3000 ')
curInputComposition=None
if isinstance(focus,InputComposition):
curInputComposition=focus
Expand Down Expand Up @@ -176,7 +176,7 @@ def handleInputCompositionEnd(result):
speech.speechMode=oldSpeechMode

if curInputComposition and not result:
result=curInputComposition.compositionString.lstrip(u'\u3000 ')
result=curInputComposition.compositionString.lstrip('\u3000 ')
if result:
speech.speakText(result,symbolLevel=characterProcessing.SYMLVL_ALL)

Expand Down Expand Up @@ -386,7 +386,7 @@ def nvdaControllerInternal_inputLangChangeNotify(threadID,hkl,layoutString):
inputMethodName="".join(inputMethodName.split(' - ')[1:])
#Include the language only if it changed.
if languageID!=lastLanguageID:
msg=u"{language} - {layout}".format(language=inputLanguageName,layout=inputMethodName)
msg=f"{inputLanguageName} - {inputMethodName}"
else:
msg=inputMethodName
lastLanguageID=languageID
Expand Down Expand Up @@ -418,7 +418,7 @@ def nvdaControllerInternal_installAddonPackageFromPath(addonPath):
wx.CallAfter(addonGui.handleRemoteAddonInstall, addonPath)
return 0

class RemoteLoader64(object):
class RemoteLoader64:

def __init__(self):
# Create a pipe so we can write to stdin of the loader process.
Expand All @@ -438,7 +438,7 @@ def __init__(self):
# Therefore, explicitly specify our own process token, which causes them to be inherited.
token = winKernel.OpenProcessToken(winKernel.GetCurrentProcess(), winKernel.MAXIMUM_ALLOWED)
try:
winKernel.CreateProcessAsUser(token, None, os.path.join(versionedLib64Path,u"nvdaHelperRemoteLoader.exe"), None, None, True, None, None, None, si, pi)
winKernel.CreateProcessAsUser(token, None, os.path.join(versionedLib64Path,"nvdaHelperRemoteLoader.exe"), None, None, True, None, None, None, si, pi)
# We don't need the thread handle.
winKernel.closeHandle(pi.hThread)
self._process = pi.hProcess
Expand Down Expand Up @@ -505,7 +505,7 @@ def initialize():
log.info("Remote injection disabled due to running as a Windows Store Application")
return
#Load nvdaHelperRemote.dll but with an altered search path so it can pick up other dlls in lib
h=windll.kernel32.LoadLibraryExW(os.path.abspath(os.path.join(versionedLibPath,u"nvdaHelperRemote.dll")),0,0x8)
h=windll.kernel32.LoadLibraryExW(os.path.abspath(os.path.join(versionedLibPath,"nvdaHelperRemote.dll")),0,0x8)
if not h:
log.critical("Error loading nvdaHelperRemote.dll: %s" % WinError())
return
Expand Down
Loading