Atom fixes

This commit is contained in:
Thomas Breloff 2016-08-26 18:05:37 -04:00
parent 576ed7b7b3
commit d892c57596

View File

@ -260,21 +260,21 @@ function setup_atom()
print(io, "Plot{$B}()") print(io, "Plot{$B}()")
end end
function Media.render(::Atom.Inline, plt::Plot) function Media.render(e::Atom.Editor, plt::Plot)
nothing Media.render(e, nothing)
end end
if get(ENV, "PLOTS_USE_ATOM_PLOTPANE", true) in (true, 1, "1", "true", "yes") if get(ENV, "PLOTS_USE_ATOM_PLOTPANE", true) in (true, 1, "1", "true", "yes")
# this is like "display"... sends an html div with the plot to the PlotPane # this is like "display"... sends an html div with the plot to the PlotPane
function Media.render(pane::Atom.PlotPane, plt::Plot) function Media.render(pane::Atom.PlotPane, plt::Plot)
Media.render(pane, Atom.div(Atom.d(), Atom.HTML(stringmime(MIME("text/html"), plt)))) Media.render(pane, Atom.div(Atom.HTML(stringmime(MIME("text/html"), plt))))
end end
else else
# #
function Media.render(pane::Atom.PlotPane, plt::Plot) function Media.render(pane::Atom.PlotPane, plt::Plot)
display(Plots.PlotsDisplay(), plt) display(Plots.PlotsDisplay(), plt)
s = "PlotPane turned off. Unset ENV[\"PLOTS_USE_ATOM_PLOTPANE\"] and restart Julia to enable it." s = "PlotPane turned off. Unset ENV[\"PLOTS_USE_ATOM_PLOTPANE\"] and restart Julia to enable it."
Media.render(pane, Atom.div(Atom.d(), Atom.HTML(s))) Media.render(pane, Atom.div(Atom.HTML(s)))
end end
end end
@ -285,7 +285,7 @@ function setup_atom()
function Media.render{B<:Union{PlotlyBackend,PlotlyJSBackend}}(pane::Atom.PlotPane, plt::Plot{B}) function Media.render{B<:Union{PlotlyBackend,PlotlyJSBackend}}(pane::Atom.PlotPane, plt::Plot{B})
display(Plots.PlotsDisplay(), plt) display(Plots.PlotsDisplay(), plt)
s = "PlotPane turned off. The plotly and plotlyjs backends cannot render in the PlotPane due to javascript issues." s = "PlotPane turned off. The plotly and plotlyjs backends cannot render in the PlotPane due to javascript issues."
Media.render(pane, Atom.div(Atom.d(), Atom.HTML(s))) Media.render(pane, Atom.div(Atom.HTML(s)))
end end
end end
end end