From 8b50290f5e2f4dcc35264deae2f88fd82106bfbf Mon Sep 17 00:00:00 2001 From: squidfunk Date: Mon, 8 May 2023 21:01:01 +0200 Subject: [PATCH] Fixed errors in deprecation path of social plugin settings --- material/plugins/social/plugin.py | 12 ++++++------ src/plugins/social/plugin.py | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/material/plugins/social/plugin.py b/material/plugins/social/plugin.py index 769c1b817..a657438c0 100644 --- a/material/plugins/social/plugin.py +++ b/material/plugins/social/plugin.py @@ -62,11 +62,13 @@ class SocialPluginConfig(Config): # Deprecated options cards_color = opt.Deprecated( + option_type = opt.Type(dict, default = {}), message = "Deprecated, use 'cards_layout_options.background_color' " "and 'cards_layout_options.color' with 'default' layout" - ) + ) cards_font = opt.Deprecated( + option_type = opt.Type(str), message = "Deprecated, use 'cards_layout_options.font_family'" ) @@ -138,12 +140,10 @@ class SocialPlugin(BasePlugin[SocialPluginConfig]): self.color = colors.get(primary, self.color) # Retrieve color overrides + options = self.config.cards_layout_options self.color = { - **self.color, - **{ - "fill": self.config.cards_layout_options.get("background_color"), - "text": self.config.cards_layout_options.get("color") - } + "fill": options.get("background_color", self.color["fill"]), + "text": options.get("color", self.color["text"]) } # Retrieve custom_dir path diff --git a/src/plugins/social/plugin.py b/src/plugins/social/plugin.py index 769c1b817..a657438c0 100644 --- a/src/plugins/social/plugin.py +++ b/src/plugins/social/plugin.py @@ -62,11 +62,13 @@ class SocialPluginConfig(Config): # Deprecated options cards_color = opt.Deprecated( + option_type = opt.Type(dict, default = {}), message = "Deprecated, use 'cards_layout_options.background_color' " "and 'cards_layout_options.color' with 'default' layout" - ) + ) cards_font = opt.Deprecated( + option_type = opt.Type(str), message = "Deprecated, use 'cards_layout_options.font_family'" ) @@ -138,12 +140,10 @@ class SocialPlugin(BasePlugin[SocialPluginConfig]): self.color = colors.get(primary, self.color) # Retrieve color overrides + options = self.config.cards_layout_options self.color = { - **self.color, - **{ - "fill": self.config.cards_layout_options.get("background_color"), - "text": self.config.cards_layout_options.get("color") - } + "fill": options.get("background_color", self.color["fill"]), + "text": options.get("color", self.color["text"]) } # Retrieve custom_dir path