diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-03-07 01:45:11 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-03-07 01:45:11 +0300 |
commit | 955e1b7ba0300035d0a2f64847d4554dec1a2db4 (patch) | |
tree | ed3f9c81945a61be2bf2783ea9b006b74953a234 /source/blender/python | |
parent | ff63ac4bcda3da68008021ee072d89ecb0396dd7 (diff) |
PyAPI - Window.TestBreak() - True if the user pressed escape.
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/api2_2x/Window.c | 15 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Window.py | 6 |
2 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/python/api2_2x/Window.c b/source/blender/python/api2_2x/Window.c index 21caab3e697..2a2336c101c 100644 --- a/source/blender/python/api2_2x/Window.c +++ b/source/blender/python/api2_2x/Window.c @@ -106,6 +106,7 @@ static PyObject *M_Window_QTest( PyObject * self ); static PyObject *M_Window_QRead( PyObject * self ); static PyObject *M_Window_QAdd( PyObject * self, PyObject * args ); static PyObject *M_Window_QHandle( PyObject * self, PyObject * args ); +static PyObject *M_Window_TestBreak( PyObject * self ); static PyObject *M_Window_GetMouseCoords( PyObject * self ); static PyObject *M_Window_SetMouseCoords( PyObject * self, PyObject * args ); static PyObject *M_Window_GetMouseButtons( PyObject * self ); @@ -250,6 +251,9 @@ static char M_Window_QHandle_doc[] = (win) - int: the window id, see Blender.Window.GetScreenInfo().\n\n\ See Blender.Window.QAdd() for how to send events to a particular window."; +static char M_Window_TestBreak_doc[] = + "() - Returns true if the user has pressed escape."; + static char M_Window_GetMouseCoords_doc[] = "() - Get mouse pointer's current screen coordinates."; @@ -373,6 +377,8 @@ struct PyMethodDef M_Window_methods[] = { M_Window_QAdd_doc}, {"QHandle", ( PyCFunction ) M_Window_QHandle, METH_VARARGS, M_Window_QHandle_doc}, + {"TestBreak", ( PyCFunction ) M_Window_TestBreak, METH_VARARGS, + M_Window_TestBreak_doc}, {"GetMouseCoords", ( PyCFunction ) M_Window_GetMouseCoords, METH_NOARGS, M_Window_GetMouseCoords_doc}, @@ -1262,6 +1268,15 @@ static PyObject *M_Window_QHandle( PyObject * self, PyObject * args ) Py_RETURN_NONE; } +static PyObject *M_Window_TestBreak( PyObject * self ) +{ + if (blender_test_break()) { + Py_RETURN_TRUE; + } else { + Py_RETURN_FALSE; + } +} + static PyObject *M_Window_GetMouseCoords( PyObject * self ) { short mval[2]; diff --git a/source/blender/python/api2_2x/doc/Window.py b/source/blender/python/api2_2x/doc/Window.py index 7fceeb757de..1625e4d4082 100644 --- a/source/blender/python/api2_2x/doc/Window.py +++ b/source/blender/python/api2_2x/doc/Window.py @@ -434,6 +434,12 @@ def QHandle (winId): @param winId: the window id, see L{GetScreenInfo}. @note: see L{QAdd} for how to send events to a particular window. """ +def TestBreak (): + """ + Return true if the user has pressed escape + @rtype: bool + @return: a boolean from a test if the user pressed escape + """ def GetMouseCoords (): """ |