gr: fix 'hidden window' problem after savefig

This commit is contained in:
Josef Heinen 2017-11-21 13:58:03 +01:00
parent 0519f18bd7
commit dbf96a69d7

View File

@ -1329,12 +1329,18 @@ for (mime, fmt) in _gr_mimeformats
@eval function _show(io::IO, ::MIME{Symbol($mime)}, plt::Plot{GRBackend}) @eval function _show(io::IO, ::MIME{Symbol($mime)}, plt::Plot{GRBackend})
GR.emergencyclosegks() GR.emergencyclosegks()
filepath = tempname() * "." * $fmt filepath = tempname() * "." * $fmt
env = get(ENV, "GKSwstype", "0")
ENV["GKSwstype"] = $fmt ENV["GKSwstype"] = $fmt
ENV["GKS_FILEPATH"] = filepath ENV["GKS_FILEPATH"] = filepath
gr_display(plt) gr_display(plt)
GR.emergencyclosegks() GR.emergencyclosegks()
write(io, readstring(filepath)) write(io, readstring(filepath))
rm(filepath) rm(filepath)
if env != "0"
ENV["GKSwstype"] = env
else
pop!(ENV,"GKSwstype")
end
end end
end end