From 751014911dd3d87d51be058d6528968bc6492c43 Mon Sep 17 00:00:00 2001 From: Adrian Salceanu Date: Fri, 8 Nov 2024 14:51:26 +0100 Subject: [PATCH] Unregister usertheme if file removed --- Project.toml | 2 +- src/Layout.jl | 1 + src/Stipple.jl | 1 + src/Theme.jl | 8 ++++++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 0cdda20..993d8dc 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Stipple" uuid = "4acbeb90-81a0-11ea-1966-bdaff8155998" authors = ["Adrian and the Stipple contributors"] -version = "0.28.17" +version = "0.28.18" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" diff --git a/src/Layout.jl b/src/Layout.jl index 9eeb1ff..48aa51f 100644 --- a/src/Layout.jl +++ b/src/Layout.jl @@ -335,6 +335,7 @@ function set_user_theme_watcher() :: Bool @async Genie.Revise.entr([path_to_user_theme]) do if ! isfile(path_to_user_theme) && Stipple.Theme.get_theme() == :usertheme set_theme!(:default) + Stipple.Theme.unregister_theme(:usertheme) end end USER_THEME_WATCHER[] = true diff --git a/src/Stipple.jl b/src/Stipple.jl index d9650d8..5a55392 100644 --- a/src/Stipple.jl +++ b/src/Stipple.jl @@ -1319,6 +1319,7 @@ include("Layout.jl") # precompilation ... using Stipple.ReactiveTools + @setup_workload begin # Putting some things in `setup` can reduce the size of the # precompile file and potentially make loading faster. diff --git a/src/Theme.jl b/src/Theme.jl index 26c96b9..921f722 100644 --- a/src/Theme.jl +++ b/src/Theme.jl @@ -64,6 +64,14 @@ function register_theme(name::Symbol, theme::String) end +""" +Unregister a theme. +""" +function unregister_theme(name::Symbol) + theme_exists!(name) && delete!(get_themes(), name) +end + + """ Check if a theme exists. """