Skip to content

Commit 8b50290

Browse files
committed
Fixed errors in deprecation path of social plugin settings
1 parent b0d59f2 commit 8b50290

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

material/plugins/social/plugin.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,13 @@ class SocialPluginConfig(Config):
6262

6363
# Deprecated options
6464
cards_color = opt.Deprecated(
65+
option_type = opt.Type(dict, default = {}),
6566
message =
6667
"Deprecated, use 'cards_layout_options.background_color' "
6768
"and 'cards_layout_options.color' with 'default' layout"
68-
)
69+
)
6970
cards_font = opt.Deprecated(
71+
option_type = opt.Type(str),
7072
message = "Deprecated, use 'cards_layout_options.font_family'"
7173
)
7274

@@ -138,12 +140,10 @@ def on_config(self, config):
138140
self.color = colors.get(primary, self.color)
139141

140142
# Retrieve color overrides
143+
options = self.config.cards_layout_options
141144
self.color = {
142-
**self.color,
143-
**{
144-
"fill": self.config.cards_layout_options.get("background_color"),
145-
"text": self.config.cards_layout_options.get("color")
146-
}
145+
"fill": options.get("background_color", self.color["fill"]),
146+
"text": options.get("color", self.color["text"])
147147
}
148148

149149
# Retrieve custom_dir path

src/plugins/social/plugin.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,13 @@ class SocialPluginConfig(Config):
6262

6363
# Deprecated options
6464
cards_color = opt.Deprecated(
65+
option_type = opt.Type(dict, default = {}),
6566
message =
6667
"Deprecated, use 'cards_layout_options.background_color' "
6768
"and 'cards_layout_options.color' with 'default' layout"
68-
)
69+
)
6970
cards_font = opt.Deprecated(
71+
option_type = opt.Type(str),
7072
message = "Deprecated, use 'cards_layout_options.font_family'"
7173
)
7274

@@ -138,12 +140,10 @@ def on_config(self, config):
138140
self.color = colors.get(primary, self.color)
139141

140142
# Retrieve color overrides
143+
options = self.config.cards_layout_options
141144
self.color = {
142-
**self.color,
143-
**{
144-
"fill": self.config.cards_layout_options.get("background_color"),
145-
"text": self.config.cards_layout_options.get("color")
146-
}
145+
"fill": options.get("background_color", self.color["fill"]),
146+
"text": options.get("color", self.color["text"])
147147
}
148148

149149
# Retrieve custom_dir path

0 commit comments

Comments
 (0)