Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

window: Port to modern widgets #3674

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft
55 changes: 55 additions & 0 deletions bottles/frontend/bottle-details-view-subpage.blp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using Gtk 4.0;
using Adw 1;

template $BottleDetailsViewSubpage: Adw.NavigationPage {
title: bind content_title.title;
tag: "subpage";

child: Adw.ToolbarView {
[top]
Adw.HeaderBar content_headerbar {
show-start-title-buttons: false;

title-widget: Adw.WindowTitle content_title {};

[end]
Box box_actions {}

[end]
MenuButton btn_operations {
visible: false;
tooltip-text: _("Operations");
popover: pop_tasks;

Spinner spinner_tasks {}

styles [
"flat",
]
}
}

content: Stack stack_bottle {
transition-type: crossfade;
};
};
}

Popover pop_tasks {
Box {
orientation: vertical;
spacing: 3;

Box {
orientation: vertical;

ListBox list_tasks {
selection-mode: none;

styles [
"content",
]
}
}
}
}
108 changes: 11 additions & 97 deletions bottles/frontend/bottle-details-view.blp
Original file line number Diff line number Diff line change
@@ -1,103 +1,17 @@
using Gtk 4.0;
using Adw 1;

template $BottleDetailsView: Adw.Bin {
Adw.Leaflet leaflet {
can-navigate-back: true;
can-unfold: false;
hexpand: true;

Box {
orientation: vertical;

Adw.HeaderBar sidebar_headerbar {
show-end-title-buttons: false;

title-widget: Adw.WindowTitle sidebar_title {
title: _("Details");
};

[start]
Button btn_back {
icon-name: "go-previous-symbolic";
tooltip-text: _("Go Back");
}

[end]
Box default_actions {}
}

Box default_view {}
template $BottleDetailsView: Adw.NavigationPage {
title: _("Details");
tag: "details";

child: Adw.ToolbarView {
[top]
Adw.HeaderBar {
[end]
Box default_actions {}
}

Adw.LeafletPage {
navigatable: false;

child: Separator panel_separator {
orientation: vertical;

styles [
"sidebar",
]
};
}

Box content {
orientation: vertical;

Adw.HeaderBar content_headerbar {
show-start-title-buttons: false;

title-widget: Adw.WindowTitle content_title {};

[start]
Button btn_back_sidebar {
icon-name: "go-previous-symbolic";
tooltip-text: _("Go Back");
visible: false;
}

[end]
Box box_actions {}

[end]
MenuButton btn_operations {
visible: false;
tooltip-text: _("Operations");
popover: pop_tasks;

Spinner spinner_tasks {}

styles [
"flat",
]
}
}

Stack stack_bottle {
transition-type: crossfade;
hexpand: true;
vexpand: true;
}
}
}
}

Popover pop_tasks {
Box {
orientation: vertical;
spacing: 3;

Box {
orientation: vertical;

ListBox list_tasks {
selection-mode: none;

styles [
"content",
]
}
}
}
content: Box default_view {};
};
}
9 changes: 5 additions & 4 deletions bottles/frontend/bottle_details_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ def __init__(self, details, config, **kwargs):
# common variables and references
self.window = details.window
self.manager = details.window.manager
self.stack_bottle = details.stack_bottle
self.leaflet = details.leaflet
self.stack_bottle = details.details_view_subpage.stack_bottle
self.details = details
self.config = config
self.show_hidden = False
Expand Down Expand Up @@ -154,10 +153,12 @@ def __change_page(self, _widget, page_name):
the page is not available, it will show the "bottle" page.
"""
if page_name == "taskmanager":
self.details.view_taskmanager.update(config=self.config)
self.details.details_view_subpage.view_taskmanager.update(
config=self.config
)
try:
self.stack_bottle.set_visible_child_name(page_name)
self.leaflet.navigate(Adw.NavigationDirection.FORWARD)
self.window.main_leaf.push(self.details.details_view_subpage)
except: # pylint: disable=bare-except
pass

Expand Down
Loading
Loading