DRYer
This commit is contained in:
parent
4acc692a94
commit
ea414945f2
@ -794,7 +794,4 @@ class Boss:
|
|||||||
setattr(self.opts, k, color_from_int(v))
|
setattr(self.opts, k, color_from_int(v))
|
||||||
for tm in self.all_tab_managers:
|
for tm in self.all_tab_managers:
|
||||||
tm.tab_bar.patch_colors(spec)
|
tm.tab_bar.patch_colors(spec)
|
||||||
if not configured:
|
patch_global_colors(spec, configured)
|
||||||
spec = spec.copy()
|
|
||||||
spec.pop('background', None)
|
|
||||||
patch_global_colors(spec)
|
|
||||||
|
|||||||
@ -653,13 +653,19 @@ PYWRAP1(set_boss) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PYWRAP1(patch_global_colors) {
|
PYWRAP1(patch_global_colors) {
|
||||||
|
PyObject *spec;
|
||||||
|
int configured;
|
||||||
|
if (!PyArg_ParseTuple(args, "Op", &spec, &configured)) return NULL;
|
||||||
#define P(name) { \
|
#define P(name) { \
|
||||||
PyObject *val = PyDict_GetItemString(args, #name); \
|
PyObject *val = PyDict_GetItemString(spec, #name); \
|
||||||
if (val) { \
|
if (val) { \
|
||||||
global_state.opts.name = PyLong_AsLong(val); \
|
global_state.opts.name = PyLong_AsLong(val); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
P(url_color); P(active_border_color); P(inactive_border_color); P(bell_border_color); P(background);
|
P(active_border_color); P(inactive_border_color); P(bell_border_color);
|
||||||
|
if (configured) {
|
||||||
|
P(background); P(url_color);
|
||||||
|
}
|
||||||
if (PyErr_Occurred()) return NULL;
|
if (PyErr_Occurred()) return NULL;
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
@ -717,7 +723,7 @@ static PyMethodDef module_methods[] = {
|
|||||||
MW(global_font_size, METH_VARARGS),
|
MW(global_font_size, METH_VARARGS),
|
||||||
MW(os_window_font_size, METH_VARARGS),
|
MW(os_window_font_size, METH_VARARGS),
|
||||||
MW(set_boss, METH_O),
|
MW(set_boss, METH_O),
|
||||||
MW(patch_global_colors, METH_O),
|
MW(patch_global_colors, METH_VARARGS),
|
||||||
MW(destroy_global_data, METH_NOARGS),
|
MW(destroy_global_data, METH_NOARGS),
|
||||||
|
|
||||||
{NULL, NULL, 0, NULL} /* Sentinel */
|
{NULL, NULL, 0, NULL} /* Sentinel */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user