49 lines
1.9 KiB
Diff
49 lines
1.9 KiB
Diff
refer: https://github.com/matplotlib/matplotlib/commit/014df7f0eb3139f19641e4f92d49876f7dc2b371
|
|
|
|
diff --git a/lib/matplotlib/backends/backend_gtk3.py b/lib/matplotlib/backends/backend_gtk3.py
|
|
index 359b8fd..0a6979a 100644
|
|
--- a/lib/matplotlib/backends/backend_gtk3.py
|
|
+++ b/lib/matplotlib/backends/backend_gtk3.py
|
|
@@ -1,6 +1,6 @@
|
|
from __future__ import (absolute_import, division, print_function,
|
|
unicode_literals)
|
|
-
|
|
+import functools
|
|
import six
|
|
|
|
import logging
|
|
@@ -28,14 +28,25 @@ backend_version = "%s.%s.%s" % (
|
|
# see http://groups.google.com/groups?q=screen+dpi+x11&hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&selm=7077.26e81ad5%40swift.cs.tcd.ie&rnum=5 for some info about screen dpi
|
|
PIXELS_PER_INCH = 96
|
|
|
|
-cursord = {
|
|
- cursors.MOVE : Gdk.Cursor.new(Gdk.CursorType.FLEUR),
|
|
- cursors.HAND : Gdk.Cursor.new(Gdk.CursorType.HAND2),
|
|
- cursors.POINTER : Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR),
|
|
- cursors.SELECT_REGION : Gdk.Cursor.new(Gdk.CursorType.TCROSS),
|
|
- cursors.WAIT : Gdk.Cursor.new(Gdk.CursorType.WATCH),
|
|
- }
|
|
-
|
|
+# module-level deprecations.
|
|
+@functools.lru_cache(None)
|
|
+def __getattr__(name):
|
|
+ if name == "cursord":
|
|
+ _api.warn_deprecated("3.5", name=name)
|
|
+ try:
|
|
+ new_cursor = functools.partial(
|
|
+ Gdk.Cursor.new_from_name, Gdk.Display.get_default())
|
|
+ return {
|
|
+ Cursors.MOVE: new_cursor("move"),
|
|
+ Cursors.HAND: new_cursor("pointer"),
|
|
+ Cursors.POINTER: new_cursor("default"),
|
|
+ Cursors.SELECT_REGION: new_cursor("crosshair"),
|
|
+ Cursors.WAIT: new_cursor("wait"),
|
|
+ }
|
|
+ except TypeError as exc:
|
|
+ return {}
|
|
+ else:
|
|
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
|
|
class TimerGTK3(TimerBase):
|
|
'''
|