Small design tweaks for multiple widgets

This commit is contained in:
heliguy4599
2023-09-20 02:27:56 -04:00
parent 36e58c71e5
commit 691c9762fc
7 changed files with 100 additions and 79 deletions

View File

@@ -21,7 +21,7 @@ ShortcutsWindow help_overlay {
}
ShortcutsShortcut {
title: C_("shortcut window", "Toggle Batch Mode");
title: C_("shortcut window", "Toggle Selection Mode");
action-name: "app.toggle-batch-mode";
}

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><path d="m 7 1 v 6 h -6 v 2 h 6 v 6 h 2 v -6 h 6 v -2 h -6 v -6 z m 0 0"/></svg>

After

Width:  |  Height:  |  Size: 207 B

View File

@@ -35,10 +35,8 @@ class RemotesWindow(Adw.Window):
if response_id == "cancel":
return
if response_id == "user":
install_type = "--user"
if response_id == "system":
install_type = "--user"
if not self.add_as_user:
install_type = "--system"
self.name_to_add = self.name_to_add.strip()
@@ -53,14 +51,12 @@ class RemotesWindow(Adw.Window):
self.generate_list()
def add_handler(self, _widget):
dialog = Adw.MessageDialog.new(self, _("Add a New Flatpak Remote"))
dialog = Adw.MessageDialog.new(self, _("Add Flatpak Remote"))
dialog.set_close_response("cancel")
dialog.add_response("cancel", _("Cancel"))
dialog.add_response("system", _("Add System Wide"))
dialog.add_response("user", _("Add User Wide"))
dialog.set_response_enabled("system", False)
dialog.set_response_enabled("user", False)
dialog.set_response_appearance("user", Adw.ResponseAppearance.SUGGESTED)
dialog.add_response("continue", _("Add"))
dialog.set_response_enabled("continue", False)
dialog.set_response_appearance("continue", Adw.ResponseAppearance.SUGGESTED)
def name_update(widget):
is_enabled = True
@@ -99,22 +95,50 @@ class RemotesWindow(Adw.Window):
def confirm_enabler(is_enabled):
if len(self.name_to_add) == 0 or len(self.url_to_add) == 0:
is_enabled = False
dialog.set_response_enabled("user", is_enabled)
dialog.set_response_enabled("system", is_enabled)
dialog.set_response_enabled("continue", is_enabled)
def set_user(widget):
self.add_as_user = widget.get_active()
self.name_to_add = ""
self.url_to_add = ""
self.add_as_user = True
entry_list = Gtk.ListBox(selection_mode="none")
info_box = Gtk.Box(orientation="vertical")
entry_list = Gtk.ListBox(selection_mode="none", margin_bottom=12)
entry_list.add_css_class("boxed-list")
name_entry = Adw.EntryRow(title=_("Enter Remote Name"))
name_entry = Adw.EntryRow(title=_("Name"))
name_entry.connect("changed", name_update)
url_entry = Adw.EntryRow(title=_("Enter URL Name"))
url_entry = Adw.EntryRow(title=_("URL"))
url_entry.connect("changed", url_update)
entry_list.append(name_entry)
entry_list.append(url_entry)
info_box.append(entry_list)
dialog.set_extra_child(entry_list)
install_type_list = Gtk.ListBox(selection_mode="none")
install_type_list.add_css_class("boxed-list")
user_row = Adw.ActionRow(title=_("User"), subtitle=_("Remote will be available to only you"))
user_check = Gtk.CheckButton(active=True)
user_check.connect("toggled", set_user)
user_row.add_prefix(user_check)
user_row.set_activatable_widget(user_check)
system_row = Adw.ActionRow(title=_("System"), subtitle=_("Remote will be available to every user on the system"))
system_check = Gtk.CheckButton()
system_row.add_prefix(system_check)
system_check.set_group(user_check)
system_row.set_activatable_widget(system_check)
install_type_list.append(user_row)
install_type_list.append(system_row)
info_box.append(install_type_list)
dialog.set_extra_child(info_box)
dialog.connect("response", self.on_add_response, dialog.choose_finish)
Gtk.Window.present(dialog)
@@ -136,7 +160,7 @@ class RemotesWindow(Adw.Window):
name = self.host_remotes[index][0]
title = self.host_remotes[index][1]
install_type = self.host_remotes[index][7]
dialog = Adw.MessageDialog.new(self, _("Remove {}?").format(name), _("This cannot be undone, and any installed apps from remote {} will stop receiving updates").format(name))
dialog = Adw.MessageDialog.new(self, _("Remove {}?").format(name), _("Any installed apps from {} will stop receiving updates").format(name))
dialog.set_close_response("cancel")
dialog.add_response("cancel", _("Cancel"))
dialog.add_response("continue", _("Remove"))
@@ -152,7 +176,10 @@ class RemotesWindow(Adw.Window):
name = self.host_remotes[i][0]
title = self.host_remotes[i][1]
install_type = self.host_remotes[i][7]
remote_row = Adw.ActionRow(title=title, subtitle=name)
url = self.host_remotes[i][2]
remote_row = Adw.ActionRow(title=title, subtitle=url)
if title == "-":
remote_row.set_title(name)
self.remotes_list.append(remote_row)
label = Gtk.Label(label=install_type)
label.add_css_class("subtitle")
@@ -161,14 +188,7 @@ class RemotesWindow(Adw.Window):
remove_button.add_css_class("flat")
remove_button.connect("clicked", self.remove_handler, i)
remote_row.add_suffix(remove_button)
# for i in range(len(self.host_flatpaks)):
# if name == self.host_flatpaks[i][6] and install_type == self.host_flatpaks[i][7]:
# remove_button.set_sensitive(False)
# remove_button.set_tooltip_text(_("There are apps installed from this remote"))
# break
def __init__(self, main_window, **kwargs):
super().__init__(**kwargs)
@@ -186,9 +206,7 @@ class RemotesWindow(Adw.Window):
self.headerbar = Gtk.HeaderBar()
self.remotes_list = Gtk.ListBox(selection_mode="none", margin_top=6, margin_bottom=12, margin_start=12, margin_end=12)
self.user_data_row = Adw.ActionRow(title="No User Data")
self.add_button = Gtk.Button(icon_name="list-add-symbolic", tooltip_text="Add Remote")
self.add_button.add_css_class("flat")
self.add_button.add_css_class("suggested-action")
self.add_button = Gtk.Button(icon_name="plus-large-symbolic", tooltip_text="Add Remote")
self.stack = Gtk.Stack()
# Apply Widgets
@@ -209,7 +227,7 @@ class RemotesWindow(Adw.Window):
# Window Stuffs
self.set_title(self.window_title)
self.set_default_size(500, 450)
self.set_size_request(250, 230)
self.set_size_request(260, 230)
self.set_modal(True)
self.set_resizable(True)
self.set_content(self.toolbar)

