Skip to content

Commit

Permalink
Merge pull request #6 from tammojan/showerrorlog
Browse files Browse the repository at this point in the history
Show Hide log when error happens and log is shown
  • Loading branch information
aardk authored Jan 29, 2018
2 parents dfddff6 + 0d77b52 commit 005dce0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/casapy/casapy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1579,11 +1579,13 @@ def do_execute(self, code, silent, store_history=True, user_expressions=None,
if errorhappened:
errorcolor = ' style="background-color:red"'
errorin = ' in'
buttontext = 'Hide log'
else:
errorcolor = ''
errorin = ''
buttontext = 'Show log'
html_code = '<button type="button" ' + errorcolor + 'class="btn btn-info" data-toggle="collapse" id="' + button_id + '" data-target="#log' + button_id + '" ' +\
'onclick="if ($(\'#\'+this.id).html()==\'Show log\') {$(\'#\'+this.id).html(\'Hide log\')} else {$(\'#\'+this.id).html(\'Show log\')}; return false"' + \
'>Show log</button> <div class="collapse' + errorin + '" id="log' + button_id + '">' + "<br>".join(loglines) + '</div>'
'>' + buttontext + '</button> <div class="collapse' + errorin + '" id="log' + button_id + '">' + "<br>".join(loglines) + '</div>'
IPython.display.display_html(html_code, raw=True)
return result

0 comments on commit 005dce0

Please sign in to comment.