Skip to content

Commit 7751d7a

Browse files
committed
bah
1 parent e6ecd36 commit 7751d7a

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

‎v3/js/opt-office-mix.js‎

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3737

3838

3939
function executeCode(forceStartingInstr, forceRawInputLst) {
40+
$('#loadingPane').html('Please wait ... executing Python code.').show();
41+
4042
if (forceRawInputLst !== undefined) {
4143
rawInputLst = forceRawInputLst; // UGLY global across modules, FIXME
4244
}
@@ -79,6 +81,17 @@ function executeCode(forceStartingInstr, forceRawInputLst) {
7981

8082
function optFinishSuccessfulExecution() {
8183
enterDisplayMode(); // do this first!
84+
$('#pyOutputPane #editCodeLinkDiv').hide(); // don't have explicit "Edit code" link
85+
$('#loadingPane').hide();
86+
}
87+
88+
// override setFronendError in opt-frontend-common.js
89+
// NB: this file must be included AFTER opt-frontend-common.js
90+
function setFronendError(lines) {
91+
var errorStr = lines.map(htmlspecialchars).join('<br/>');
92+
$('#loadingPane').html('There was an error. Please return to "Edit" mode, fix it, then re-enter "View" mode.').show();
93+
$("#frontendErrorOutput").html(errorStr);
94+
$("#frontendErrorOutput").show();
8295
}
8396

8497

@@ -143,7 +156,12 @@ $(document).ready(function() {
143156

144157
// initialize these callbacks only after Labs.connect is successful
145158
Labs.on(Labs.Core.EventTypes.ModeChanged, function(data) {
146-
$("#testDiv").append('<p>' + data.mode + '</p>');
159+
if (data.mode == 'Edit') {
160+
enterEditMode();
161+
}
162+
else if (data.mode == 'View') {
163+
executeCodeFromScratch();
164+
}
147165
});
148166

149167
Labs.on(Labs.Core.EventTypes.Activate, function() {
@@ -154,6 +172,4 @@ $(document).ready(function() {
154172
$("#testDiv").append('<p>Deactivate</p>');
155173
});
156174
});
157-
158-
//$("#executeBtn").click(executeCodeFromScratch);
159175
});

‎v3/opt-office-mix.html‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@
7474

7575
<body>
7676

77+
<div id="loadingPane" style="display: none; font-size: 16px; margin-bottom: 30px; color: #e93f34;">
78+
</div>
79+
7780
<div id="pyInputPane">
7881

7982
<div id="codeInputWarnings">Write

0 commit comments

Comments
 (0)