handle ijulia with requires

and properly check if juno/ijulia are actually used and not just loaded
This commit is contained in:
Sebastian Pfitzner 2017-07-12 10:38:15 +02:00
parent 5e5f23b5e5
commit c385035ac5
2 changed files with 50 additions and 51 deletions

View File

@ -245,8 +245,6 @@ function __init__()
# for compatibility with Requires.jl:
@init
setup_ijulia()
if isdefined(Main, :PLOTS_DEFAULTS)
for (k,v) in Main.PLOTS_DEFAULTS
default(k, v)

View File

@ -250,12 +250,11 @@ end
const _ijulia_output = String["text/html"]
function setup_ijulia()
# override IJulia inline display
if isijulia()
@eval begin
import IJulia
using Requires
@require IJulia begin
if IJulia.inited
export set_ijulia_output
function set_ijulia_output(mimestr::AbstractString)
# info("Setting IJulia output format to $mimestr")
global _ijulia_output
@ -270,17 +269,18 @@ function setup_ijulia()
function Base.show(io::IO, m::MIME"text/plain", plt::Plot)
show(io, MIME("text/html"), plt)
end
end
@eval set_ijulia_output("text/html")
set_ijulia_output("text/html")
end
end
# ---------------------------------------------------------
# Atom PlotPane
# ---------------------------------------------------------
using Requires
@require Juno begin
import Hiccup, Media
if Juno.isactive()
Media.media(Plot, Media.Plot)
function Juno.render(e::Juno.Editor, plt::Plot)
@ -318,3 +318,4 @@ using Requires
Juno.render(pane, HTML(s))
end
end
end