Commit 5285b632 authored by Roman Alifanov's avatar Roman Alifanov

Now there are no dark themes in the drop-down lists for light themes and versa

parent 91a3d0cf
......@@ -104,6 +104,32 @@ def make_kv_themes_list():
themes_list.append(theme_name)
return themes_list
def separate_themes(kv_themes_list, gtk3_themes_list):
kv_light_themes, kv_dark_themes = [], []
gtk3_light_themes, gtk3_dark_themes = [], []
def classify_theme(theme, light_themes, dark_themes, themes_list):
theme_lower = theme.lower()
if 'light' in theme_lower:
light_themes.append(theme)
elif 'dark' in theme_lower:
dark_themes.append(theme)
else:
if (theme + 'light').lower() in map(str.lower, themes_list):
dark_themes.append(theme)
elif (theme + 'dark').lower() in map(str.lower, themes_list):
light_themes.append(theme)
else:
light_themes.append(theme)
for theme in kv_themes_list:
classify_theme(theme, kv_light_themes, kv_dark_themes, kv_themes_list)
for theme in gtk3_themes_list:
classify_theme(theme, gtk3_light_themes, gtk3_dark_themes, gtk3_themes_list)
return kv_light_themes, kv_dark_themes, gtk3_light_themes, gtk3_dark_themes
def find_string_index(lst, string):
try:
index = lst.index(string)
......
......@@ -22,7 +22,7 @@
#
# SPDX-License-Identifier: MIT
from .utils import write_config, configure_cr_widgets
from .utils import make_gtk3_themes_list, make_kv_themes_list
from .utils import make_gtk3_themes_list, make_kv_themes_list, separate_themes
from gi.repository import Adw
from gi.repository import Gtk, Gio
......@@ -46,12 +46,14 @@ class XimperUnifiedThemeSwitcherGuiGtk4Window(Adw.ApplicationWindow):
kv_themes_list = make_kv_themes_list()
gtk3_themes_list = make_gtk3_themes_list()
kv_light_themes_list, kv_dark_themes_list, gtk3_light_themes_list, gtk3_dark_themes_list = separate_themes(kv_themes_list, gtk3_themes_list)
crs_configurations = [
(self.kv_light_cr, kv_themes_list, "KV_LIGHT_THEME"),
(self.kv_dark_cr, kv_themes_list, "KV_DARK_THEME"),
(self.gtk3_light_cr, gtk3_themes_list, "GTK3_LIGHT_THEME"),
(self.gtk3_dark_cr, gtk3_themes_list, "GTK3_DARK_THEME")
(self.kv_light_cr, kv_light_themes_list, "KV_LIGHT_THEME"),
(self.kv_dark_cr, kv_dark_themes_list, "KV_DARK_THEME"),
(self.gtk3_light_cr, gtk3_light_themes_list, "GTK3_LIGHT_THEME"),
(self.gtk3_dark_cr, gtk3_dark_themes_list, "GTK3_DARK_THEME")
]
configure_cr_widgets(crs_configurations, self.cr_theme_selected)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment