mirror of
https://github.com/morgan9e/warehouse
synced 2026-04-15 00:34:42 +09:00
Further refine UI
This commit is contained in:
@@ -27,10 +27,12 @@ class InstallationChooser(Adw.PreferencesGroup):
|
||||
if is_plural:
|
||||
self.user_row.set_subtitle(_("These {} will only be available to you").format(content_name))
|
||||
self.system_row.set_subtitle(_("These {} will be available to everyone").format(content_name))
|
||||
self.set_description(_("Choose how these {} will be installed").format(content_name))
|
||||
else:
|
||||
self.user_row.set_subtitle(_("This {} will only be available to you").format(content_name))
|
||||
self.system_row.set_subtitle(_("This {} will be available to everyone").format(content_name))
|
||||
|
||||
self.set_description(_("Choose how this {} will be installed").format(content_name))
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
|
||||
@@ -1,18 +1,40 @@
|
||||
using Gtk 4.0;
|
||||
using Adw 1;
|
||||
|
||||
template $FileInstallDialog : Adw.AlertDialog {
|
||||
template $FileInstallDialog : Adw.Dialog {
|
||||
follows-content-size: true;
|
||||
Box {
|
||||
orientation: vertical;
|
||||
spacing: 12;
|
||||
Adw.PreferencesGroup packages_group {
|
||||
Adw.ToolbarView {
|
||||
[top]
|
||||
Adw.HeaderBar {
|
||||
show-start-title-buttons: false;
|
||||
show-end-title-buttons: false;
|
||||
[start]
|
||||
Button cancel_button {
|
||||
label: _("Cancel");
|
||||
}
|
||||
[end]
|
||||
Button apply_button {
|
||||
styles ["suggested-action"]
|
||||
label: _("Install");
|
||||
}
|
||||
}
|
||||
$InstallationChooser installation_chooser {
|
||||
ScrolledWindow content_page {
|
||||
propagate-natural-height: true;
|
||||
propagate-natural-width: true;
|
||||
Adw.Clamp {
|
||||
margin-start: 12;
|
||||
margin-end: 12;
|
||||
margin-bottom: 12;
|
||||
margin-top: 6;
|
||||
Box {
|
||||
orientation: vertical;
|
||||
spacing: 12;
|
||||
Adw.PreferencesGroup packages_group {
|
||||
}
|
||||
$InstallationChooser installation_chooser {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
responses [
|
||||
cancel: _("Cancel"),
|
||||
continue: _("Add") suggested,
|
||||
]
|
||||
}
|
||||
|
||||
@@ -4,12 +4,14 @@ from .error_toast import ErrorToast
|
||||
from .installation_chooser import InstallationChooser
|
||||
|
||||
@Gtk.Template(resource_path="/io/github/flattool/Warehouse/install_page/file_install_dialog.ui")
|
||||
class FileInstallDialog(Adw.AlertDialog):
|
||||
class FileInstallDialog(Adw.Dialog):
|
||||
__gtype_name__ = "FileInstallDialog"
|
||||
gtc = Gtk.Template.Child
|
||||
|
||||
packages_group = gtc()
|
||||
installation_chooser = gtc()
|
||||
cancel_button = gtc()
|
||||
apply_button = gtc()
|
||||
|
||||
def generate_list(self):
|
||||
for file in self.files:
|
||||
@@ -17,13 +19,10 @@ class FileInstallDialog(Adw.AlertDialog):
|
||||
row.add_prefix(Gtk.Image(icon_name="flatpak-symbolic"))
|
||||
self.packages_group.add(row)
|
||||
|
||||
def on_response(self, dialog, response):
|
||||
if response != "continue":
|
||||
return
|
||||
|
||||
# self.installation_row.get_selected_item().get_string()
|
||||
def on_response(self, *args):
|
||||
self.on_add(self.installation_chooser.get_installation(), self.files)
|
||||
|
||||
self.close()
|
||||
|
||||
def __init__(self, parent_page, files, on_add, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
@@ -35,13 +34,16 @@ class FileInstallDialog(Adw.AlertDialog):
|
||||
# Apply
|
||||
self.generate_list()
|
||||
if len(files) > 1:
|
||||
self.set_heading(_("Review Packages"))
|
||||
self.set_body(_("The following packages will be added to the queue"))
|
||||
self.set_title(_("Install Packages"))
|
||||
self.packages_group.set_title(_("Review Packages"))
|
||||
self.packages_group.set_description(_("The following packages will be installed"))
|
||||
self.installation_chooser.set_content_strings(_("Packages"), True)
|
||||
else:
|
||||
self.set_heading(_("Review Package"))
|
||||
self.set_body(_("The following package will be added to the queue"))
|
||||
self.set_title(_("Install Package"))
|
||||
self.packages_group.set_title(_("Review Package"))
|
||||
self.packages_group.set_description(_("The following package will be installed"))
|
||||
self.installation_chooser.set_content_strings(_("package"), False)
|
||||
|
||||
# Connections
|
||||
self.connect("response", self.on_response)
|
||||
self.cancel_button.connect("clicked", lambda *_: self.close())
|
||||
self.apply_button.connect("clicked", self.on_response)
|
||||
|
||||
Reference in New Issue
Block a user