Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a flush_events method to the MacOSX backend #2245

Merged
merged 1 commit into from Aug 10, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/_macosx.m
Expand Up @@ -248,7 +248,7 @@ static void _dealloc_atsui(void)

static int _draw_path(CGContextRef cr, void* iterator, int nmax)
{
double x1, y1, x2, y2, x3, y3;
double x1, y1, x2, y2;
static unsigned code = STOP;
static double xs, ys;
CGPoint current;
Expand Down Expand Up @@ -3424,6 +3424,20 @@ static void _data_provider_release(void* info, const void* data, size_t size)
return Py_None;
}

static PyObject*
FigureCanvas_flush_events(FigureCanvas* self)
{
View* view = self->view;
if(!view)
{
PyErr_SetString(PyExc_RuntimeError, "NSView* is NULL");
return NULL;
}
[view displayIfNeeded];
Py_INCREF(Py_None);
return Py_None;
}

static PyObject*
FigureCanvas_set_rubberband(FigureCanvas* self, PyObject *args)
{
Expand Down Expand Up @@ -3699,6 +3713,11 @@ static void _data_provider_release(void* info, const void* data, size_t size)
METH_NOARGS,
"Invalidates the canvas."
},
{"flush_events",
(PyCFunction)FigureCanvas_flush_events,
METH_NOARGS,
"Flush the GUI events for the figure."
},
{"set_rubberband",
(PyCFunction)FigureCanvas_set_rubberband,
METH_VARARGS,
Expand Down