Allow changing GR's default output device
use the GKS_WSTYPE environment to set the default workstation type (= GKS logical device driver) for the GR framework
This commit is contained in:
parent
c4bdc5b856
commit
6f2b55dc15
@ -41,6 +41,11 @@ supported_scales(::GRBackend) = [:identity, :log10]
|
|||||||
is_subplot_supported(::GRBackend) = true
|
is_subplot_supported(::GRBackend) = true
|
||||||
|
|
||||||
|
|
||||||
|
if haskey(ENV, "GKS_WSTYPE")
|
||||||
|
_gr_wstype = ENV["GKS_WSTYPE"]
|
||||||
|
else
|
||||||
|
_gr_wstype = nothing
|
||||||
|
end
|
||||||
|
|
||||||
function _initialize_backend(::GRBackend; kw...)
|
function _initialize_backend(::GRBackend; kw...)
|
||||||
@eval begin
|
@eval begin
|
||||||
@ -895,11 +900,15 @@ const _gr_mimeformats = Dict(
|
|||||||
for (mime, fmt) in _gr_mimeformats
|
for (mime, fmt) in _gr_mimeformats
|
||||||
@eval function _writemime(io::IO, ::MIME{Symbol($mime)}, plt::Plot{GRBackend})
|
@eval function _writemime(io::IO, ::MIME{Symbol($mime)}, plt::Plot{GRBackend})
|
||||||
GR.emergencyclosegks()
|
GR.emergencyclosegks()
|
||||||
ENV["GKS_WSTYPE"] = $fmt
|
setenv("GKS_WSTYPE", $fmt)
|
||||||
gr_display(plt)
|
gr_display(plt)
|
||||||
GR.emergencyclosegks()
|
GR.emergencyclosegks()
|
||||||
write(io, readall("gks." * $fmt))
|
write(io, readall("gks." * $fmt))
|
||||||
ENV["GKS_WSTYPE"] = ""
|
if _gr_wstype != nothing
|
||||||
|
setenv("GKS_WSTYPE", $_gr_wstype)
|
||||||
|
else
|
||||||
|
setenv("GKS_WSTYPE", "")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user