@@ -361,6 +361,25 @@ static CGFloat _get_device_scale(CGContextRef cr)
361361 Py_RETURN_NONE;
362362}
363363
364+ static PyObject*
365+ FigureCanvas_set_cursor (PyObject* unused, PyObject* args)
366+ {
367+ int i;
368+ if (!PyArg_ParseTuple (args, " i" , &i)) { return NULL ; }
369+ switch (i) {
370+ case 1 : [[NSCursor arrowCursor ] set ]; break ;
371+ case 2 : [[NSCursor pointingHandCursor ] set ]; break ;
372+ case 3 : [[NSCursor crosshairCursor ] set ]; break ;
373+ case 4 : [[NSCursor openHandCursor ] set ]; break ;
374+ /* OSX handles busy state itself so no need to set a cursor here */
375+ case 5 : break ;
376+ case 6 : [[NSCursor resizeLeftRightCursor ] set ]; break ;
377+ case 7 : [[NSCursor resizeUpDownCursor ] set ]; break ;
378+ default : return NULL ;
379+ }
380+ Py_RETURN_NONE;
381+ }
382+
364383static PyObject*
365384FigureCanvas_set_rubberband (FigureCanvas* self, PyObject *args)
366385{
@@ -489,14 +508,18 @@ static CGFloat _get_device_scale(CGContextRef cr)
489508 (PyCFunction)FigureCanvas_flush_events,
490509 METH_NOARGS,
491510 NULL }, // docstring inherited
511+ {" set_cursor" ,
512+ (PyCFunction)FigureCanvas_set_cursor,
513+ METH_VARARGS,
514+ " Set the active cursor." },
492515 {" set_rubberband" ,
493516 (PyCFunction)FigureCanvas_set_rubberband,
494517 METH_VARARGS,
495- " Specifies a new rubberband rectangle and invalidates it." },
518+ " Specify a new rubberband rectangle and invalidate it." },
496519 {" remove_rubberband" ,
497520 (PyCFunction)FigureCanvas_remove_rubberband,
498521 METH_NOARGS,
499- " Removes the current rubberband rectangle." },
522+ " Remove the current rubberband rectangle." },
500523 {" start_event_loop" ,
501524 (PyCFunction)FigureCanvas_start_event_loop,
502525 METH_KEYWORDS | METH_VARARGS,
@@ -1020,25 +1043,6 @@ -(void)save_figure:(id)sender { gil_call_method(toolbar, "save_figure"); }
10201043 Py_RETURN_NONE;
10211044}
10221045
1023- static PyObject*
1024- set_cursor (PyObject* unused, PyObject* args)
1025- {
1026- int i;
1027- if (!PyArg_ParseTuple (args, " i" , &i)) { return NULL ; }
1028- switch (i) {
1029- case 1 : [[NSCursor arrowCursor ] set ]; break ;
1030- case 2 : [[NSCursor pointingHandCursor ] set ]; break ;
1031- case 3 : [[NSCursor crosshairCursor ] set ]; break ;
1032- case 4 : [[NSCursor openHandCursor ] set ]; break ;
1033- /* OSX handles busy state itself so no need to set a cursor here */
1034- case 5 : break ;
1035- case 6 : [[NSCursor resizeLeftRightCursor ] set ]; break ;
1036- case 7 : [[NSCursor resizeUpDownCursor ] set ]; break ;
1037- default : return NULL ;
1038- }
1039- Py_RETURN_NONE;
1040- }
1041-
10421046@implementation WindowServerConnectionManager
10431047static WindowServerConnectionManager *sharedWindowServerConnectionManager = nil ;
10441048
@@ -1916,10 +1920,6 @@ static void context_cleanup(const void* info)
19161920 (PyCFunction)choose_save_file,
19171921 METH_VARARGS,
19181922 " Query the user for a location where to save a file." },
1919- {" set_cursor" ,
1920- (PyCFunction)set_cursor,
1921- METH_VARARGS,
1922- " Set the active cursor." },
19231923 {} /* Sentinel */
19241924 },
19251925};
0 commit comments