|
48 | 48 | cursord = {} # deprecated in Matplotlib 3.5. |
49 | 49 |
|
50 | 50 |
|
| 51 | +@functools.lru_cache() |
| 52 | +def _mpl_to_gtk_cursor(mpl_cursor): |
| 53 | + name = { |
| 54 | + cursors.MOVE: "move", |
| 55 | + cursors.HAND: "pointer", |
| 56 | + cursors.POINTER: "default", |
| 57 | + cursors.SELECT_REGION: "crosshair", |
| 58 | + cursors.WAIT: "wait", |
| 59 | + }[mpl_cursor] |
| 60 | + return Gdk.Cursor.new_from_name(Gdk.Display.get_default(), name) |
| 61 | + |
| 62 | + |
51 | 63 | class TimerGTK3(TimerBase): |
52 | 64 | """Subclass of `.TimerBase` using GTK3 timer events.""" |
53 | 65 |
|
@@ -484,22 +496,10 @@ def set_message(self, s): |
484 | 496 | escaped = GLib.markup_escape_text(s) |
485 | 497 | self.message.set_markup(f'<small>{escaped}</small>') |
486 | 498 |
|
487 | | - @staticmethod |
488 | | - @functools.lru_cache() |
489 | | - def _mpl_to_gtk_cursor(mpl_cursor): |
490 | | - name = { |
491 | | - cursors.MOVE: "move", |
492 | | - cursors.HAND: "pointer", |
493 | | - cursors.POINTER: "default", |
494 | | - cursors.SELECT_REGION: "crosshair", |
495 | | - cursors.WAIT: "wait", |
496 | | - }[mpl_cursor] |
497 | | - return Gdk.Cursor.new_from_name(Gdk.Display.get_default(), name) |
498 | | - |
499 | 499 | def set_cursor(self, cursor): |
500 | 500 | window = self.canvas.get_property("window") |
501 | 501 | if window is not None: |
502 | | - window.set_cursor(self._mpl_to_gtk_cursor(cursor)) |
| 502 | + window.set_cursor(_mpl_to_gtk_cursor(cursor)) |
503 | 503 | Gtk.main_iteration() |
504 | 504 |
|
505 | 505 | def draw_rubberband(self, event, x0, y0, x1, y1): |
|
0 commit comments