diff --git a/example/breeze_theme.py b/example/breeze_theme.py index f50ca02..0a48d66 100644 --- a/example/breeze_theme.py +++ b/example/breeze_theme.py @@ -326,28 +326,30 @@ def _get_theme_macos_impl() -> ThemeFn: assert obc_name is not None objc = ctypes.cdll.LoadLibrary(obc_name) - # See https://docs.python.org/3/library/ctypes.html#function-prototypes for arguments description - msg_prototype = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p) - msg = msg_prototype(('objc_msgSend', objc), ((1, '', None), (1, '', None), (1, '', None))) - auto_release_pool = _get_class(objc, 'NSAutoreleasePool') - user_defaults = _get_class(objc, 'NSUserDefaults') - ns_string = _get_class(objc, 'NSString') +# TODO: Restpre +# # See https://docs.python.org/3/library/ctypes.html#function-prototypes for arguments description +# msg_prototype = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p) +# msg = msg_prototype(('objc_msgSend', objc), ((1, '', None), (1, '', None), (1, '', None))) +# auto_release_pool = _get_class(objc, 'NSAutoreleasePool') +# user_defaults = _get_class(objc, 'NSUserDefaults') +# ns_string = _get_class(objc, 'NSString') def get_theme_func() -> Theme: '''Get the theme with all our internal helpers.''' - - pool = msg(auto_release_pool, _register_name(objc, 'alloc')) - pool = msg(pool, _register_name(objc, 'init')) - std_user_defaults = msg(user_defaults, _register_name(objc, 'standardUserDefaults')) - - key = msg(ns_string, _register_name(objc, "stringWithUTF8String:"), _as_utf8('AppleInterfaceStyle')) - appearance_ns = msg(std_user_defaults, _register_name(objc, 'stringForKey:'), ctypes.c_void_p(key)) - appearance_c = msg(appearance_ns, _register_name(objc, 'UTF8String')) - - out = ctypes.string_at(appearance_c) if appearance_c is not None else None - msg(pool, _register_name(objc, 'release')) - - return Theme.from_string(out.decode('utf-8')) if out is not None else Theme.LIGHT + return Theme.DARK +# TODO: Restore +# pool = msg(auto_release_pool, _register_name(objc, 'alloc')) +# pool = msg(pool, _register_name(objc, 'init')) +# std_user_defaults = msg(user_defaults, _register_name(objc, 'standardUserDefaults')) +# +# key = msg(ns_string, _register_name(objc, "stringWithUTF8String:"), _as_utf8('AppleInterfaceStyle')) +# appearance_ns = msg(std_user_defaults, _register_name(objc, 'stringForKey:'), ctypes.c_void_p(key)) +# appearance_c = msg(appearance_ns, _register_name(objc, 'UTF8String')) +# +# out = ctypes.string_at(appearance_c) if appearance_c is not None else None +# msg(pool, _register_name(objc, 'release')) +# +# return Theme.from_string(out.decode('utf-8')) if out is not None else Theme.LIGHT return get_theme_func