From 9d184baa2f8d162cba3ea3b363a8f3453b2d4e36 2021-10-07 00:15:56 From: Thomas A Caswell Date: 2021-10-07 00:15:56 Subject: [PATCH] FIX: make sure all of the Qt backends map to the qt event loop --- diff --git a/IPython/core/pylabtools.py b/IPython/core/pylabtools.py index 3ad575a..7ebcf1e 100644 --- a/IPython/core/pylabtools.py +++ b/IPython/core/pylabtools.py @@ -41,8 +41,6 @@ backends = { # most part it's just a reverse of the above dict, but we also need to add a # few others that map to the same GUI manually: backend2gui = dict(zip(backends.values(), backends.keys())) -# Our tests expect backend2gui to just return 'qt' -backend2gui['Qt4Agg'] = 'qt' # In the reverse mapping, there are a few extra valid matplotlib backends that # map to the same GUI support backend2gui["GTK"] = backend2gui["GTKCairo"] = "gtk" @@ -50,6 +48,13 @@ backend2gui["GTK3Cairo"] = "gtk3" backend2gui["GTK4Cairo"] = "gtk4" backend2gui["WX"] = "wx" backend2gui["CocoaAgg"] = "osx" +# There needs to be a hysteresis here as the new QtAgg Matplotlib backend +# supports either Qt5 or Qt6 and the IPython qt event loop support Qt4, Qt5, +# and Qt6. +backend2gui["QtAgg"] = "qt" +backend2gui["Qt4Agg"] = "qt" +backend2gui["Qt5Agg"] = "qt" + # And some backends that don't need GUI integration del backend2gui["nbAgg"] del backend2gui["agg"]