|
72 | 72 | _log = logging.getLogger(__name__) |
73 | 73 |
|
74 | 74 |
|
75 | | -## Backend detection ## |
76 | | - |
77 | | - |
78 | | -# FIXME: Deprecate. |
79 | | -def _backend_selection(): |
80 | | - """ |
81 | | - If rcParams['backend_fallback'] is true, we will check (at backend |
82 | | - load-time) to see if the current backend is compatible with the current |
83 | | - running event loop, and if not switches to a compatible one. |
84 | | - """ |
85 | | - if rcParams["backend_fallback"]: |
86 | | - if (dict.__getitem__(rcParams, "backend") in _interactive_bk |
87 | | - and _get_running_interactive_framework()): |
88 | | - dict.__setitem__( |
89 | | - rcParams, "backend", rcsetup._auto_backend_sentinel) |
90 | | - |
91 | | - |
92 | | -_backend_selection() |
93 | | - |
94 | | - |
95 | 75 | ## Global ## |
96 | 76 |
|
97 | 77 |
|
@@ -2380,16 +2360,23 @@ def _autogen_docstring(base): |
2380 | 2360 | return lambda func: addendum(docstring.copy_dedent(base)(func)) |
2381 | 2361 |
|
2382 | 2362 |
|
2383 | | -# just to be safe. Interactive mode can be turned on without |
| 2363 | +# If rcParams['backend_fallback'] is true, and an interactive backend is |
| 2364 | +# requested, ignore rcParams['backend'] and force selection of a backend that |
| 2365 | +# is compatible with the current running interactive framework. |
| 2366 | +if (rcParams["backend_fallback"] |
| 2367 | + and dict.__getitem__(rcParams, "backend") in _interactive_bk |
| 2368 | + and _get_running_interactive_framework()): |
| 2369 | + dict.__setitem__(rcParams, "backend", rcsetup._auto_backend_sentinel) |
| 2370 | +# Set up the backend. |
| 2371 | +switch_backend(rcParams["backend"]) |
| 2372 | + |
| 2373 | +# Just to be safe. Interactive mode can be turned on without |
2384 | 2374 | # calling `plt.ion()` so register it again here. |
2385 | 2375 | # This is safe because multiple calls to `install_repl_displayhook` |
2386 | 2376 | # are no-ops and the registered function respect `mpl.is_interactive()` |
2387 | 2377 | # to determine if they should trigger a draw. |
2388 | 2378 | install_repl_displayhook() |
2389 | 2379 |
|
2390 | | -# Set up the backend. |
2391 | | -switch_backend(rcParams["backend"]) |
2392 | | - |
2393 | 2380 |
|
2394 | 2381 | ################# REMAINING CONTENT GENERATED BY boilerplate.py ############## |
2395 | 2382 |
|
|
0 commit comments