gr: use GKSwstype environment (required for QML)

This commit is contained in:
Josef Heinen 2017-01-06 19:48:41 +01:00
parent 57840a37d0
commit 72d336265b

View File

@ -1077,14 +1077,14 @@ else
"use_default" "use_default"
end end
const _gr_wstype = Ref(get(ENV, "GKS_WSTYPE", _gr_wstype_default)) const _gr_wstype = Ref(get(ENV, "GKSwstype", _gr_wstype_default))
gr_set_output(wstype::String) = (_gr_wstype[] = wstype) gr_set_output(wstype::String) = (_gr_wstype[] = wstype)
for (mime, fmt) in _gr_mimeformats 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["GKS_WSTYPE"] = $fmt ENV["GKSwstype"] = $fmt
ENV["GKS_FILEPATH"] = filepath ENV["GKS_FILEPATH"] = filepath
gr_display(plt) gr_display(plt)
GR.emergencyclosegks() GR.emergencyclosegks()
@ -1097,7 +1097,7 @@ function _display(plt::Plot{GRBackend})
if plt[:display_type] == :inline if plt[:display_type] == :inline
GR.emergencyclosegks() GR.emergencyclosegks()
filepath = tempname() * ".pdf" filepath = tempname() * ".pdf"
ENV["GKS_WSTYPE"] = "pdf" ENV["GKSwstype"] = "pdf"
ENV["GKS_FILEPATH"] = filepath ENV["GKS_FILEPATH"] = filepath
gr_display(plt) gr_display(plt)
GR.emergencyclosegks() GR.emergencyclosegks()
@ -1107,7 +1107,7 @@ function _display(plt::Plot{GRBackend})
else else
ENV["GKS_DOUBLE_BUF"] = true ENV["GKS_DOUBLE_BUF"] = true
if _gr_wstype[] != "use_default" if _gr_wstype[] != "use_default"
ENV["GKS_WSTYPE"] = _gr_wstype[] ENV["GKSwstype"] = _gr_wstype[]
end end
gr_display(plt) gr_display(plt)
end end