Sync current work

This commit is contained in:
Heliguy
2024-08-22 20:30:36 -04:00
parent bfc2ecd13e
commit 0f874d28b8
4 changed files with 41 additions and 8 deletions

View File

@@ -273,12 +273,12 @@ class HostInfo:
capture_output=True,
).stdout
lines = output.strip().split("\n")
remote_list = []
if lines[0] != '':
remote_list = []
for line in lines:
line = line.split("\t")
remote_list.append(Remote(name=line[0], title=line[1], disabled=(len(line) == 3) and "disabled" in line[2]))
this.remotes[installation] = remote_list
this.remotes[installation] = remote_list
# Masks
cmd = ['flatpak-spawn', '--host',
@@ -363,4 +363,4 @@ class HostInfo:
except Exception as e:
this.main_window.toast_overlay.add_toast(ErrorToast(_("Could not load pacakges"), str(e)).toast)
Gio.Task.new(None, None, callback).run_in_thread(thread)
Gio.Task.new(None, None, callback).run_in_thread(thread)

View File

@@ -5,7 +5,7 @@ template $InstallPage : Adw.BreakpointBin {
width-request: 1;
height-request: 1;
Adw.Breakpoint bp1 {
Adw.Breakpoint break_point {
condition ("max-width: 600")
setters {
@@ -13,6 +13,7 @@ template $InstallPage : Adw.BreakpointBin {
split_view.show-content: false;
results_action_bar.visible: true;
pending_action_bar.visible: true;
pending_page.child: null;
}
}
@@ -75,6 +76,12 @@ template $InstallPage : Adw.BreakpointBin {
}
}
}
[bottom]
ActionBar {
Button test_button {
label: "test";
}
}
}
}
@@ -143,9 +150,10 @@ template $InstallPage : Adw.BreakpointBin {
content:
Adw.NavigationPage pending_page {
title: _("Pending Packages");
Adw.ToolbarView {
[child]
Adw.ToolbarView pending_toolbar_view {
[top]
Adw.HeaderBar {
Adw.HeaderBar pending_headerbar {
}
Stack pending_stack {
Adw.StatusPage no_added_packages_status {

View File

@@ -74,6 +74,11 @@ class InstallPage(Adw.BreakpointBin):
sidebar_button = gtc()
pending_stack = gtc()
no_added_packages_status = gtc()
break_point = gtc()
pending_toolbar_view = gtc()
pending_headerbar = gtc()
test_button = gtc()
# Referred to in the main window
# It is used to determine if a new page should be made or not
@@ -215,6 +220,7 @@ class InstallPage(Adw.BreakpointBin):
self.added_package_groups.pop(f'{row.package.remote}<>{row.package.installation}', None)
if len(self.added_package_groups) == 0:
self.list_popup.close()
self.pending_stack.set_visible_child(self.no_added_packages_status)
def list_focus_grabber(self, row):
@@ -237,6 +243,15 @@ class InstallPage(Adw.BreakpointBin):
if prev_unadded_row:
prev_unadded_row.grab_focus()
def break_point_handler(self, bp, is_applied):
self.list_popup.close()
self.pending_headerbar.set_show_start_title_buttons(not is_applied)
self.pending_headerbar.set_show_end_title_buttons(not is_applied)
if is_applied:
self.popup_holder.set_child(self.pending_toolbar_view)
else:
self.popup_holder.set_child(None)
def __init__(self, main_window, **kwargs):
super().__init__(**kwargs)
self.instance = self
@@ -248,7 +263,17 @@ class InstallPage(Adw.BreakpointBin):
# self.search_entry.connect("search-changed", self.on_search)
self.search_entry.connect("activate", self.on_search)
self.search_apply_button.connect("clicked", self.on_search)
self.review_button.connect("clicked", lambda *_: self.split_view.set_show_content(True))
# self.review_button.connect("clicked", lambda *_: self.split_view.set_show_content(True))
self.review_button.connect("clicked", lambda *_: self.list_popup.present(main_window))
self.popup_holder = Adw.NavigationPage(title=_("Pending Packages"))
self.list_popup = Adw.Dialog(width_request=400, child=self.popup_holder, follows_content_size=True, presentation_mode=Adw.DialogPresentationMode.BOTTOM_SHEET)
self.break_point.connect("apply", self.break_point_handler, True)
self.break_point.connect("unapply", self.break_point_handler, False)
# self.test_button.connect("clicked", lambda *_: self.list_popup.present(main_window))
ms = main_window.main_split
ms.connect("notify::show-sidebar", lambda *_: self.sidebar_button.set_active(ms.get_show_sidebar()))

View File

@@ -251,4 +251,4 @@ class RemotesPage(Adw.NavigationPage):
for item in self.new_remotes:
row = NewRemoteRow(item)
row.connect("activated", lambda *_, remote_info=item: AddRemoteDialog(main_window, self, remote_info).present(main_window))
self.new_remotes_group.add(row)
self.new_remotes_group.add(row)