Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
ximper-unified-theme-switcher
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
ximper-unified-theme-switcher
Commits
5285b632
Commit
5285b632
authored
Jul 16, 2024
by
Roman Alifanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Now there are no dark themes in the drop-down lists for light themes and versa
parent
91a3d0cf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
5 deletions
+33
-5
utils.py
src/utils.py
+26
-0
window.py
src/window.py
+7
-5
No files found.
src/utils.py
View file @
5285b632
...
...
@@ -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
)
...
...
src/window.py
View file @
5285b632
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment