Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

Commit d791465

Browse files
FIX: unbreak ipympl
We must not try to make a toolbar for the classes in backend_webaggcore because ipympl inherits from these classes and requires its own toolbar to be used. This also fixes the webagg embedding example without breaking ipympl. closes matplotlib#23699
1 parent 942aa77 commit d791465

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

‎examples/user_interfaces/embedding_webagg_sgskip.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131

3232
import matplotlib as mpl
33-
from matplotlib.backends.backend_webagg_core import (
33+
from matplotlib.backends.backend_webagg import (
3434
FigureManagerWebAgg, new_figure_manager_given_figure)
3535
from matplotlib.figure import Figure
3636

‎lib/matplotlib/backends/backend_webagg_core.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,9 @@ def set_history_buttons(self):
427427

428428

429429
class FigureManagerWebAgg(backend_bases.FigureManagerBase):
430-
_toolbar2_class = ToolbarCls = NavigationToolbar2WebAgg
430+
# This must be None to not break ipympl
431+
_toolbar2_class = None
432+
ToolbarCls = NavigationToolbar2WebAgg
431433

432434
def __init__(self, canvas, num):
433435
self.web_sockets = set()

‎lib/matplotlib/tests/test_backend_webagg.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import sys
44
import pytest
5+
import matplotlib.backends.backend_webagg_core
56

67

78
@pytest.mark.parametrize("backend", ["webagg", "nbagg"])
@@ -25,3 +26,8 @@ def test_webagg_fallback(backend):
2526
ret = subprocess.call([sys.executable, "-c", test_code], env=env)
2627

2728
assert ret == 0
29+
30+
31+
def test_webagg_core_no_toolbar():
32+
fm = matplotlib.backends.backend_webagg_core.FigureManagerWebAgg
33+
assert fm._toolbar2_class is None

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /