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
1
Merge Requests
1
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
0a505ff4
Commit
0a505ff4
authored
Jan 10, 2025
by
Roman Alifanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more adaptability - better :)
parent
3da4c51e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
14 deletions
+70
-14
__init__.py
src/settings/__init__.py
+30
-2
window.blp
src/window.blp
+37
-9
window.py
src/window.py
+3
-3
No files found.
src/settings/__init__.py
View file @
0a505ff4
...
@@ -124,10 +124,13 @@ class Category:
...
@@ -124,10 +124,13 @@ class Category:
else
:
else
:
print
(
f
"Секция {section.name} не создала виджетов."
)
print
(
f
"Секция {section.name} не создала виджетов."
)
stack
.
add_child
(
box
)
.
set_title
(
self
.
name
)
stack_page
=
stack
.
add_child
(
box
)
stack_page
.
set_title
(
self
.
name
)
stack_page
.
set_name
(
self
.
name
)
def
init_settings_stack
(
stack
):
def
init_settings_stack
(
stack
,
listbox
,
split_view
):
yaml_files_directory
=
"/usr/share/ximper-tuneit/modules"
# Укажите путь к папке с YAML файлами
yaml_files_directory
=
"/usr/share/ximper-tuneit/modules"
# Укажите путь к папке с YAML файлами
yaml_data
=
load_yaml_files_from_directory
(
yaml_files_directory
)
yaml_data
=
load_yaml_files_from_directory
(
yaml_files_directory
)
merged_data
=
merge_categories_by_name
(
yaml_data
)
merged_data
=
merge_categories_by_name
(
yaml_data
)
...
@@ -139,3 +142,28 @@ def init_settings_stack(stack):
...
@@ -139,3 +142,28 @@ def init_settings_stack(stack):
category
.
create_stack_page
(
stack
)
category
.
create_stack_page
(
stack
)
if
not
stack
:
if
not
stack
:
print
(
"Ошибка: settings_pagestack не найден."
)
print
(
"Ошибка: settings_pagestack не найден."
)
def
populate_listbox_from_stack
():
pages
=
stack
.
get_pages
()
for
i
in
range
(
pages
.
get_n_items
()):
page
=
pages
.
get_item
(
i
)
label
=
Gtk
.
Label
(
label
=
page
.
get_title
(),
xalign
=
0
)
row
=
Gtk
.
ListBoxRow
()
row
.
set_name
(
page
.
get_name
())
row
.
set_child
(
label
)
listbox
.
append
(
row
)
def
on_row_selected
(
listbox
,
row
):
if
row
:
page_id
=
row
.
get_name
()
print
(
f
"Selected page: {page_id}"
)
visible_child
=
stack
.
get_child_by_name
(
page_id
)
if
visible_child
:
stack
.
set_visible_child
(
visible_child
)
split_view
.
set_show_content
(
True
)
listbox
.
connect
(
"row-selected"
,
on_row_selected
)
populate_listbox_from_stack
()
src/window.blp
View file @
0a505ff4
...
@@ -2,9 +2,22 @@ using Gtk 4.0;
...
@@ -2,9 +2,22 @@ using Gtk 4.0;
using Adw 1;
using Adw 1;
template $TuneitWindow: Adw.ApplicationWindow {
template $TuneitWindow: Adw.ApplicationWindow {
content: Adw.ToolbarView {
Adw.Breakpoint {
condition ("max-width: 400sp")
setters {
header_bar.title-widget: null;
main_toolbar.top-bar-style: flat;
settinga_content_bar.visible: true;
switcher_bar.reveal: true;
settings_split_view.collapsed: true;
}
}
content: Adw.ToolbarView main_toolbar{
top-bar-style: raised_border;
[top]
[top]
Adw.HeaderBar {
Adw.HeaderBar
header_bar
{
[end]
[end]
MenuButton {
MenuButton {
icon-name: "open-menu-symbolic";
icon-name: "open-menu-symbolic";
...
@@ -23,13 +36,20 @@ template $TuneitWindow: Adw.ApplicationWindow {
...
@@ -23,13 +36,20 @@ template $TuneitWindow: Adw.ApplicationWindow {
Adw.ViewStack main_stack {
Adw.ViewStack main_stack {
Adw.ViewStackPage {
Adw.ViewStackPage {
child: Box {
child: Box {
Adw.NavigationSplitView {
Adw.NavigationSplitView settings_split_view {
content: Adw.NavigationPage {
Stack settings_pagestack {}
};
hexpand: true;
hexpand: true;
content: Adw.NavigationPage {
Adw.ToolbarView {
[top]
Adw.HeaderBar settinga_content_bar {
decoration-layout: "";
visible: false;
}
Stack settings_pagestack {}
}
};
sidebar: Adw.NavigationPage {
sidebar: Adw.NavigationPage {
Adw.ClampScrollable {
Adw.ClampScrollable {
margin-bottom: 8;
margin-bottom: 8;
...
@@ -37,8 +57,10 @@ template $TuneitWindow: Adw.ApplicationWindow {
...
@@ -37,8 +57,10 @@ template $TuneitWindow: Adw.ApplicationWindow {
margin-start: 8;
margin-start: 8;
margin-top: 8;
margin-top: 8;
StackSidebar {
ListBox settings_listbox {
stack: settings_pagestack;
styles [
"navigation-sidebar",
]
}
}
}
}
};
};
...
@@ -57,6 +79,12 @@ template $TuneitWindow: Adw.ApplicationWindow {
...
@@ -57,6 +79,12 @@ template $TuneitWindow: Adw.ApplicationWindow {
title: _("Shop");
title: _("Shop");
}
}
}
}
[bottom]
Adw.ViewSwitcherBar switcher_bar {
stack: main_stack;
}
};
};
default-height: 600;
default-height: 600;
...
...
src/window.py
View file @
0a505ff4
...
@@ -26,10 +26,10 @@ class TuneitWindow(Adw.ApplicationWindow):
...
@@ -26,10 +26,10 @@ class TuneitWindow(Adw.ApplicationWindow):
__gtype_name__
=
'TuneitWindow'
__gtype_name__
=
'TuneitWindow'
settings_pagestack
=
Gtk
.
Template
.
Child
()
settings_pagestack
=
Gtk
.
Template
.
Child
()
settings_listbox
=
Gtk
.
Template
.
Child
()
settings_split_view
=
Gtk
.
Template
.
Child
()
def
__init__
(
self
,
**
kwargs
):
def
__init__
(
self
,
**
kwargs
):
super
()
.
__init__
(
**
kwargs
)
super
()
.
__init__
(
**
kwargs
)
init_settings_stack
(
self
.
settings_pagestack
)
init_settings_stack
(
self
.
settings_pagestack
,
self
.
settings_listbox
,
self
.
settings_split_view
)
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