Show More
@@ -30,9 +30,9 b' IPython.mathjaxutils = (function (IPython) {' | |||
|
30 | 30 | MathJax.Hub.Configured(); |
|
31 | 31 | } else if (window.mathjax_url != "") { |
|
32 | 32 | // Don't have MathJax, but should. Show dialog. |
|
33 |
var |
|
|
33 | var message = $('<div/>') | |
|
34 | 34 | .append( |
|
35 | $("<p></p>").addClass('dialog').html( | |
|
35 | $("<p/></p>").addClass('dialog').html( | |
|
36 | 36 | "Math/LaTeX rendering will be disabled." |
|
37 | 37 | ) |
|
38 | 38 | ).append( |
@@ -68,11 +68,14 b' IPython.mathjaxutils = (function (IPython) {' | |||
|
68 | 68 | $("<p></p>").addClass('dialog').html( |
|
69 | 69 | "which will prevent this dialog from appearing." |
|
70 | 70 | ) |
|
71 |
) |
|
|
72 | title: "Failed to retrieve MathJax from '" + window.mathjax_url + "'", | |
|
73 | width: "70%", | |
|
74 |
|
|
|
75 |
|
|
|
71 | ) | |
|
72 | IPython.dialog.modal({ | |
|
73 | title : "Failed to retrieve MathJax from '" + window.mathjax_url + "'", | |
|
74 | body : message, | |
|
75 | buttons : { | |
|
76 | OK : {class: "btn-danger"} | |
|
77 | } | |
|
78 | }); | |
|
76 | 79 | } else { |
|
77 | 80 | // No MathJax, but none expected. No dialog. |
|
78 | 81 | }; |
@@ -1341,21 +1341,18 b' var IPython = (function (IPython) {' | |||
|
1341 | 1341 | */ |
|
1342 | 1342 | Notebook.prototype.restart_kernel = function () { |
|
1343 | 1343 | var that = this; |
|
1344 | var dialog = $('<div/>'); | |
|
1345 | dialog.html('Do you want to restart the current kernel? You will lose all variables defined in it.'); | |
|
1346 | $(document.body).append(dialog); | |
|
1347 | dialog.dialog({ | |
|
1348 |
|
|
|
1349 | modal: true, | |
|
1350 | title: "Restart kernel or continue running?", | |
|
1351 | closeText: '', | |
|
1344 | IPython.dialog.modal({ | |
|
1345 | title : "Restart kernel or continue running?", | |
|
1346 | body : $("<p/>").html( | |
|
1347 | 'Do you want to restart the current kernel? You will lose all variables defined in it.' | |
|
1348 | ), | |
|
1352 | 1349 | buttons : { |
|
1353 | "Restart": function () { | |
|
1354 |
|
|
|
1355 | $(this).dialog('close'); | |
|
1356 | }, | |
|
1357 | "Continue running": function () { | |
|
1358 |
|
|
|
1350 | "Continue running" : {}, | |
|
1351 | "Restart" : { | |
|
1352 | "class" : "btn-danger", | |
|
1353 | "click" : function() { | |
|
1354 | that.kernel.restart(); | |
|
1355 | } | |
|
1359 | 1356 | } |
|
1360 | 1357 | } |
|
1361 | 1358 | }); |
@@ -1526,24 +1523,16 b' var IPython = (function (IPython) {' | |||
|
1526 | 1523 | }; |
|
1527 | 1524 | }; |
|
1528 | 1525 | if (data.worksheets.length > 1) { |
|
1529 | var dialog = $('<div/>'); | |
|
1530 | dialog.html("This notebook has " + data.worksheets.length + " worksheets, " + | |
|
1531 | "but this version of IPython can only handle the first. " + | |
|
1532 | "If you save this notebook, worksheets after the first will be lost." | |
|
1533 | ); | |
|
1534 | this.element.append(dialog); | |
|
1535 | dialog.dialog({ | |
|
1536 | resizable: false, | |
|
1537 | modal: true, | |
|
1538 | title: "Multiple worksheets", | |
|
1539 | closeText: "", | |
|
1540 | close: function(event, ui) {$(this).dialog('destroy').remove();}, | |
|
1526 | IPython.dialog.modal({ | |
|
1527 | title : "Multiple worksheets", | |
|
1528 | body : "This notebook has " + data.worksheets.length + " worksheets, " + | |
|
1529 | "but this version of IPython can only handle the first. " + | |
|
1530 | "If you save this notebook, worksheets after the first will be lost.", | |
|
1541 | 1531 | buttons : { |
|
1542 |
|
|
|
1543 |
|
|
|
1532 | OK : { | |
|
1533 | class : "btn-danger" | |
|
1544 | 1534 | } |
|
1545 |
} |
|
|
1546 | width: 400 | |
|
1535 | } | |
|
1547 | 1536 | }); |
|
1548 | 1537 | } |
|
1549 | 1538 | }; |
@@ -1722,27 +1711,20 b' var IPython = (function (IPython) {' | |||
|
1722 | 1711 | this.select(0); |
|
1723 | 1712 | this.scroll_to_top(); |
|
1724 | 1713 | if (data.orig_nbformat !== undefined && data.nbformat !== data.orig_nbformat) { |
|
1725 | msg = "This notebook has been converted from an older " + | |
|
1714 | var msg = "This notebook has been converted from an older " + | |
|
1726 | 1715 | "notebook format (v"+data.orig_nbformat+") to the current notebook " + |
|
1727 | 1716 | "format (v"+data.nbformat+"). The next time you save this notebook, the " + |
|
1728 | "newer notebook format will be used and older verions of IPython " + | |
|
1717 | "newer notebook format will be used and older versions of IPython " + | |
|
1729 | 1718 | "may not be able to read it. To keep the older version, close the " + |
|
1730 | 1719 | "notebook without saving it."; |
|
1731 | var dialog = $('<div/>'); | |
|
1732 | dialog.html(msg); | |
|
1733 | this.element.append(dialog); | |
|
1734 | dialog.dialog({ | |
|
1735 | resizable: false, | |
|
1736 | modal: true, | |
|
1737 | title: "Notebook converted", | |
|
1738 | closeText: "", | |
|
1739 | close: function(event, ui) {$(this).dialog('destroy').remove();}, | |
|
1720 | IPython.dialog.modal({ | |
|
1721 | title : "Notebook converted", | |
|
1722 | body : msg, | |
|
1740 | 1723 | buttons : { |
|
1741 |
|
|
|
1742 | $(this).dialog('close'); | |
|
1724 | OK : { | |
|
1725 | class : "btn-primary" | |
|
1743 | 1726 | } |
|
1744 |
} |
|
|
1745 | width: 400 | |
|
1727 | } | |
|
1746 | 1728 | }); |
|
1747 | 1729 | } else if (data.orig_nbformat_minor !== undefined && data.nbformat_minor !== data.orig_nbformat_minor) { |
|
1748 | 1730 | var that = this; |
@@ -1752,21 +1734,14 b' var IPython = (function (IPython) {' | |||
|
1752 | 1734 | this_vs + ". You can still work with this notebook, but some features " + |
|
1753 | 1735 | "introduced in later notebook versions may not be available." |
|
1754 | 1736 | |
|
1755 | var dialog = $('<div/>'); | |
|
1756 | dialog.html(msg); | |
|
1757 | this.element.append(dialog); | |
|
1758 | dialog.dialog({ | |
|
1759 | resizable: false, | |
|
1760 | modal: true, | |
|
1761 | title: "Newer Notebook", | |
|
1762 | closeText: "", | |
|
1763 | close: function(event, ui) {$(this).dialog('destroy').remove();}, | |
|
1737 | IPython.dialog.modal({ | |
|
1738 | title : "Newer Notebook", | |
|
1739 | body : msg, | |
|
1764 | 1740 | buttons : { |
|
1765 |
|
|
|
1766 |
|
|
|
1741 | OK : { | |
|
1742 | class : "btn-danger" | |
|
1767 | 1743 | } |
|
1768 |
} |
|
|
1769 | width: 400 | |
|
1744 | } | |
|
1770 | 1745 | }); |
|
1771 | 1746 | |
|
1772 | 1747 | } |
@@ -1795,21 +1770,13 b' var IPython = (function (IPython) {' | |||
|
1795 | 1770 | "this notebook is in a newer format than is supported by this " + |
|
1796 | 1771 | "version of IPython. This version can load notebook formats " + |
|
1797 | 1772 | "v"+this.nbformat+" or earlier."; |
|
1798 | var dialog = $('<div/>'); | |
|
1799 |
dialog. |
|
|
1800 | this.element.append(dialog); | |
|
1801 | dialog.dialog({ | |
|
1802 | resizable: false, | |
|
1803 | modal: true, | |
|
1773 | ||
|
1774 | IPython.dialog.modal({ | |
|
1804 | 1775 | title: "Error loading notebook", |
|
1805 |
|
|
|
1806 | close: function(event, ui) {$(this).dialog('destroy').remove();}, | |
|
1776 | body : msg, | |
|
1807 | 1777 | buttons : { |
|
1808 |
"OK": |
|
|
1809 | $(this).dialog('close'); | |
|
1810 | } | |
|
1811 | }, | |
|
1812 | width: 400 | |
|
1778 | "OK": {} | |
|
1779 | } | |
|
1813 | 1780 | }); |
|
1814 | 1781 | } |
|
1815 | 1782 | } |
@@ -1917,7 +1884,7 b' var IPython = (function (IPython) {' | |||
|
1917 | 1884 | console.log("restore dialog, but no checkpoint to restore to!"); |
|
1918 | 1885 | return; |
|
1919 | 1886 | } |
|
1920 |
var |
|
|
1887 | var body = $('<div/>').append( | |
|
1921 | 1888 | $('<p/>').addClass("p-space").text( |
|
1922 | 1889 | "Are you sure you want to revert the notebook to " + |
|
1923 | 1890 | "the latest checkpoint?" |
@@ -1934,23 +1901,18 b' var IPython = (function (IPython) {' | |||
|
1934 | 1901 | ).css("text-align", "center") |
|
1935 | 1902 | ); |
|
1936 | 1903 | |
|
1937 | $(document.body).append(dialog); | |
|
1938 | ||
|
1939 | dialog.dialog({ | |
|
1940 | resizable: false, | |
|
1941 | modal: true, | |
|
1942 | title: "Revert notebook to checkpoint", | |
|
1943 | closeText: '', | |
|
1904 | IPython.dialog.modal({ | |
|
1905 | title : "Revert notebook to checkpoint", | |
|
1906 | body : body, | |
|
1944 | 1907 | buttons : { |
|
1945 |
|
|
|
1946 | that.restore_checkpoint(checkpoint.checkpoint_id); | |
|
1947 | $(this).dialog('close'); | |
|
1908 | Revert : { | |
|
1909 | class : "btn-danger", | |
|
1910 | click : function () { | |
|
1911 | that.restore_checkpoint(checkpoint.checkpoint_id); | |
|
1912 | } | |
|
1948 | 1913 | }, |
|
1949 |
|
|
|
1950 | $(this).dialog('close'); | |
|
1914 | Cancel : {} | |
|
1951 | 1915 | } |
|
1952 | }, | |
|
1953 | width: 400 | |
|
1954 | 1916 | }); |
|
1955 | 1917 | } |
|
1956 | 1918 |
@@ -92,28 +92,24 b' var IPython = (function (IPython) {' | |||
|
92 | 92 | }); |
|
93 | 93 | |
|
94 | 94 | $([IPython.events]).on('status_dead.Kernel',function () { |
|
95 | var dialog = $('<div/>'); | |
|
96 | dialog.html('The kernel has died, and the automatic restart has failed.' + | |
|
95 | var msg = 'The kernel has died, and the automatic restart has failed.' + | |
|
97 | 96 | ' It is possible the kernel cannot be restarted.' + |
|
98 | 97 | ' If you are not able to restart the kernel, you will still be able to save' + |
|
99 | 98 | ' the notebook, but running code will no longer work until the notebook' + |
|
100 | ' is reopened.' | |
|
101 | ); | |
|
102 | $(document.body).append(dialog); | |
|
103 | dialog.dialog({ | |
|
104 | resizable: false, | |
|
105 | modal: true, | |
|
99 | ' is reopened.'; | |
|
100 | ||
|
101 | IPython.dialog.modal({ | |
|
106 | 102 | title: "Dead kernel", |
|
107 | close: function(event, ui) {$(this).dialog('destroy').remove();}, | |
|
103 | body : msg, | |
|
108 | 104 | buttons : { |
|
109 |
"Manual Restart": |
|
|
110 | $([IPython.events]).trigger('status_restarting.Kernel'); | |
|
111 | IPython.notebook.start_kernel(); | |
|
112 | $(this).dialog('close'); | |
|
105 | "Manual Restart": { | |
|
106 | class: "btn-danger", | |
|
107 | click: function () { | |
|
108 | $([IPython.events]).trigger('status_restarting.Kernel'); | |
|
109 | IPython.notebook.start_kernel(); | |
|
110 | } | |
|
113 | 111 | }, |
|
114 |
"Don't restart": |
|
|
115 | $(this).dialog('close'); | |
|
116 | } | |
|
112 | "Don't restart": {} | |
|
117 | 113 | } |
|
118 | 114 | }); |
|
119 | 115 | }); |
@@ -134,25 +130,18 b' var IPython = (function (IPython) {' | |||
|
134 | 130 | msg = "A WebSocket connection to could not be established." + |
|
135 | 131 | " You will NOT be able to run code. Check your" + |
|
136 | 132 | " network connection or notebook server configuration."; |
|
137 | var dialog = $('<div/>'); | |
|
138 | dialog.html(msg); | |
|
139 | $(document.body).append(dialog); | |
|
140 | dialog.dialog({ | |
|
141 | resizable: false, | |
|
142 | modal: true, | |
|
133 | IPython.dialog.modal({ | |
|
143 | 134 | title: "WebSocket connection failed", |
|
144 |
|
|
|
145 | close: function(event, ui) {$(this).dialog('destroy').remove();}, | |
|
135 | body: msg, | |
|
146 | 136 | buttons : { |
|
147 |
"OK": |
|
|
148 | $(this).dialog('close'); | |
|
149 |
|
|
|
150 | "Reconnect": function () { | |
|
151 | knw.set_message('Reconnecting WebSockets', 1000); | |
|
152 | setTimeout(function () { | |
|
153 |
|
|
|
154 |
} |
|
|
155 | $(this).dialog('close'); | |
|
137 | "OK": {}, | |
|
138 | "Reconnect": { | |
|
139 | click: function () { | |
|
140 | knw.set_message('Reconnecting WebSockets', 1000); | |
|
141 | setTimeout(function () { | |
|
142 | kernel.start_channels(); | |
|
143 | }, 5000); | |
|
144 | } | |
|
156 | 145 | } |
|
157 | 146 | } |
|
158 | 147 | }); |
@@ -69,28 +69,23 b' var IPython = (function (IPython) {' | |||
|
69 | 69 | |
|
70 | 70 | SaveWidget.prototype.rename_notebook = function () { |
|
71 | 71 | var that = this; |
|
72 | var dialog = $('<div/>'); | |
|
73 | dialog.append( | |
|
74 | $('<p/>').html('Enter a new notebook name:') | |
|
75 | .css({'margin-bottom': '10px'}) | |
|
76 | ); | |
|
72 | var dialog = $('<div/>').append($("<p/>").addClass("rename-message") | |
|
73 | .html('Enter a new notebook name:')); | |
|
77 | 74 | dialog.append( |
|
78 | 75 | $('<input/>').attr('type','text').attr('size','25') |
|
79 | .addClass('ui-widget ui-widget-content') | |
|
80 | .attr('value',IPython.notebook.get_notebook_name()) | |
|
76 | .val(IPython.notebook.get_notebook_name()) | |
|
81 | 77 | ); |
|
82 | // $(document.body).append(dialog); | |
|
83 | dialog.dialog({ | |
|
84 | resizable: false, | |
|
85 | modal: true, | |
|
78 | IPython.dialog.modal({ | |
|
86 | 79 | title: "Rename Notebook", |
|
87 | closeText: "", | |
|
88 | close: function(event, ui) {$(this).dialog('destroy').remove();}, | |
|
80 | body: dialog, | |
|
89 | 81 | buttons : { |
|
90 |
" |
|
|
91 | var new_name = $(this).find('input').attr('value'); | |
|
82 | "Cancel": {}, | |
|
83 | "OK": { | |
|
84 | class: "btn-primary", | |
|
85 | click: function () { | |
|
86 | var new_name = $(this).find('input').val(); | |
|
92 | 87 | if (!IPython.notebook.test_notebook_name(new_name)) { |
|
93 |
$(this).find(' |
|
|
88 | $(this).find('.rename-message').html( | |
|
94 | 89 | "Invalid notebook name. Notebook names must "+ |
|
95 | 90 | "have 1 or more characters and can contain any characters " + |
|
96 | 91 | "except :/\\. Please enter a new notebook name:" |
@@ -98,21 +93,18 b' var IPython = (function (IPython) {' | |||
|
98 | 93 | } else { |
|
99 | 94 | IPython.notebook.set_notebook_name(new_name); |
|
100 | 95 | IPython.notebook.save_notebook(); |
|
101 | $(this).dialog('close'); | |
|
102 | 96 | } |
|
97 | }} | |
|
103 | 98 | }, |
|
104 | "Cancel": function () { | |
|
105 | $(this).dialog('close'); | |
|
106 | } | |
|
107 | }, | |
|
108 | 99 | open : function (event, ui) { |
|
109 | 100 | var that = $(this); |
|
110 | 101 | // Upon ENTER, click the OK button. |
|
111 | 102 | that.find('input[type="text"]').keydown(function (event, ui) { |
|
112 | 103 | if (event.which === utils.keycodes.ENTER) { |
|
113 |
that. |
|
|
104 | that.find('.btn-primary').first().click(); | |
|
114 | 105 | } |
|
115 | 106 | }); |
|
107 | that.find('input[type="text"]').focus(); | |
|
116 | 108 | } |
|
117 | 109 | }); |
|
118 | 110 | } |
@@ -220,6 +220,7 b' class="notebook_app"' | |||
|
220 | 220 | |
|
221 | 221 | <script src="{{ static_url("base/js/events.js") }}" type="text/javascript" charset="utf-8"></script> |
|
222 | 222 | <script src="{{ static_url("base/js/utils.js") }}" type="text/javascript" charset="utf-8"></script> |
|
223 | <script src="{{ static_url("base/js/dialog.js") }}" type="text/javascript" charset="utf-8"></script> | |
|
223 | 224 | <script src="{{ static_url("notebook/js/layoutmanager.js") }}" type="text/javascript" charset="utf-8"></script> |
|
224 | 225 | <script src="{{ static_url("notebook/js/mathjaxutils.js") }}" type="text/javascript" charset="utf-8"></script> |
|
225 | 226 | <script src="{{ static_url("notebook/js/outputarea.js") }}" type="text/javascript" charset="utf-8"></script> |
General Comments 0
You need to be logged in to leave comments.
Login now