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
e4b1ec5f
Commit
e4b1ec5f
authored
Feb 03, 2025
by
Anton Palgunov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
migrate to view model
parent
853879a8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
48 deletions
+81
-48
local-test.sh
local-test.sh
+6
-0
main.py
src/shop/main.py
+17
-48
shop_card.blp
src/shop/shop_card.blp
+26
-0
shop_main.blp
src/shop/shop_main.blp
+30
-0
tuneit.gresource.xml
src/tuneit.gresource.xml
+2
-0
No files found.
local-test.sh
0 → 100755
View file @
e4b1ec5f
#!/usr/bin/bash
meson setup build
--reconfigure
meson compile
-C
build
meson
install
-C
build
tuneit
\ No newline at end of file
src/shop/main.py
View file @
e4b1ec5f
...
...
@@ -215,31 +215,16 @@ class ModuleCard(Gtk.Box):
__gtype_name__
=
"ModuleCard"
def
__init__
(
self
,
module_data
):
super
()
.
__init__
(
orientation
=
Gtk
.
Orientation
.
VERTICAL
,
spacing
=
6
)
super
()
.
__init__
()
self
.
module_data
=
module_data
# Настраиваем стили и отступы
self
.
set_margin_top
(
12
)
self
.
set_margin_bottom
(
12
)
self
.
set_margin_start
(
12
)
self
.
set_margin_end
(
12
)
# Фрейм или карточка
frame
=
Gtk
.
Frame
()
frame
.
set_margin_top
(
6
)
frame
.
set_margin_bottom
(
6
)
frame
.
set_margin_start
(
6
)
frame
.
set_margin_end
(
6
)
self
.
append
(
frame
)
card_box
=
Gtk
.
Box
(
orientation
=
Gtk
.
Orientation
.
VERTICAL
,
spacing
=
6
)
card_box
.
set_margin_top
(
6
)
card_box
.
set_margin_bottom
(
6
)
card_box
.
set_margin_start
(
6
)
card_box
.
set_margin_end
(
6
)
frame
.
set_child
(
card_box
)
builder
=
Gtk
.
Builder
()
builder
.
add_from_file
(
"module_card.ui"
)
module_card_box
=
builder
.
get_object
(
"module_card_box"
)
card_box
=
builder
.
get_object
(
"card_box"
)
self
.
append
(
module_card_box
)
# Обложка (cover)
cover_url
=
""
...
...
@@ -312,33 +297,17 @@ def init_shop_stack(shop_pagestack, shop_listbox, shop_split_view):
"""
Инициализация стека страницы “Магазин”.
"""
refresh_button
=
Gtk
.
Button
(
label
=
"Принудительно обновить список"
)
builder
=
Gtk
.
Builder
.
new_from_file
(
"src/shop/shop_main.ui"
)
refresh_button
=
builder
.
get_object
(
"refresh_button"
)
refresh_button
.
connect
(
"clicked"
,
on_refresh_button_clicked
)
# Индикатор загрузки
spinner
=
Gtk
.
Spinner
()
spinner
.
set_size_request
(
24
,
24
)
# В боксе горизонтально разместим кнопку и спиннер
hbox_top
=
Gtk
.
Box
(
orientation
=
Gtk
.
Orientation
.
HORIZONTAL
,
spacing
=
6
)
hbox_top
.
append
(
refresh_button
)
hbox_top
.
append
(
spinner
)
# Создадим FlowBox для карточек, по 3 в ряд
flowbox
=
Gtk
.
FlowBox
()
flowbox
.
set_vexpand
(
True
)
# Растянем по вертикали
flowbox
.
set_min_children_per_line
(
3
)
flowbox
.
set_max_children_per_line
(
3
)
flowbox
.
set_selection_mode
(
Gtk
.
SelectionMode
.
NONE
)
# Включим только вертикальный scroller
scroller
=
Gtk
.
ScrolledWindow
()
scroller
.
set_child
(
flowbox
)
# Содержимое страницы
vbox_main
=
Gtk
.
Box
(
orientation
=
Gtk
.
Orientation
.
VERTICAL
,
spacing
=
6
)
vbox_main
.
append
(
hbox_top
)
vbox_main
.
append
(
scroller
)
spinner
=
builder
.
get_object
(
"spinner"
)
hbox_top
=
builder
.
get_object
(
"hbox_top"
)
flowbox
=
builder
.
get_object
(
"flowbox"
)
scroller
=
builder
.
get_object
(
"scroller"
)
vbox_main
=
builder
.
get_object
(
"vbox_main"
)
# Показываем в стеке
shop_pagestack
.
add_child
(
vbox_main
)
...
...
src/shop/shop_card.blp
0 → 100644
View file @
e4b1ec5f
using Gtk 4.0;
Box module_card_box {
orientation: vertical;
spacing: 6;
margin-top: 12;
margin-bottom: 12;
margin-start: 12;
margin-end: 12;
Frame frame {
margin-top: 6;
margin-bottom: 6;
margin-start: 6;
margin-end: 6;
Box card_box {
orientation: vertical;
spacing: 6;
margin-top: 6;
margin-bottom: 6;
margin-start: 6;
margin-end: 6;
}
}
}
src/shop/shop_main.blp
0 → 100644
View file @
e4b1ec5f
using Gtk 4.0;
ScrolledWindow scroller {
FlowBox flowbox {
vexpand: true;
min-children-per-line: 3;
max-children-per-line: 3;
selection-mode: none;
}
}
Box vbox_main {
orientation: vertical;
spacing: 6;
Box hbox_top {
orientation: horizontal;
spacing: 6;
Button refresh_button {
label: "Принудительно обновить список";
clicked => $on_refresh_button_clicked();
}
Spinner spinner {
width-request: 24;
height-request: 24;
}
}
}
src/tuneit.gresource.xml
View file @
e4b1ec5f
...
...
@@ -4,5 +4,7 @@
<file
preprocess=
"xml-stripblanks"
>
window.ui
</file>
<file
preprocess=
"xml-stripblanks"
>
settings/widgets/panel_row.ui
</file>
<file
preprocess=
"xml-stripblanks"
>
gtk/help-overlay.ui
</file>
<!-- <file preprocess="xml-stripblanks">shop/shop_main.ui</file>
<file preprocess="xml-stripblanks">shop/shop_card.ui</file> -->
</gresource>
</gresources>
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