From bcf85533b6dc8a9999169ac4b08fbe897e5aebc4 Mon Sep 17 00:00:00 2001 From: Allen Hill Date: Wed, 18 Dec 2024 13:53:04 -0800 Subject: [PATCH] Add `"transient"` dict to `"display_data"` messages (Necessary for any future `"update_display_data"` message implementation) --- src/display.jl | 1 + src/inline.jl | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/display.jl b/src/display.jl index 2659b576..2fdbd4bf 100644 --- a/src/display.jl +++ b/src/display.jl @@ -48,6 +48,7 @@ register_jsonmime(x::AbstractVector{<:MIME}) = push!(ijulia_jsonmime_types, Vect # return a String=>Any dictionary to attach as metadata # in Jupyter display_data and pyout messages metadata(x) = Dict() +transient(x) = Dict() """ Generate the preferred MIME representation of x. diff --git a/src/inline.jl b/src/inline.jl index 2ef69587..339d05ad 100644 --- a/src/inline.jl +++ b/src/inline.jl @@ -62,6 +62,7 @@ for mime in ipy_mime msg_pub(execute_msg, "display_data", Dict( "metadata" => metadata(x), # optional + "transient" => transient(x), # optional "data" => Dict($mime => limitstringmime(MIME($mime), x))))) end displayable(d::InlineDisplay, ::MIME{Symbol($mime)}) = true @@ -87,6 +88,7 @@ function display(d::InlineDisplay, M::MIME, x) send_ipython(publish[], msg_pub(execute_msg, "display_data", Dict("metadata" => metadata(x), # optional + "transient" => transient(x), # optional "data" => d))) end @@ -98,6 +100,7 @@ function display(d::InlineDisplay, x) send_ipython(publish[], msg_pub(execute_msg, "display_data", Dict("metadata" => metadata(x), # optional + "transient" => transient(x), # optional "data" => display_dict(x)))) end