##// END OF EJS Templates
Backport PR #2773: Fixed minor typo causing AttributeError to be thrown....
Backport PR #2773: Fixed minor typo causing AttributeError to be thrown. I'm not sure how I caused the error to be thrown and couldn't reproduce it with the same call again, nevertheless I think the fix is correct. ```python In [21]: rc.shutdown(hub=True) Traceback (most recent call last): File "<ipython-input-21-977a05a15f31>", line 1, in <module> rc.shutdown(hub=True) File "<string>", line 2, in shutdown File "c:\dev\code\ipython\IPython\parallel\client\client.py", line 69, in spin_first self.spin() File "c:\dev\code\ipython\IPython\parallel\client\client.py", line 1005, in spin self._flush_notifications() File "c:\dev\code\ipython\IPython\parallel\client\client.py", line 800, in _flush_notifications raise Exception("Unhandled message type: %s"%msg.msg_type) AttributeError: 'dict' object has no attribute 'msg_type' ```

File last commit:

r5970:b6bb1663
r9855:7ad908bf
Show More
dialog.js
62 lines | 1.9 KiB | application/javascript | JavascriptLexer
// Open simple dialogs on top of an editor. Relies on dialog.css.
(function() {
function dialogDiv(cm, template) {
var wrap = cm.getWrapperElement();
var dialog = wrap.insertBefore(document.createElement("div"), wrap.firstChild);
dialog.className = "CodeMirror-dialog";
dialog.innerHTML = '<div>' + template + '</div>';
return dialog;
}
CodeMirror.defineExtension("openDialog", function(template, callback) {
var dialog = dialogDiv(this, template);
var closed = false, me = this;
function close() {
if (closed) return;
closed = true;
dialog.parentNode.removeChild(dialog);
}
var inp = dialog.getElementsByTagName("input")[0];
if (inp) {
CodeMirror.connect(inp, "keydown", function(e) {
if (e.keyCode == 13 || e.keyCode == 27) {
CodeMirror.e_stop(e);
close();
me.focus();
if (e.keyCode == 13) callback(inp.value);
}
});
inp.focus();
CodeMirror.connect(inp, "blur", close);
}
return close;
});
CodeMirror.defineExtension("openConfirm", function(template, callbacks) {
var dialog = dialogDiv(this, template);
var buttons = dialog.getElementsByTagName("button");
var closed = false, me = this, blurring = 1;
function close() {
if (closed) return;
closed = true;
dialog.parentNode.removeChild(dialog);
me.focus();
}
buttons[0].focus();
for (var i = 0; i < buttons.length; ++i) {
var b = buttons[i];
(function(callback) {
CodeMirror.connect(b, "click", function(e) {
CodeMirror.e_preventDefault(e);
close();
if (callback) callback(me);
});
})(callbacks[i]);
CodeMirror.connect(b, "blur", function() {
--blurring;
setTimeout(function() { if (blurring <= 0) close(); }, 200);
});
CodeMirror.connect(b, "focus", function() { ++blurring; });
}
});
})();