View File

@@ -5,7 +5,7 @@ import os
def show_properties_window(widget, index, window):
properties_window = Adw.Window(title=_("Properties of {}").format(window.host_flatpaks[index][0]))
properties_window.set_default_size(350, 600)
properties_window.set_size_request(250, 0)
properties_window.set_size_request(260, 230)
properties_window.set_modal(True)
properties_window.set_resizable(True)
properties_window.set_transient_for(window)

View File

@@ -12,5 +12,6 @@
<file preprocess="xml-stripblanks">info-symbolic.svg</file>
<file preprocess="xml-stripblanks">check-plain-symbolic.svg</file>
<file preprocess="xml-stripblanks">paper-filled-symbolic.svg</file>
<file preprocess="xml-stripblanks">plus-large-symbolic.svg</file>
</gresource>
</gresources>

View File

@@ -30,7 +30,7 @@ template WarehouseWindow : Adw.ApplicationWindow {
[end]
ToggleButton batch_mode_button {
icon-name: "selection-mode-symbolic";
tooltip-text: _("Enter Selection Mode");
tooltip-text: _("Toggle Selection Mode");
}
}
[top]
@@ -39,7 +39,6 @@ template WarehouseWindow : Adw.ApplicationWindow {
key-capture-widget: WarehouseWindow;
Adw.Clamp{
maximum-size: 577;
tightening-threshold: 220;
hexpand: true;
SearchEntry search_entry {}
}
@@ -53,7 +52,6 @@ template WarehouseWindow : Adw.ApplicationWindow {
ScrolledWindow scrolled_window {
vexpand: true;
Adw.Clamp{
tightening-threshold: 15;
ListBox list_of_flatpaks{
margin-top: 6;
margin-bottom: 24;
@@ -67,31 +65,6 @@ template WarehouseWindow : Adw.ApplicationWindow {
}
}
}
ActionBar batch_mode_bar {
[start]
ToggleButton batch_select_all_button {
label: "Select All";
tooltip-text: _("Select all Flatpaks");
}
[end]
Button batch_uninstall_button {
icon-name: "user-trash-symbolic";
label: _("Uninstall");
tooltip-text: _("Uninstall Selected Flatpaks");
}
[end]
Button batch_clean_button {
icon-name: "brush-symbolic";
label: _("Trash User Data");
tooltip-text: _("Send Selected Flatpaks' Data to the Trash");
}
[end]
Button batch_copy_button {
icon-name: "edit-copy-symbolic";
label: _("Copy App ID");
tooltip-text: _("Copy Selected Flatpaks' IDs Seperated by a New Line");
}
}
}
Adw.StatusPage no_flatpaks {
icon-name: "error-symbolic";
@@ -99,8 +72,33 @@ template WarehouseWindow : Adw.ApplicationWindow {
description: _("Warehouse cannot see the list of installed Flatpaks or the system has no Flatpaks installed.");
}
}
};
[bottom]
ActionBar batch_mode_bar {
[start]
ToggleButton batch_select_all_button {
label: "Select All";
tooltip-text: _("Select all Flatpaks");
}
[end]
Button batch_uninstall_button {
icon-name: "user-trash-symbolic";
// label: _("Uninstall");
tooltip-text: _("Uninstall Selected Apps");
}
[end]
Button batch_clean_button {
icon-name: "brush-symbolic";
// label: _("Trash User Data");
tooltip-text: _("Send Selected Apps' Data to the Trash");
}
[end]
Button batch_copy_button {
icon-name: "edit-copy-symbolic";
// label: _("Copy App ID");
tooltip-text: _("Copy Selected App IDs");
}
}
;
}
}

