mirror of
https://github.com/morgan9e/warehouse
synced 2026-04-14 00:04:08 +09:00
Continue work on data page
This commit is contained in:
@@ -2,188 +2,196 @@ using Gtk 4.0;
|
||||
using Adw 1;
|
||||
|
||||
template $UserDataPage : Adw.BreakpointBin {
|
||||
// title: _("User Data");
|
||||
width-request: 1;
|
||||
height-request: 1;
|
||||
|
||||
Adw.Breakpoint {
|
||||
Adw.Breakpoint bpt {
|
||||
condition ("max-width: 585")
|
||||
|
||||
setters {
|
||||
header_bar.show-title: false;
|
||||
header_bar.title-widget: null;
|
||||
// header_bar.show-title: false;
|
||||
switcher_bar.reveal: true;
|
||||
switcher_bar.visible: true;
|
||||
}
|
||||
}
|
||||
|
||||
Adw.ToolbarView {
|
||||
[top]
|
||||
Adw.HeaderBar header_bar {
|
||||
title-widget:
|
||||
Adw.ViewSwitcher {
|
||||
stack: stack;
|
||||
policy: wide;
|
||||
Adw.NavigationPage {
|
||||
title: _("User Data");
|
||||
Adw.ToolbarView {
|
||||
[top]
|
||||
Adw.HeaderBar header_bar {
|
||||
title-widget:
|
||||
Adw.ViewSwitcher {
|
||||
stack: stack;
|
||||
policy: wide;
|
||||
}
|
||||
;
|
||||
[start]
|
||||
Button sidebar_button {
|
||||
icon-name: "dock-left-symbolic";
|
||||
tooltip-text: _("Show Sidebar");
|
||||
}
|
||||
[start]
|
||||
ToggleButton search_button {
|
||||
icon-name: "system-search-symbolic";
|
||||
tooltip-text: _("Search User Data");
|
||||
}
|
||||
[end]
|
||||
MenuButton sort_button {
|
||||
popover: sort_pop;
|
||||
icon-name: "vertical-arrows-long-symbolic";
|
||||
tooltip-text: _("Sort User Data");
|
||||
}
|
||||
[end]
|
||||
ToggleButton select_button {
|
||||
icon-name: "selection-mode-symbolic";
|
||||
tooltip-text: _("Select User Data");
|
||||
}
|
||||
;
|
||||
[start]
|
||||
ToggleButton search_button {
|
||||
icon-name: "system-search-symbolic";
|
||||
tooltip-text: _("Search User Data");
|
||||
}
|
||||
[end]
|
||||
MenuButton sort_button {
|
||||
popover: sort_pop;
|
||||
icon-name: "vertical-arrows-long-symbolic";
|
||||
tooltip-text: _("Sort User Data");
|
||||
[top]
|
||||
Adw.Clamp {
|
||||
SearchBar search_bar {
|
||||
search-mode-enabled: bind search_button.active bidirectional;
|
||||
key-capture-widget: template;
|
||||
|
||||
SearchEntry search_entry {
|
||||
hexpand: true;
|
||||
placeholder-text: _("Search User Data");
|
||||
}
|
||||
}
|
||||
}
|
||||
[end]
|
||||
ToggleButton select_button {
|
||||
icon-name: "selection-mode-symbolic";
|
||||
tooltip-text: _("Select User Data");
|
||||
}
|
||||
}
|
||||
[top]
|
||||
Adw.Clamp {
|
||||
SearchBar search_bar {
|
||||
search-mode-enabled: bind search_button.active bidirectional;
|
||||
key-capture-widget: template;
|
||||
|
||||
SearchEntry search_entry {
|
||||
[bottom]
|
||||
Revealer {
|
||||
reveal-child: bind select_button.active;
|
||||
transition-type: slide_up;
|
||||
[center]
|
||||
Box bottom_bar {
|
||||
styles ["toolbar"]
|
||||
hexpand: true;
|
||||
placeholder-text: _("Search User Data");
|
||||
}
|
||||
}
|
||||
}
|
||||
[bottom]
|
||||
Revealer {
|
||||
reveal-child: bind select_button.active;
|
||||
transition-type: slide_up;
|
||||
[center]
|
||||
Box bottom_bar {
|
||||
styles ["toolbar"]
|
||||
hexpand: true;
|
||||
homogeneous: true;
|
||||
Button select_all_button {
|
||||
styles ["raised"]
|
||||
Adw.ButtonContent {
|
||||
icon-name: "selection-mode-symbolic";
|
||||
label: _("Select All");
|
||||
can-shrink: true;
|
||||
}
|
||||
}
|
||||
Button copy_button {
|
||||
styles ["raised"]
|
||||
Adw.ButtonContent {
|
||||
icon-name: "edit-copy-symbolic";
|
||||
label: _("Copy");
|
||||
can-shrink: true;
|
||||
}
|
||||
}
|
||||
Button uninstall_button {
|
||||
styles ["raised"]
|
||||
Adw.ButtonContent {
|
||||
icon-name: "user-trash-symbolic";
|
||||
label: _("Uninstall");
|
||||
can-shrink: true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
[bottom]
|
||||
Adw.ViewSwitcherBar switcher_bar {
|
||||
stack: stack;
|
||||
visible: false;
|
||||
}
|
||||
Adw.ViewStack stack {
|
||||
Adw.ViewStackPage {
|
||||
name: "active";
|
||||
title: _("Active Data");
|
||||
icon-name: "file-manager-symbolic";
|
||||
child:
|
||||
ScrolledWindow {
|
||||
Box {
|
||||
orientation: vertical;
|
||||
Box {
|
||||
orientation: vertical;
|
||||
margin-start: 24;
|
||||
margin-end: 24;
|
||||
Label {
|
||||
label: _("Active User Data");
|
||||
styles ["title-1"]
|
||||
hexpand: true;
|
||||
halign: start;
|
||||
}
|
||||
Label {
|
||||
label: "32 Items - 39.7 GB";
|
||||
styles ["title-3"]
|
||||
hexpand: true;
|
||||
halign: start;
|
||||
}
|
||||
}
|
||||
Separator {
|
||||
margin-start: 12;
|
||||
margin-end: 12;
|
||||
margin-top: 9;
|
||||
margin-bottom: 6;
|
||||
}
|
||||
FlowBox flow_box {
|
||||
styles ["boxed-list"]
|
||||
homogeneous: true;
|
||||
valign: start;
|
||||
selection-mode: none;
|
||||
max-children-per-line: 6;
|
||||
margin-start: 12;
|
||||
margin-end: 12;
|
||||
margin-bottom: 12;
|
||||
}
|
||||
homogeneous: true;
|
||||
Button select_all_button {
|
||||
styles ["raised"]
|
||||
Adw.ButtonContent {
|
||||
icon-name: "selection-mode-symbolic";
|
||||
label: _("Select All");
|
||||
can-shrink: true;
|
||||
}
|
||||
}
|
||||
;
|
||||
}
|
||||
Adw.ViewStackPage {
|
||||
name: "leftover";
|
||||
title: _("Leftover Data");
|
||||
icon-name: "folder-templates-symbolic";
|
||||
child:
|
||||
ScrolledWindow {
|
||||
Box {
|
||||
orientation: vertical;
|
||||
Box {
|
||||
orientation: vertical;
|
||||
margin-start: 24;
|
||||
margin-end: 24;
|
||||
Label {
|
||||
label: _("Leftover User Data");
|
||||
styles ["title-1"]
|
||||
hexpand: true;
|
||||
halign: start;
|
||||
}
|
||||
Label {
|
||||
label: "25 Items - 18.6 GB";
|
||||
styles ["title-3"]
|
||||
hexpand: true;
|
||||
halign: start;
|
||||
}
|
||||
}
|
||||
Separator {
|
||||
margin-start: 12;
|
||||
margin-end: 12;
|
||||
margin-top: 9;
|
||||
margin-bottom: 6;
|
||||
}
|
||||
FlowBox {
|
||||
styles ["boxed-list"]
|
||||
homogeneous: true;
|
||||
valign: start;
|
||||
selection-mode: none;
|
||||
max-children-per-line: 6;
|
||||
margin-start: 12;
|
||||
margin-end: 12;
|
||||
margin-bottom: 12;
|
||||
}
|
||||
Button copy_button {
|
||||
styles ["raised"]
|
||||
Adw.ButtonContent {
|
||||
icon-name: "edit-copy-symbolic";
|
||||
label: _("Copy");
|
||||
can-shrink: true;
|
||||
}
|
||||
}
|
||||
;
|
||||
Button uninstall_button {
|
||||
styles ["raised"]
|
||||
Adw.ButtonContent {
|
||||
icon-name: "user-trash-symbolic";
|
||||
label: _("Uninstall");
|
||||
can-shrink: true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
[bottom]
|
||||
Adw.ViewSwitcherBar switcher_bar {
|
||||
stack: stack;
|
||||
visible: false;
|
||||
}
|
||||
Adw.ViewStack stack {
|
||||
Adw.ViewStackPage {
|
||||
name: "active";
|
||||
title: _("Active Data");
|
||||
icon-name: "file-manager-symbolic";
|
||||
child:
|
||||
ScrolledWindow scrolled_window {
|
||||
Box {
|
||||
orientation: vertical;
|
||||
Box {
|
||||
orientation: vertical;
|
||||
margin-start: 24;
|
||||
margin-end: 24;
|
||||
Label {
|
||||
label: _("Active User Data");
|
||||
styles ["title-1"]
|
||||
hexpand: true;
|
||||
halign: start;
|
||||
}
|
||||
Label {
|
||||
label: "32 Items - 39.7 GB";
|
||||
styles ["title-3"]
|
||||
hexpand: true;
|
||||
halign: start;
|
||||
}
|
||||
}
|
||||
Separator {
|
||||
margin-start: 12;
|
||||
margin-end: 12;
|
||||
margin-top: 9;
|
||||
margin-bottom: 6;
|
||||
}
|
||||
FlowBox flow_box {
|
||||
styles ["boxed-list"]
|
||||
homogeneous: true;
|
||||
valign: start;
|
||||
selection-mode: none;
|
||||
max-children-per-line: 6;
|
||||
margin-start: 12;
|
||||
margin-end: 12;
|
||||
margin-bottom: 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
;
|
||||
}
|
||||
Adw.ViewStackPage {
|
||||
name: "leftover";
|
||||
title: _("Leftover Data");
|
||||
icon-name: "folder-templates-symbolic";
|
||||
child:
|
||||
ScrolledWindow {
|
||||
Box {
|
||||
orientation: vertical;
|
||||
Box {
|
||||
orientation: vertical;
|
||||
margin-start: 24;
|
||||
margin-end: 24;
|
||||
Label {
|
||||
label: _("Leftover User Data");
|
||||
styles ["title-1"]
|
||||
hexpand: true;
|
||||
halign: start;
|
||||
}
|
||||
Label {
|
||||
label: "25 Items - 18.6 GB";
|
||||
styles ["title-3"]
|
||||
hexpand: true;
|
||||
halign: start;
|
||||
}
|
||||
}
|
||||
Separator {
|
||||
margin-start: 12;
|
||||
margin-end: 12;
|
||||
margin-top: 9;
|
||||
margin-bottom: 6;
|
||||
}
|
||||
FlowBox {
|
||||
styles ["boxed-list"]
|
||||
homogeneous: true;
|
||||
valign: start;
|
||||
selection-mode: none;
|
||||
max-children-per-line: 6;
|
||||
margin-start: 12;
|
||||
margin-end: 12;
|
||||
margin-bottom: 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,12 @@ from .data_box import DataBox
|
||||
class UserDataPage(Adw.BreakpointBin):
|
||||
__gtype_name__ = 'UserDataPage'
|
||||
gtc = Gtk.Template.Child
|
||||
bpt = gtc()
|
||||
header_bar = gtc()
|
||||
switcher_bar = gtc()
|
||||
sidebar_button = gtc()
|
||||
select_button = gtc()
|
||||
scrolled_window = gtc()
|
||||
flow_box = gtc()
|
||||
sort_pop = gtc()
|
||||
sort_list = gtc()
|
||||
@@ -39,8 +44,22 @@ class UserDataPage(Adw.BreakpointBin):
|
||||
else:
|
||||
self.sort_name.grab_focus()
|
||||
|
||||
def bpt_handler(self, _, is_applied):
|
||||
if is_applied and self.adj.get_value() == 0:
|
||||
self.header_bar.set_show_title(False)
|
||||
else:
|
||||
self.header_bar.set_show_title(True)
|
||||
|
||||
def show_title_handler(self, *args):
|
||||
if self.adj.get_value() != 0:
|
||||
self.header_bar.set_show_title(True)
|
||||
elif self.switcher_bar.get_reveal():
|
||||
self.header_bar.set_show_title(False)
|
||||
|
||||
def __init__(self, main_window, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
self.adj = self.scrolled_window.get_vadjustment()
|
||||
|
||||
# Apply
|
||||
self.__class__.instance = self
|
||||
@@ -50,9 +69,19 @@ class UserDataPage(Adw.BreakpointBin):
|
||||
self.flow_box.append(box)
|
||||
self.flow_box.get_child_at_index(i).set_focusable(False)
|
||||
|
||||
# Connections
|
||||
main_window.main_split.connect("notify::show-sidebar", lambda sidebar, *_: self.sidebar_button.set_visible(sidebar.get_collapsed() or not sidebar.get_show_sidebar()))
|
||||
main_window.main_split.connect("notify::collapsed", lambda sidebar, *_: self.sidebar_button.set_visible(sidebar.get_collapsed() or not sidebar.get_show_sidebar()))
|
||||
self.sidebar_button.connect("clicked", lambda *_: main_window.main_split.set_show_sidebar(True))
|
||||
self.sidebar_button.set_visible(main_window.main_split.get_collapsed())
|
||||
self.adj.connect("value-changed", self.show_title_handler)
|
||||
|
||||
|
||||
# self.select_button.connect("toggled", lambda *_: self.set_selection_mode(self.select_button.get_active()))
|
||||
# self.flow_box.connect("child-activated", lambda _, item: (cb := (row := item.get_child()).check_button).set_active((not cb.get_active()) if row.get_activatable() else False))
|
||||
|
||||
self.sort_name.connect("toggled", self.sort_handler)
|
||||
self.sort_id.connect("toggled", self.sort_handler)
|
||||
self.sort_size.connect("toggled", self.sort_handler)
|
||||
self.sort_size.connect("toggled", self.sort_handler)
|
||||
self.bpt.connect("apply", self.bpt_handler, True)
|
||||
self.bpt.connect("unapply", self.bpt_handler, False)
|
||||
Reference in New Issue
Block a user