8000 Use enum.auto for Cursors enum. · ianhi/matplotlib@ff1eaa4 · GitHub
[go: up one dir, main page]

Skip to content

Commit ff1eaa4

Browse files
committed
Use enum.auto for Cursors enum.
1 parent 1e3f7f3 commit ff1eaa4

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

lib/matplotlib/backend_tools.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
`matplotlib.backend_managers.ToolManager`
1212
"""
1313

14-
from enum import IntEnum
14+
import enum
1515
import re
1616
import time
1717
from types import SimpleNamespace
@@ -25,9 +25,13 @@
2525
from matplotlib import cbook
2626

2727

28-
class Cursors(IntEnum): # Must subclass int for the macOS backend.
28+
class Cursors(enum.IntEnum): # Must subclass int for the macOS backend.
2929
"""Backend-independent cursor types."""
30-
HAND, POINTER, SELECT_REGION, MOVE, WAIT = range(5)
30+
POINTER = enum.auto()
31+
HAND = enum.auto()
32+
SELECT_REGION = enum.auto()
33+
MOVE = enum.auto()
34+
WAIT = enum.auto()
3135
cursors = Cursors # Backcompat.
3236

3337
# Views positions tool

src/_macosx.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,13 +1373,13 @@ -(void)save_figure:(id)sender
13731373
{
13741374
int i;
13751375
if(!PyArg_ParseTuple(args, "i", &i)) return NULL;
1376-
switch (i)
1377-
{ case 0: [[NSCursor pointingHandCursor] set]; break;
1376+
switch (i) {
13781377
case 1: [[NSCursor arrowCursor] set]; break;
1379-
case 2: [[NSCursor crosshairCursor] set]; break;
1380-
case 3: [[NSCursor openHandCursor] set]; break;
1378+
case 2: [[NSCursor pointingHandCursor] set]; break;
1379+
case 3: [[NSCursor crosshairCursor] set]; break;
1380+
case 4: [[NSCursor openHandCursor] set]; break;
13811381
/* OSX handles busy state itself so no need to set a cursor here */
1382-
case 4: break;
1382+
case 5: break;
13831383
default: return NULL;
13841384
}
13851385
Py_RETURN_NONE;

0 commit comments

Comments
 (0)
0