mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Fix Windows dark mode detection: OpenKey can fail (#2068)
* Fix Windows dark mode detection: OpenKey can fail #1497 introduced reading hardcoded Windows Registry key, which assumes key exists. This is not true on Windows 7. Later addition of `try-except` block missed that OpenKey might fail. This fix allows launching current version of Anki on Windows 7 when installed with Pip with the modified Python 3.9 installation. * Update CONTRIBUTORS CI req: Add myself to the contributor list
This commit is contained in:
parent
35431c5944
commit
3ec7e23d7c
2 changed files with 5 additions and 4 deletions
|
@ -105,6 +105,7 @@ dobefore <1432338032@qq.com>
|
|||
Bart Louwers <bart.git@emeel.net>
|
||||
Sam Penny <github.com/sam1penny>
|
||||
Yutsuten <mateus.etto@gmail.com>
|
||||
Zoom <zoomrmc+git@gmail.com>
|
||||
|
||||
********************
|
||||
|
||||
|
|
|
@ -297,11 +297,11 @@ def get_windows_dark_mode() -> bool:
|
|||
QueryValueEx,
|
||||
)
|
||||
|
||||
key = OpenKey(
|
||||
HKEY_CURRENT_USER,
|
||||
r"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize",
|
||||
)
|
||||
try:
|
||||
key = OpenKey(
|
||||
HKEY_CURRENT_USER,
|
||||
r"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize",
|
||||
)
|
||||
return not QueryValueEx(key, "AppsUseLightTheme")[0]
|
||||
except Exception as err:
|
||||
# key reportedly missing or set to wrong type on some systems
|
||||
|
|
Loading…
Reference in a new issue