Skip to content

Commit

Permalink
Update darkdetect library to 0.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
daprice committed Nov 17, 2021
1 parent d68ef6d commit 47352ac
Show file tree
Hide file tree
Showing 19 changed files with 57 additions and 38 deletions.
17 changes: 17 additions & 0 deletions .nova/Tasks/Vendor install darkdetect.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"actions" : {
"build" : {
"enabled" : true,
"script" : "#!\/bin\/sh\npip install --target=\"$1\/src\/vendor\" darkdetect"
},
"clean" : {
"enabled" : true,
"script" : "#!\/bin\/sh\nrm -r src\/vendor\/*"
}
},
"arguments" : [
"${WorkspaceFolder}"
],
"identifier" : "E685FD49-B382-4D23-8231-EE993BA7A3AE",
"openLogOnRun" : "start"
}
2 changes: 1 addition & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"name": "Auto Dark Mode",
"description": "Automatically follow the system light/dark mode.",
"author": "Dale Price",
"version": (1, 0, 2),
"version": (1, 0, 3),
"blender": (2, 90, 0),
"category": "User Interface",
"wiki_url": "https://github.com/daprice/Blender-Auto-Dark-Mode",
Expand Down
18 changes: 0 additions & 18 deletions src/vendor/darkdetect-0.5.0.dist-info/RECORD

This file was deleted.

1 change: 0 additions & 1 deletion src/vendor/darkdetect-0.5.0.dist-info/direct_url.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: darkdetect
Version: 0.5.0
Version: 0.5.1
Summary: Detect OS Dark Mode from Python
Home-page: http://github.com/albertosottile/darkdetect
Author: Alberto Sottile
Expand Down
17 changes: 17 additions & 0 deletions src/vendor/darkdetect-0.5.1.dist-info/RECORD
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
darkdetect-0.5.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
darkdetect-0.5.1.dist-info/LICENSE,sha256=abuEZk7_kzrdyycchm1nYi2cLFOlvaMbGnUjVpwlCv4,1495
darkdetect-0.5.1.dist-info/METADATA,sha256=QsYzG2GPRtgP9xyOxdu2Ju-MHlCVn6JTNjSqKsgeSkw,3083
darkdetect-0.5.1.dist-info/RECORD,,
darkdetect-0.5.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
darkdetect-0.5.1.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92
darkdetect-0.5.1.dist-info/top_level.txt,sha256=lIG2Q43uQniIc4b-ukidPntGpjQzuFfQCYrgxeM4RVQ,11
darkdetect/__init__.py,sha256=V6dgkKpuhoi1ZEvTkBQMzrvkZ3nkWpD6qRj1PZYj530,1094
darkdetect/__pycache__/__init__.cpython-39.pyc,,
darkdetect/__pycache__/_dummy.cpython-39.pyc,,
darkdetect/__pycache__/_linux_detect.cpython-39.pyc,,
darkdetect/__pycache__/_mac_detect.cpython-39.pyc,,
darkdetect/__pycache__/_windows_detect.cpython-39.pyc,,
darkdetect/_dummy.py,sha256=pRfhFxFSaiT6DGCyhw1S3K_h45PtXqzzxi6bLGib5CQ,363
darkdetect/_linux_detect.py,sha256=ImoFtBzpOer0ii22juz-0PVZE9IiHPprOubakxEX6cg,860
darkdetect/_mac_detect.py,sha256=a6DlTzsYFHKJHqVY4VaTU9xXjgxul9Cl1HZkVqCEgzc,2142
darkdetect/_windows_detect.py,sha256=n54lw17AqNy6Pfk7378FajVbrq6qwHJwx9Ug5tJY1v4,1234
File renamed without changes.
6 changes: 3 additions & 3 deletions src/vendor/darkdetect/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Distributed under the terms of the 3-clause BSD License.
#-----------------------------------------------------------------------------

__version__ = '0.5.0'
__version__ = '0.5.1'

