##// END OF EJS Templates
Convert "osx" gui framework to/from "macosx" in Matplotlib
Ian Thomas -
Show More
@@ -345,8 +345,10 b' def find_gui_and_backend(gui=None, gui_select=None):'
345 345 backend = matplotlib.rcParamsOrig["backend"]
346 346 backend, gui = backend_registry.resolve_backend(backend)
347 347 else:
348 gui = _convert_gui_to_matplotlib(gui)
348 349 backend, gui = backend_registry.resolve_gui_or_backend(gui)
349 350
351 gui = _convert_gui_from_matplotlib(gui)
350 352 return gui, backend
351 353
352 354 # Fallback to previous behaviour (Matplotlib < 3.9)
@@ -509,10 +511,28 b' def _list_matplotlib_backends_and_gui_loops() -> list[str]:'
509 511 if _matplotlib_manages_backends():
510 512 from matplotlib.backends.registry import backend_registry
511 513
512 ret = backend_registry.list_all() + backend_registry.list_gui_frameworks()
514 ret = backend_registry.list_all() + [
515 _convert_gui_from_matplotlib(gui)
516 for gui in backend_registry.list_gui_frameworks()
517 ]
513 518 else:
514 519 from IPython.core import pylabtools
515 520
516 521 ret = list(pylabtools.backends.keys())
517 522
518 523 return sorted(["auto"] + ret)
524
525
526 # Matplotlib and IPython do not always use the same gui framework name.
527 # Always use the approprate one of these conversion functions when passing a
528 # gui framework name to/from Matplotlib.
529 def _convert_gui_to_matplotlib(gui: str | None) -> str | None:
530 if gui and gui.lower() == "osx":
531 return "macosx"
532 return gui
533
534
535 def _convert_gui_from_matplotlib(gui: str | None) -> str | None:
536 if gui and gui.lower() == "macosx":
537 return "osx"
538 return gui
General Comments 0
You need to be logged in to leave comments. Login now