Expose pause_rendering to Python

This commit is contained in:
Kovid Goyal 2024-04-12 11:39:24 +05:30
parent e0374ee623
commit cf0a5fb607
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 11 additions and 0 deletions

View file

@ -1217,6 +1217,7 @@ class Screen:
def change_pointer_shape(self, op: str, name: str) -> None: ...
def bell(self) -> None: ...
def pause_rendering(self, pause: bool = True, for_how_long_in_ms: int = 100) -> bool: ...
def set_tab_bar_render_data(
os_window_id: int, screen: Screen, left: int, top: int, right: int, bottom: int

View file

@ -4383,6 +4383,15 @@ toggle_alt_screen(Screen *self, PyObject *a UNUSED) {
Py_RETURN_NONE;
}
static PyObject*
pause_rendering(Screen *self, PyObject *args) {
int msec = 100;
int pause = 1;
if (!PyArg_ParseTuple(args, "|pi", &msec)) return NULL;
if (screen_pause_rendering(self, pause, msec)) Py_RETURN_TRUE;
Py_RETURN_FALSE;
}
static PyObject*
send_escape_code_to_child(Screen *self, PyObject *args) {
int code;
@ -4774,6 +4783,7 @@ static PyMethodDef methods[] = {
MND(scroll, METH_VARARGS)
MND(scroll_to_prompt, METH_VARARGS)
MND(send_escape_code_to_child, METH_VARARGS)
MND(pause_rendering, METH_VARARGS)
MND(hyperlink_at, METH_VARARGS)
MND(toggle_alt_screen, METH_NOARGS)
MND(reset_callbacks, METH_NOARGS)