mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
fixed wrong json class names and added fix for backwards compatibility in ThemeManager #1538
This commit is contained in:
parent
cd85a1c782
commit
37b375d58b
@ -34,7 +34,7 @@
|
||||
"text_color":["gray10", "#DCE4EE"],
|
||||
"placeholder_text_color": ["gray52", "gray62"]
|
||||
},
|
||||
"CTkCheckbox": {
|
||||
"CTkCheckBox": {
|
||||
"corner_radius": 6,
|
||||
"border_width": 3,
|
||||
"fg_color": ["#3B8ED0", "#1F6AA5"],
|
||||
@ -55,7 +55,7 @@
|
||||
"text_color": ["gray10", "#DCE4EE"],
|
||||
"text_color_disabled": ["gray60", "gray45"]
|
||||
},
|
||||
"CTkRadiobutton": {
|
||||
"CTkRadioButton": {
|
||||
"corner_radius": 1000,
|
||||
"border_width_checked": 6,
|
||||
"border_width_unchecked": 3,
|
||||
|
@ -34,7 +34,7 @@
|
||||
"text_color": ["gray14", "gray84"],
|
||||
"placeholder_text_color": ["gray52", "gray62"]
|
||||
},
|
||||
"CTkCheckbox": {
|
||||
"CTkCheckBox": {
|
||||
"corner_radius": 6,
|
||||
"border_width": 3,
|
||||
"fg_color": ["#3a7ebf", "#1f538d"],
|
||||
@ -55,7 +55,7 @@
|
||||
"text_color": ["gray14", "gray84"],
|
||||
"text_color_disabled": ["gray60", "gray45"]
|
||||
},
|
||||
"CTkRadiobutton": {
|
||||
"CTkRadioButton": {
|
||||
"corner_radius": 1000,
|
||||
"border_width_checked": 6,
|
||||
"border_width_unchecked": 3,
|
||||
|
@ -34,7 +34,7 @@
|
||||
"text_color":["gray10", "#DCE4EE"],
|
||||
"placeholder_text_color": ["gray52", "gray62"]
|
||||
},
|
||||
"CTkCheckbox": {
|
||||
"CTkCheckBox": {
|
||||
"corner_radius": 6,
|
||||
"border_width": 3,
|
||||
"fg_color": ["#2CC985", "#2FA572"],
|
||||
@ -55,7 +55,7 @@
|
||||
"text_color": ["gray10", "#DCE4EE"],
|
||||
"text_color_disabled": ["gray60", "gray45"]
|
||||
},
|
||||
"CTkRadiobutton": {
|
||||
"CTkRadioButton": {
|
||||
"corner_radius": 1000,
|
||||
"border_width_checked": 6,
|
||||
"border_width_unchecked": 3,
|
||||
|
@ -51,20 +51,20 @@ class CTkCheckBox(CTkBaseClass):
|
||||
self._checkbox_height = checkbox_height
|
||||
|
||||
# color
|
||||
self._fg_color = ThemeManager.theme["CTkCheckbox"]["fg_color"] if fg_color is None else self._check_color_type(fg_color)
|
||||
self._hover_color = ThemeManager.theme["CTkCheckbox"]["hover_color"] if hover_color is None else self._check_color_type(hover_color)
|
||||
self._border_color = ThemeManager.theme["CTkCheckbox"]["border_color"] if border_color is None else self._check_color_type(border_color)
|
||||
self._checkmark_color = ThemeManager.theme["CTkCheckbox"]["checkmark_color"] if checkmark_color is None else self._check_color_type(checkmark_color)
|
||||
self._fg_color = ThemeManager.theme["CTkCheckBox"]["fg_color"] if fg_color is None else self._check_color_type(fg_color)
|
||||
self._hover_color = ThemeManager.theme["CTkCheckBox"]["hover_color"] if hover_color is None else self._check_color_type(hover_color)
|
||||
self._border_color = ThemeManager.theme["CTkCheckBox"]["border_color"] if border_color is None else self._check_color_type(border_color)
|
||||
self._checkmark_color = ThemeManager.theme["CTkCheckBox"]["checkmark_color"] if checkmark_color is None else self._check_color_type(checkmark_color)
|
||||
|
||||
# shape
|
||||
self._corner_radius = ThemeManager.theme["CTkCheckbox"]["corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_width = ThemeManager.theme["CTkCheckbox"]["border_width"] if border_width is None else border_width
|
||||
self._corner_radius = ThemeManager.theme["CTkCheckBox"]["corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_width = ThemeManager.theme["CTkCheckBox"]["border_width"] if border_width is None else border_width
|
||||
|
||||
# text
|
||||
self._text = text
|
||||
self._text_label: Union[tkinter.Label, None] = None
|
||||
self._text_color = ThemeManager.theme["CTkCheckbox"]["text_color"] if text_color is None else self._check_color_type(text_color)
|
||||
self._text_color_disabled = ThemeManager.theme["CTkCheckbox"]["text_color_disabled"] if text_color_disabled is None else self._check_color_type(text_color_disabled)
|
||||
self._text_color = ThemeManager.theme["CTkCheckBox"]["text_color"] if text_color is None else self._check_color_type(text_color)
|
||||
self._text_color_disabled = ThemeManager.theme["CTkCheckBox"]["text_color_disabled"] if text_color_disabled is None else self._check_color_type(text_color_disabled)
|
||||
|
||||
# font
|
||||
self._font = CTkFont() if font is None else self._check_font_type(font)
|
||||
|
@ -50,20 +50,20 @@ class CTkRadioButton(CTkBaseClass):
|
||||
self._radiobutton_height = radiobutton_height
|
||||
|
||||
# color
|
||||
self._fg_color = ThemeManager.theme["CTkRadiobutton"]["fg_color"] if fg_color is None else self._check_color_type(fg_color)
|
||||
self._hover_color = ThemeManager.theme["CTkRadiobutton"]["hover_color"] if hover_color is None else self._check_color_type(hover_color)
|
||||
self._border_color = ThemeManager.theme["CTkRadiobutton"]["border_color"] if border_color is None else self._check_color_type(border_color)
|
||||
self._fg_color = ThemeManager.theme["CTkRadioButton"]["fg_color"] if fg_color is None else self._check_color_type(fg_color)
|
||||
self._hover_color = ThemeManager.theme["CTkRadioButton"]["hover_color"] if hover_color is None else self._check_color_type(hover_color)
|
||||
self._border_color = ThemeManager.theme["CTkRadioButton"]["border_color"] if border_color is None else self._check_color_type(border_color)
|
||||
|
||||
# shape
|
||||
self._corner_radius = ThemeManager.theme["CTkRadiobutton"]["corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_width_unchecked = ThemeManager.theme["CTkRadiobutton"]["border_width_unchecked"] if border_width_unchecked is None else border_width_unchecked
|
||||
self._border_width_checked = ThemeManager.theme["CTkRadiobutton"]["border_width_checked"] if border_width_checked is None else border_width_checked
|
||||
self._corner_radius = ThemeManager.theme["CTkRadioButton"]["corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_width_unchecked = ThemeManager.theme["CTkRadioButton"]["border_width_unchecked"] if border_width_unchecked is None else border_width_unchecked
|
||||
self._border_width_checked = ThemeManager.theme["CTkRadioButton"]["border_width_checked"] if border_width_checked is None else border_width_checked
|
||||
|
||||
# text
|
||||
self._text = text
|
||||
self._text_label: Union[tkinter.Label, None] = None
|
||||
self._text_color = ThemeManager.theme["CTkRadiobutton"]["text_color"] if text_color is None else self._check_color_type(text_color)
|
||||
self._text_color_disabled = ThemeManager.theme["CTkRadiobutton"]["text_color_disabled"] if text_color_disabled is None else self._check_color_type(text_color_disabled)
|
||||
self._text_color = ThemeManager.theme["CTkRadioButton"]["text_color"] if text_color is None else self._check_color_type(text_color)
|
||||
self._text_color_disabled = ThemeManager.theme["CTkRadioButton"]["text_color_disabled"] if text_color_disabled is None else self._check_color_type(text_color_disabled)
|
||||
|
||||
# font
|
||||
self._font = CTkFont() if font is None else self._check_font_type(font)
|
||||
|
@ -37,6 +37,12 @@ class ThemeManager:
|
||||
else:
|
||||
cls.theme[key] = cls.theme[key]["Linux"]
|
||||
|
||||
# fix name inconsistencies
|
||||
if "CTkCheckbox" in cls.theme.keys():
|
||||
cls.theme["CTkCheckBox"] = cls.theme.pop("CTkCheckbox")
|
||||
if "CTkRadiobutton" in cls.theme.keys():
|
||||
cls.theme["CTkRadioButton"] = cls.theme.pop("CTkRadiobutton")
|
||||
|
||||
@classmethod
|
||||
def save_theme(cls):
|
||||
if cls._currently_loaded_theme is not None:
|
||||
|
Loading…
Reference in New Issue
Block a user