Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tuneit
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
tuneit
Commits
bede9298
Verified
Commit
bede9298
authored
Feb 02, 2026
by
Kirill Unitsaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app: init preferences dialog
parent
8ad3240f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
4 deletions
+66
-4
ru.ximperlinux.TuneIt.gschema.xml
data/ru.ximperlinux.TuneIt.gschema.xml
+6
-1
main.py
src/main.py
+6
-1
meson.build
src/meson.build
+1
-0
preferences.py
src/preferences.py
+43
-0
main.py
src/settings/main.py
+10
-2
No files found.
data/ru.ximperlinux.TuneIt.gschema.xml
View file @
bede9298
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<schemalist
gettext-domain=
"tuneit"
>
<schemalist
gettext-domain=
"tuneit"
>
<schema
id=
"ru.ximperlinux.TuneIt"
path=
"/ru.ximperlinux.TuneIt/"
>
<schema
id=
"ru.ximperlinux.TuneIt"
path=
"/ru.ximperlinux.TuneIt/"
>
<key
name=
"show
_root_
modules"
type=
"b"
>
<key
name=
"show
-root-
modules"
type=
"b"
>
<default>
false
</default>
<default>
false
</default>
<description>
Show modules that require root permissions
</description>
<description>
Show modules that require root permissions
</description>
</key>
</key>
<key
name=
"disabled-modules"
type=
"as"
>
<default>
[]
</default>
<summary>
Disabled modules
</summary>
<description>
List of module names that should not be loaded
</description>
</key>
</schema>
</schema>
</schemalist>
</schemalist>
src/main.py
View file @
bede9298
...
@@ -26,6 +26,8 @@ gi.require_version('Adw', '1')
...
@@ -26,6 +26,8 @@ gi.require_version('Adw', '1')
from
gi.repository
import
Gtk
,
Gio
,
Adw
,
Gdk
from
gi.repository
import
Gtk
,
Gio
,
Adw
,
Gdk
from
.window
import
TuneitWindow
from
.window
import
TuneitWindow
from
.about
import
build_about_dialog
from
.about
import
build_about_dialog
from
.preferences
import
PreferencesDialog
from
.settings.tools.yml_tools
import
load_modules
def
get_main_window
():
def
get_main_window
():
return
_application
.
props
.
active_window
return
_application
.
props
.
active_window
...
@@ -70,7 +72,10 @@ class TuneitApplication(Adw.Application):
...
@@ -70,7 +72,10 @@ class TuneitApplication(Adw.Application):
def
on_preferences_action
(
self
,
widget
,
_
):
def
on_preferences_action
(
self
,
widget
,
_
):
"""Callback for the app.preferences action."""
"""Callback for the app.preferences action."""
print
(
'app.preferences action activated'
)
modules
=
load_modules
()
modules_data
=
[{
'name'
:
m
[
'name'
],
'description'
:
m
.
get
(
'description'
)}
for
m
in
modules
]
prefs
=
PreferencesDialog
(
modules_data
)
prefs
.
present
(
self
.
props
.
active_window
)
def
create_action
(
self
,
name
,
callback
,
shortcuts
=
None
):
def
create_action
(
self
,
name
,
callback
,
shortcuts
=
None
):
"""Add an application action.
"""Add an application action.
...
...
src/meson.build
View file @
bede9298
...
@@ -64,6 +64,7 @@ tuneit_sources = [
...
@@ -64,6 +64,7 @@ tuneit_sources = [
'__init__.py',
'__init__.py',
'about.py',
'about.py',
'main.py',
'main.py',
'preferences.py',
'window.py',
'window.py',
'daemon.py',
'daemon.py',
]
]
...
...
src/preferences.py
0 → 100644
View file @
bede9298
from
gi.repository
import
Adw
,
Gio
class
PreferencesDialog
(
Adw
.
PreferencesDialog
):
def
__init__
(
self
,
modules_data
,
**
kwargs
):
super
()
.
__init__
(
**
kwargs
)
self
.
settings
=
Gio
.
Settings
.
new
(
"ru.ximperlinux.TuneIt"
)
page
=
Adw
.
PreferencesPage
(
title
=
_
(
"Modules"
),
icon_name
=
"application-x-addon-symbolic"
)
group
=
Adw
.
PreferencesGroup
(
title
=
_
(
"Available Modules"
),
description
=
_
(
"Restart the application to apply changes"
)
)
disabled
=
self
.
settings
.
get_strv
(
"disabled-modules"
)
for
module
in
sorted
(
modules_data
,
key
=
lambda
m
:
m
[
'name'
]):
row
=
Adw
.
SwitchRow
(
title
=
module
[
'name'
],
active
=
module
[
'name'
]
not
in
disabled
)
if
module
.
get
(
'description'
):
row
.
set_subtitle
(
module
[
'description'
])
row
.
connect
(
"notify::active"
,
self
.
_on_switch_toggled
,
module
[
'name'
])
group
.
add
(
row
)
page
.
add
(
group
)
self
.
add
(
page
)
def
_on_switch_toggled
(
self
,
row
,
pspec
,
module_name
):
disabled
=
list
(
self
.
settings
.
get_strv
(
"disabled-modules"
))
if
row
.
get_active
():
if
module_name
in
disabled
:
disabled
.
remove
(
module_name
)
else
:
if
module_name
not
in
disabled
:
disabled
.
append
(
module_name
)
self
.
settings
.
set_strv
(
"disabled-modules"
,
disabled
)
src/settings/main.py
View file @
bede9298
import
logging
import
logging
from
gi.repository
import
GLib
from
gi.repository
import
GLib
,
Gio
import
traceback
import
traceback
from
.module
import
Module
from
.module
import
Module
...
@@ -14,8 +14,15 @@ from .deps import DependencyManager
...
@@ -14,8 +14,15 @@ from .deps import DependencyManager
logger
=
logging
.
getLogger
(
"init_settings_stack"
)
logger
=
logging
.
getLogger
(
"init_settings_stack"
)
def
init_settings_stack
(
stack
,
listbox
,
split_view
):
def
init_settings_stack
(
stack
,
listbox
,
split_view
):
yaml_data
=
load_modules
()
yaml_data
=
load_modules
()
# Filter disabled modules
settings
=
Gio
.
Settings
.
new
(
"ru.ximperlinux.TuneIt"
)
disabled
=
settings
.
get_strv
(
"disabled-modules"
)
yaml_data
=
[
m
for
m
in
yaml_data
if
m
[
'name'
]
not
in
disabled
]
section_factory
=
SectionFactory
()
section_factory
=
SectionFactory
()
modules_dict
=
{}
modules_dict
=
{}
pages_dict
=
{}
pages_dict
=
{}
...
@@ -25,7 +32,8 @@ def init_settings_stack(stack, listbox, split_view):
...
@@ -25,7 +32,8 @@ def init_settings_stack(stack, listbox, split_view):
if
stack
.
get_pages
():
if
stack
.
get_pages
():
logger
.
info
(
"Clear pages..."
)
logger
.
info
(
"Clear pages..."
)
listbox
.
remove_all
()
listbox
.
remove_all
()
for
page
in
stack
.
get_pages
():
stack
.
remove
(
page
)
for
page
in
list
(
stack
.
get_pages
()):
stack
.
remove
(
page
.
get_child
())
else
:
else
:
logger
.
info
(
"First init..."
)
logger
.
info
(
"First init..."
)
...
...
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