nvda
2de9755a - No longer fail to start NVDA from sources on Windows 7 when setting DPI awareness (#14161)

Commit
3 years ago
No longer fail to start NVDA from sources on Windows 7 when setting DPI awareness (#14161) fix-up of #13254 Summary of the issue: After #13254 got merged NVDA failed to start from sources on Windows 7 with the following exception: CRITICAL - __main__ (16:59:34.992) - MainThread (6908): core failure Traceback (most recent call last): File "nvda.pyw", line 393, in <module> core.main() File "core.py", line 436, in main setDPIAwareness() File "winAPI\dpiAwareness.py", line 67, in setDPIAwareness hResult = ctypes.windll.shcore.SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE) File "C:\Python37\lib\ctypes\__init__.py", line 434, in __getattr__ dll = self._dlltype(name) File "C:\Python37\lib\ctypes\__init__.py", line 364, in __init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 126] The specified module cannot be found While we handle different versions of Windows by catching AttributeError if the given function for setting DPI awareness is not present on Windows 7 shcore is missing and ctypes raises a different error for missing libraries. Description of user facing changes NVDA can once again start from sources when running on Windows 7. Description of development approach In addition to catching AttributeError we also catch WindowsError and inspect its error code. If it is caused by the missing library appropriate info is logged and the function continues to use legacy method of setting DPI awareness. Note that AttributeError has to be handled as well to allow NVDA to start on Windows 8/Server 2012.
Author
Parents
Loading