import sys
import platform
Expand All @@ -16,8 +16,8 @@
else:
from ._mac_detect import *
del V
elif sys.platform == "win32" and platform.release() == "10":
# Checks if running Windows 10 version 10.0.14393 (Anniversary Update) or higher. The getwindowsversion method returns a tuple.
elif sys.platform == "win32" and int(platform.release()) >= 10:
# Checks if running Windows 10 version 10.0.14393 (Anniversary Update) OR HIGHER. The getwindowsversion method returns a tuple.
# The third item is the build number that we can use to check if the user has a new enough version of Windows.
winver = int(sys.getwindowsversion()[2])
if winver >= 14393:
Expand Down
Binary file modified src/vendor/darkdetect/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file modified src/vendor/darkdetect/__pycache__/_dummy.cpython-39.pyc
Binary file not shown.
Binary file modified src/vendor/darkdetect/__pycache__/_linux_detect.cpython-39.pyc
Binary file not shown.
Binary file modified src/vendor/darkdetect/__pycache__/_mac_detect.cpython-39.pyc
Binary file not shown.
Binary file modified src/vendor/darkdetect/__pycache__/_windows_detect.cpython-39.pyc
Binary file not shown.
14 changes: 6 additions & 8 deletions src/vendor/darkdetect/_mac_detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@

import ctypes
import ctypes.util
import platform

from distutils.version import LooseVersion as V

if V(platform.mac_ver()[0]) < V("10.16") or platform.python_version_tuple()[0] == '2':
try:
# macOS Big Sur+ use "a built-in dynamic linker cache of all system-provided libraries"
appkit = ctypes.cdll.LoadLibrary('AppKit.framework/AppKit')
objc = ctypes.cdll.LoadLibrary('libobjc.dylib')
except OSError:
# revert to full path for older OS versions and hardened programs
appkit = ctypes.cdll.LoadLibrary(ctypes.util.find_library('AppKit'))
objc = ctypes.cdll.LoadLibrary(ctypes.util.find_library('objc'))
else:
appkit = ctypes.cdll.LoadLibrary('/System/Library/Frameworks/AppKit.framework/AppKit')
objc = ctypes.cdll.LoadLibrary('/usr/lib/libobjc.dylib')
del V

void_p = ctypes.c_void_p
ull = ctypes.c_uint64
Expand Down
18 changes: 12 additions & 6 deletions src/vendor/darkdetect/_windows_detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,20 @@ def theme():
# Registry will return 0 if Windows is in Dark Mode and 1 if Windows is in Light Mode. This dictionary converts that output into the text that the program is expecting.
valueMeaning = {0: "Dark", 1: "Light"}
# In HKEY_CURRENT_USER, get the Personalisation Key.
key = getKey(hkey, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize")
# In the Personalisation Key, get the AppsUseLightTheme subkey. This returns a tuple.
# The first item in the tuple is the result we want (0 or 1 indicating Dark Mode or Light Mode); the other value is the type of subkey e.g. DWORD, QWORD, String, etc.
subkey = getSubkeyValue(key, "AppsUseLightTheme")[0]
try:
key = getKey(hkey, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize")
# In the Personalisation Key, get the AppsUseLightTheme subkey. This returns a tuple.
# The first item in the tuple is the result we want (0 or 1 indicating Dark Mode or Light Mode); the other value is the type of subkey e.g. DWORD, QWORD, String, etc.
subkey = getSubkeyValue(key, "AppsUseLightTheme")[0]
except FileNotFoundError:
# some headless Windows instances (e.g. GitHub Actions or Docker images) do not have this key
return None
return valueMeaning[subkey]

def isDark():
return theme() == 'Dark'
if theme() is not None:
return theme() == 'Dark'

def isLight():
return theme() == 'Light'
if theme() is not None:
return theme() == 'Light'

0 comments on commit 47352ac

Please sign in to comment.