mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-07 09:01:38 -04:00
API to get/set cocoa aqua appearance override
This commit is contained in:
parent
45fe6a409d
commit
1aa3d58375
@ -225,7 +225,32 @@ release_io_pm_assertion(PyObject *self, PyObject *args) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
|
set_requires_aqua_system_appearance(PyObject *self, PyObject *yes) {
|
||||||
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||||
|
if (PyObject_IsTrue(yes)) {
|
||||||
|
[defaults setBool:YES forKey:@"NSRequiresAquaSystemAppearance"];
|
||||||
|
} else {
|
||||||
|
if (yes == Py_None) [defaults removeObjectForKey:@"NSRequiresAquaSystemAppearance"];
|
||||||
|
else [defaults setBool:NO forKey:@"NSRequiresAquaSystemAppearance"];
|
||||||
|
}
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
|
get_requires_aqua_system_appearance(PyObject *self, PyObject *unused) {
|
||||||
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||||
|
if ([defaults objectForKey:@"NSRequiresAquaSystemAppearance"]) {
|
||||||
|
if ([defaults boolForKey:@"NSRequiresAquaSystemAppearance"]) { Py_RETURN_TRUE; }
|
||||||
|
Py_RETURN_FALSE;
|
||||||
|
}
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static PyMethodDef module_methods[] = {
|
static PyMethodDef module_methods[] = {
|
||||||
|
{"set_requires_aqua_system_appearance", (PyCFunction)set_requires_aqua_system_appearance, METH_O, ""},
|
||||||
|
{"get_requires_aqua_system_appearance", (PyCFunction)get_requires_aqua_system_appearance, METH_NOARGS, ""},
|
||||||
{"transient_scroller", (PyCFunction)transient_scroller, METH_NOARGS, ""},
|
{"transient_scroller", (PyCFunction)transient_scroller, METH_NOARGS, ""},
|
||||||
{"cursor_blink_time", (PyCFunction)cursor_blink_time, METH_NOARGS, ""},
|
{"cursor_blink_time", (PyCFunction)cursor_blink_time, METH_NOARGS, ""},
|
||||||
{"enable_cocoa_multithreading", (PyCFunction)enable_cocoa_multithreading, METH_NOARGS, ""},
|
{"enable_cocoa_multithreading", (PyCFunction)enable_cocoa_multithreading, METH_NOARGS, ""},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user