View File

@@ -231,37 +231,39 @@ class WarehouseWindow(Adw.ApplicationWindow):
global window_title
window_title = _("Manage Leftover Data")
orphans_window = Adw.Window(title=window_title)
orphans_window.set_default_size(500, 450)
orphans_window.set_size_request(0, 230)
orphans_window.set_modal(True)
orphans_window.set_resizable(True)
orphans_window.set_transient_for(self)
orphans_clamp = Adw.Clamp()
orphans_scroll = Gtk.ScrolledWindow()
orphans_toast_overlay = Adw.ToastOverlay()
orphans_stack = Gtk.Stack()
orphans_overlay = Gtk.Overlay()
orphans_stack.add_child(orphans_clamp)
orphans_clamp.set_child(orphans_overlay)
orphans_toast_overlay.set_child(orphans_stack)
orphans_progress_bar = Gtk.ProgressBar(visible=False, pulse_step=0.7)
orphans_progress_bar.add_css_class("osd")
orphans_overlay.add_overlay(orphans_progress_bar)
orphans_overlay.set_child(orphans_scroll)
orphans_toolbar_view = Adw.ToolbarView()
orphans_title_bar = Gtk.HeaderBar()
orphans_action_bar = Gtk.ActionBar()
orphans_list = Gtk.ListBox(selection_mode="none", valign=Gtk.Align.START, margin_top=6, margin_bottom=6, margin_start=12, margin_end=12)
no_data = Adw.StatusPage(icon_name="check-plain-symbolic", title=_("No Data"), description=_("There is no leftover user data"))
orphans_window.set_default_size(500, 450)
orphans_window.set_size_request(260, 230)
orphans_window.set_modal(True)
orphans_window.set_resizable(True)
orphans_window.set_transient_for(self)
orphans_stack.add_child(orphans_overlay)
orphans_toast_overlay.set_child(orphans_stack)
orphans_progress_bar.add_css_class("osd")
orphans_overlay.add_overlay(orphans_progress_bar)
orphans_overlay.set_child(orphans_scroll)
orphans_toolbar_view.add_top_bar(orphans_title_bar)
orphans_toolbar_view.add_bottom_bar(orphans_action_bar)
orphans_toolbar_view.set_content(orphans_toast_overlay)
orphans_window.set_content(orphans_toolbar_view)
orphans_list = Gtk.ListBox(selection_mode="none", valign=Gtk.Align.START, margin_top=6, margin_bottom=6, margin_start=12, margin_end=12)
orphans_list.add_css_class("boxed-list")
orphans_scroll.set_child(orphans_list)
no_data = Adw.StatusPage(icon_name="check-plain-symbolic", title=_("No Data"), description=_("There is no leftover user data"))
orphans_scroll.set_child(orphans_clamp)
orphans_clamp.set_child(orphans_list)
orphans_stack.add_child(no_data)
global total_selected
total_selected = 0
global selected_rows
@@ -575,8 +577,10 @@ class WarehouseWindow(Adw.ApplicationWindow):
self.batch_select_all_button.set_active(False)
if widget.get_active():
self.in_batch_mode = True
self.list_of_flatpaks.set_margin_bottom(6)
else:
self.in_batch_mode = False
self.list_of_flatpaks.set_margin_bottom(24)
self.refresh_list_of_flatpaks(None, False)
self.batch_actions_enable(False)
@@ -613,7 +617,7 @@ class WarehouseWindow(Adw.ApplicationWindow):
self.refresh_list_of_flatpaks(_a, False)
def batch_clean_handler(self, widget):
dialog = Adw.MessageDialog.new(self, _("Delete Selected User Data?"), _("This user data will be sent to the trash."))
dialog = Adw.MessageDialog.new(self, _("Trash Selected Apps' User Data?"), _("This user data will be sent to the trash."))
dialog.set_close_response("cancel")
dialog.add_response("cancel", _("Cancel"))
dialog.add_response("continue", _("Trash Data"))
@@ -655,9 +659,7 @@ class WarehouseWindow(Adw.ApplicationWindow):
self.batch_mode_button.connect("toggled", self.batch_mode_handler)
self.batch_copy_button.connect("clicked", self.batch_copy_handler)
self.batch_clean_button.connect("clicked", self.batch_clean_handler)
self.batch_clean_button.add_css_class("destructive-action")
self.batch_uninstall_button.connect("clicked", self.batch_uninstall_button_handler)
self.batch_uninstall_button.add_css_class("destructive-action")
self.batch_select_all_button.connect("clicked", self.batch_select_all_handler)
self.batch_actions_enable(False)
event_controller = Gtk.EventControllerKey()