|
40 | 40 | # for some info about screen dpi |
41 | 41 | PIXELS_PER_INCH = 75 |
42 | 42 |
|
43 | | -# Delay time for idle checks |
44 | | -IDLE_DELAY = 5 # Documented as deprecated as of Matplotlib 3.1. |
| 43 | + |
| 44 | +# module-level deprecations. |
| 45 | +@functools.lru_cache(None) |
| 46 | +def __getattr__(name): |
| 47 | + if name == "IDLE_DELAY": |
| 48 | + _api.warn_deprecated("3.1", name=name) |
| 49 | + return 5 |
| 50 | + elif name == "cursord": |
| 51 | + _api.warn_deprecated("3.5", name=name) |
| 52 | + return { # deprecated in Matplotlib 3.5. |
| 53 | + cursors.MOVE: wx.CURSOR_HAND, |
| 54 | + cursors.HAND: wx.CURSOR_HAND, |
| 55 | + cursors.POINTER: wx.CURSOR_ARROW, |
| 56 | + cursors.SELECT_REGION: wx.CURSOR_CROSS, |
| 57 | + cursors.WAIT: wx.CURSOR_WAIT, |
| 58 | + cursors.RESIZE_HORIZONTAL: wx.CURSOR_SIZEWE, |
| 59 | + cursors.RESIZE_VERTICAL: wx.CURSOR_SIZENS, |
| 60 | + } |
| 61 | + else: |
| 62 | + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") |
45 | 63 |
|
46 | 64 |
|
47 | 65 | def error_msg_wx(msg, parent=None): |
@@ -721,7 +739,15 @@ def _onKeyUp(self, event): |
721 | 739 |
|
722 | 740 | def set_cursor(self, cursor): |
723 | 741 | # docstring inherited |
724 | | - cursor = wx.Cursor(_api.check_getitem(cursord, cursor=cursor)) |
| 742 | + cursor = wx.Cursor(_api.check_getitem({ |
| 743 | + cursors.MOVE: wx.CURSOR_HAND, |
| 744 | + cursors.HAND: wx.CURSOR_HAND, |
| 745 | + cursors.POINTER: wx.CURSOR_ARROW, |
| 746 | + cursors.SELECT_REGION: wx.CURSOR_CROSS, |
| 747 | + cursors.WAIT: wx.CURSOR_WAIT, |
| 748 | + cursors.RESIZE_HORIZONTAL: wx.CURSOR_SIZEWE, |
| 749 | + cursors.RESIZE_VERTICAL: wx.CURSOR_SIZENS, |
| 750 | + }, cursor=cursor)) |
725 | 751 | self.SetCursor(cursor) |
726 | 752 | self.Update() |
727 | 753 |
|
@@ -1049,17 +1075,6 @@ def _set_frame_icon(frame): |
1049 | 1075 | frame.SetIcons(bundle) |
1050 | 1076 |
|
1051 | 1077 |
|
1052 | | -cursord = { # deprecated in Matplotlib 3.5. |
1053 | | - cursors.MOVE: wx.CURSOR_HAND, |
1054 | | - cursors.HAND: wx.CURSOR_HAND, |
1055 | | - cursors.POINTER: wx.CURSOR_ARROW, |
1056 | | - cursors.SELECT_REGION: wx.CURSOR_CROSS, |
1057 | | - cursors.WAIT: wx.CURSOR_WAIT, |
1058 | | - cursors.RESIZE_HORIZONTAL: wx.CURSOR_SIZEWE, |
1059 | | - cursors.RESIZE_VERTICAL: wx.CURSOR_SIZENS, |
1060 | | -} |
1061 | | - |
1062 | | - |
1063 | 1078 | class NavigationToolbar2Wx(NavigationToolbar2, wx.ToolBar): |
1064 | 1079 | def __init__(self, canvas, coordinates=True): |
1065 | 1080 | wx.ToolBar.__init__(self, canvas.GetParent(), -1) |
|
0 commit comments