Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3e4620a

Browse files
committed
Fixed firefox keyboard focus bug with nbagg backend.
1 parent 31f305e commit 3e4620a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/matplotlib/backends/backend_webagg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
from matplotlib.figure import Figure
4040
from matplotlib._pylab_helpers import Gcf
4141
from . import backend_webagg_core as core
42-
from . import backend_nbagg
42+
from .backend_nbagg import TimerTornado
4343

4444

4545
def new_figure_manager(num, *args, **kwargs):
@@ -103,7 +103,7 @@ def show(self):
103103
show()
104104

105105
def new_timer(self, *args, **kwargs):
106-
return backend_nbagg.TimerTornado(*args, **kwargs)
106+
return TimerTornado(*args, **kwargs)
107107

108108
def start_event_loop(self, timeout):
109109
backend_bases.FigureCanvasBase.start_event_loop_default(

lib/matplotlib/backends/web_backend/nbagg_mpl.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ mpl.figure.prototype.handle_close = function(fig, msg) {
5555
// Update the output cell to use the data from the current canvas.
5656
fig.push_to_output();
5757
var dataURL = fig.canvas.toDataURL();
58+
// Re-enable the keyboard manager in IPython - without this line, in FF,
59+
// the notebook keyboard shortcuts fail.
60+
IPython.keyboard_manager.enable()
5861
$(fig.parent_element).html('<img src="' + dataURL + '">');
5962
fig.send_message('closing', {});
6063
fig.ws.close()

0 commit comments

Comments
 (0)