Commit 6ca987db authored by Vladimir Vaskov's avatar Vladimir Vaskov

Merge branch 'master' into 'master'

Impove UI See merge request !2
parents a39b8ab4 2f7d6d18
project('tuneit', project('tuneit',
version: '0.1.0', version: '0.1.0',
meson_version: '>= 1.0.0', meson_version: '>= 1.2.0',
default_options: [ 'warning_level=2', 'werror=false', ], default_options: [ 'warning_level=2', 'werror=false', ],
) )
......
...@@ -2,7 +2,7 @@ pkgdatadir = get_option('prefix') / get_option('datadir') / meson.project_name() ...@@ -2,7 +2,7 @@ pkgdatadir = get_option('prefix') / get_option('datadir') / meson.project_name()
moduledir = pkgdatadir / 'tuneit' moduledir = pkgdatadir / 'tuneit'
gnome = import('gnome') gnome = import('gnome')
blp_search = run_command('find_blp.sh', '') blp_search = run_command('find_blp.sh', '', check: true)
blp_files = blp_search.stdout().splitlines() blp_files = blp_search.stdout().splitlines()
...@@ -58,12 +58,12 @@ tuneit_sources = [ ...@@ -58,12 +58,12 @@ tuneit_sources = [
install_data(tuneit_sources, install_dir: moduledir) install_data(tuneit_sources, install_dir: moduledir)
blp_search_settings = run_command('find_blp.sh', 'settings') blp_search_settings = run_command('find_blp.sh', 'settings', check: true)
blp_search_shop = run_command('find_blp.sh', 'shop') blp_search_shop = run_command('find_blp.sh', 'shop', check: true)
blp_files_settings = blp_search_settings.stdout().splitlines() blp_files_settings = blp_search_settings.stdout().splitlines()
blp_files_shop = blp_search_shop.stdout().splitlines() blp_files_shop = blp_search_shop.stdout().splitlines()
install_subdir('settings', install_dir: moduledir, strip_directory : false, exclude_files: blp_files_settings) install_subdir('settings', install_dir: moduledir, strip_directory : false, exclude_files: blp_files_settings)
install_subdir('shop', install_dir: moduledir, strip_directory : false, exclude_files: blp_files_shop) # install_subdir('shop', install_dir: moduledir, strip_directory : false, exclude_files: blp_files_shop)
...@@ -257,11 +257,7 @@ class Page: ...@@ -257,11 +257,7 @@ class Page:
self.sections = sorted(self.sections, key=lambda s: s.weight) self.sections = sorted(self.sections, key=lambda s: s.weight)
def create_stack_page(self, stack, listbox): def create_stack_page(self, stack, listbox):
box = Gtk.ScrolledWindow()
pref_page = Adw.PreferencesPage() pref_page = Adw.PreferencesPage()
clamp = Adw.Clamp()
clamp.set_child(pref_page)
box.set_child(clamp)
not_empty = False not_empty = False
...@@ -274,14 +270,14 @@ class Page: ...@@ -274,14 +270,14 @@ class Page:
print(f"Секция {section.name} не создала виджетов.") print(f"Секция {section.name} не создала виджетов.")
if not_empty: if not_empty:
stack_page = stack.add_child(box) stack_page = stack.add_child(pref_page)
stack_page.set_title(self.name) stack_page.set_title(self.name)
stack_page.set_name(self.name) stack_page.set_name(self.name)
row = TuneItPanelRow() row = TuneItPanelRow()
row.set_name(self.name) row.props.name = self.name
row.set_title(self.name) row.props.title = self.name
row.icon_name = self.icon row.props.icon_name = self.icon
listbox.append(row) listbox.append(row)
else: else:
print(f"the page {self.name} is empty, ignored") print(f"the page {self.name} is empty, ignored")
...@@ -339,7 +335,7 @@ def init_settings_stack(stack, listbox, split_view): ...@@ -339,7 +335,7 @@ def init_settings_stack(stack, listbox, split_view):
def on_row_selected(listbox, row): def on_row_selected(listbox, row):
if row: if row:
page_id = row.get_name() page_id = row.props.name
print(f"Selected page: {page_id}") print(f"Selected page: {page_id}")
visible_child = stack.get_child_by_name(page_id) visible_child = stack.get_child_by_name(page_id)
......
using Gtk 4.0; using Gtk 4.0;
using Adw 1;
template $TuneItPanelRow: Adw.PreferencesRow { template $TuneItPanelRow: ListBoxRow {
child: Box { Box {
spacing: 12; spacing: 12;
margin-start: 6; margin-top: 6;
margin-end: 6; margin-bottom: 6;
margin-top: 12; margin-start: 2;
margin-bottom: 12; margin-end: 2;
Image thumbnail_image { Image thumbnail_image {
icon-name: bind template.icon-name; icon-name: bind template.icon-name;
...@@ -15,17 +14,28 @@ template $TuneItPanelRow: Adw.PreferencesRow { ...@@ -15,17 +14,28 @@ template $TuneItPanelRow: Adw.PreferencesRow {
Box { Box {
orientation: vertical; orientation: vertical;
valign: center;
Label label { spacing: 2;
Label title_label {
label: bind template.title; label: bind template.title;
halign: start;
justify: left;
wrap: true;
} }
// Label sub_label { Label subtitle_label {
// label: bind template.subtitle; styles [
// styles [ "caption",
// "caption" "dim-label",
// ] ]
// }
label: bind template.subtitle;
visible: bind template.subtitle-visible;
halign: start;
justify: left;
wrap: true;
}
} }
}; }
} }
...@@ -2,24 +2,12 @@ from gi.repository import GObject, Adw, Gtk ...@@ -2,24 +2,12 @@ from gi.repository import GObject, Adw, Gtk
@Gtk.Template(resource_path='/ru.ximperlinux.TuneIt/settings/widgets/panel_row.ui') @Gtk.Template(resource_path='/ru.ximperlinux.TuneIt/settings/widgets/panel_row.ui')
class TuneItPanelRow(Adw.PreferencesRow): class TuneItPanelRow(Gtk.ListBoxRow):
__gtype_name__ = "TuneItPanelRow"
def __init__(self, **kwargs):
super().__init__(**kwargs)
@GObject.Property(type=str, default="")
def icon_name(self):
return self._icon_name
@icon_name.setter __gtype_name__ = "TuneItPanelRow"
def icon_name(self, icon_name):
self._icon_name = icon_name
@GObject.Property(type=str, default="")
def subtitle(self):
return self._subtitle
@subtitle.setter name = GObject.Property(type=str, default='')
def subtitle(self, subtitle): title = GObject.Property(type=str, default='')
self._subtitle = subtitle subtitle = GObject.Property(type=str, default='')
subtitle_visible = GObject.Property(type=bool, default=False)
icon_name = GObject.Property(type=str, default='')
...@@ -2,22 +2,36 @@ using Gtk 4.0; ...@@ -2,22 +2,36 @@ using Gtk 4.0;
using Adw 1; using Adw 1;
template $TuneitWindow: Adw.ApplicationWindow { template $TuneitWindow: Adw.ApplicationWindow {
width-request: 360;
height-request: 294;
default-height: 600;
default-width: 800;
title: _("TuneIt");
Adw.Breakpoint { Adw.Breakpoint {
condition ("max-width: 400sp") condition ("max-width: 500sp")
setters { setters {
header_bar.title-widget: null; header_view_switcher.visible: false;
main_toolbar.top-bar-style: flat; main_toolbar.reveal-bottom-bars: true;
settinga_content_bar.visible: true; main_toolbar.reveal-top-bars: false;
switcher_bar.reveal: true;
settings_split_view.collapsed: true; settings_split_view.collapsed: true;
} }
} }
content: Adw.ToolbarView main_toolbar{
top-bar-style: raised_border; content: Adw.ToolbarView main_toolbar {
top-bar-style: raised;
bottom-bar-style: raised;
reveal-bottom-bars: false;
[top] [top]
Adw.HeaderBar header_bar { Adw.HeaderBar header_bar {
[title]
Adw.ViewSwitcher header_view_switcher {
policy: wide;
stack: main_stack;
}
[end] [end]
MenuButton { MenuButton {
icon-name: "open-menu-symbolic"; icon-name: "open-menu-symbolic";
...@@ -25,71 +39,89 @@ template $TuneitWindow: Adw.ApplicationWindow { ...@@ -25,71 +39,89 @@ template $TuneitWindow: Adw.ApplicationWindow {
primary: true; primary: true;
tooltip-text: _("Main Menu"); tooltip-text: _("Main Menu");
} }
[title]
Adw.ViewSwitcher {
policy: wide;
stack: main_stack;
}
} }
Adw.ViewStack main_stack { Adw.ViewStack main_stack {
Adw.ViewStackPage { Adw.ViewStackPage {
child: Box { icon-name: "preferences-system";
Adw.NavigationSplitView settings_split_view { name: "settings";
hexpand: true; title: _("Settings");
content: Adw.NavigationPage {
Adw.ToolbarView { child: Adw.NavigationSplitView settings_split_view {
[top] hexpand: true;
Adw.HeaderBar settinga_content_bar {
decoration-layout: ""; content: Adw.NavigationPage {
visible: false; title: bind settings_pagestack.visible-child-name;
Adw.ToolbarView {
reveal-top-bars: bind main_toolbar.reveal-top-bars inverted;
[top]
Adw.HeaderBar header_bar2 {
[end]
MenuButton {
icon-name: "open-menu-symbolic";
menu-model: primary_menu;
primary: true;
tooltip-text: _("Main Menu");
} }
}
Stack settings_pagestack {}
}
};
sidebar: Adw.NavigationPage {
title: _("Sections");
Adw.ToolbarView {
reveal-top-bars: bind main_toolbar.reveal-top-bars inverted;
Stack settings_pagestack {} [top]
Adw.HeaderBar {
[end]
MenuButton {
icon-name: "open-menu-symbolic";
menu-model: primary_menu;
primary: true;
tooltip-text: _("Main Menu");
}
} }
};
ScrolledWindow {
sidebar: Adw.NavigationPage { propagate-natural-height: true;
Adw.ClampScrollable { hscrollbar-policy: never;
margin-bottom: 8;
margin-end: 8; Adw.Clamp {
margin-start: 8; maximum-size: 500;
margin-top: 8;
ListBox settings_listbox {
ListBox settings_listbox { styles [
styles [ "navigation-sidebar",
"navigation-sidebar", ]
] }
} }
} }
}; }
} };
}; };
icon-name: "preferences-system";
name: "settings";
title: _("Settings");
} }
Adw.ViewStackPage { Adw.ViewStackPage {
child: Box {};
icon-name: "preferences-system"; icon-name: "preferences-system";
name: "shop"; name: "shop";
title: _("Shop"); title: _("Shop");
child: Box {};
} }
} }
[bottom] [bottom]
Adw.ViewSwitcherBar switcher_bar { Adw.ViewSwitcherBar switcher_bar {
reveal: true;
stack: main_stack; stack: main_stack;
} }
}; };
default-height: 600;
default-width: 800;
title: _("TuneIt");
} }
menu primary_menu { menu primary_menu {
...@@ -110,4 +142,3 @@ menu primary_menu { ...@@ -110,4 +142,3 @@ menu primary_menu {
} }
} }
} }
...@@ -53,4 +53,4 @@ class TuneitWindow(Adw.ApplicationWindow): ...@@ -53,4 +53,4 @@ class TuneitWindow(Adw.ApplicationWindow):
self.settings_pagestack, self.settings_pagestack,
self.settings_listbox, self.settings_listbox,
self.settings_split_view, self.settings_split_view,
) )
\ No newline at end of file
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