Skip to content

Commit 42de0e8

Browse files
committed
Also handle the Cairo backends.
The wait cursor is not animated, though.
1 parent a9376df commit 42de0e8

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/matplotlib/backends/backend_gtk.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -387,16 +387,20 @@ def _render_figure(self, pixmap, width, height):
387387
def expose_event(self, widget, event):
388388
"""Expose_event for all GTK backends. Should not be overridden.
389389
"""
390+
toolbar = self.toolbar
391+
if toolbar:
392+
toolbar.set_cursor(cursors.WAIT)
390393
if GTK_WIDGET_DRAWABLE(self):
391394
if self._need_redraw:
392395
x, y, w, h = self.allocation
393396
self._pixmap_prepare (w, h)
394397
self._render_figure(self._pixmap, w, h)
395398
self._need_redraw = False
396-
397399
x, y, w, h = event.area
398400
self.window.draw_drawable (self.style.fg_gc[self.state],
399401
self._pixmap, x, y, x, y, w, h)
402+
if toolbar:
403+
toolbar.set_cursor(cursors.POINTER)
400404
return False # finish event propagation?
401405

402406
filetypes = FigureCanvasBase.filetypes.copy()

lib/matplotlib/backends/backend_gtk3cairo.py

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from . import backend_cairo, backend_gtk3
77
from .backend_cairo import cairo, HAS_CAIRO_CFFI
88
from .backend_gtk3 import _BackendGTK3
9+
from matplotlib.backend_bases import cursors
910
from matplotlib.figure import Figure
1011

1112

@@ -35,10 +36,15 @@ def _render_figure(self, width, height):
3536
def on_draw_event(self, widget, ctx):
3637
""" GtkDrawable draw event, like expose_event in GTK 2.X
3738
"""
39+
toolbar = self.toolbar
40+
if toolbar:
41+
toolbar.set_cursor(cursors.WAIT)
3842
self._renderer.set_context(ctx)
3943
allocation = self.get_allocation()
4044
x, y, w, h = allocation.x, allocation.y, allocation.width, allocation.height
4145
self._render_figure(w, h)
46+
if toolbar:
47+
toolbar.set_cursor(cursors.POINTER)
4248
return False # finish event propagation?
4349

4450

0 commit comments

Comments
 (0)