mirror of
https://github.com/morgan9e/warehouse
synced 2026-04-14 00:04:08 +09:00
Add new files for install dialog
This commit is contained in:
40
src/install_page/file_install_dialog.blp
Normal file
40
src/install_page/file_install_dialog.blp
Normal file
@@ -0,0 +1,40 @@
|
||||
using Gtk 4.0;
|
||||
using Adw 1;
|
||||
|
||||
template $FileInstallDialog : Adw.Dialog {
|
||||
title: _("Install Local Files");
|
||||
follows-content-size: true;
|
||||
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: _("Add");
|
||||
}
|
||||
}
|
||||
Adw.ToastOverlay toast_overlay {
|
||||
ScrolledWindow content_page {
|
||||
propagate-natural-height: true;
|
||||
propagate-natural-width: true;
|
||||
Adw.Clamp {
|
||||
ListBox list_box {
|
||||
margin-start: 12;
|
||||
margin-end: 12;
|
||||
margin-top: 12;
|
||||
margin-bottom: 12;
|
||||
selection-mode: none;
|
||||
valign: start;
|
||||
styles ["boxed-list"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
src/install_page/file_install_dialog.py
Normal file
31
src/install_page/file_install_dialog.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from gi.repository import Adw, Gtk, GLib, Gio
|
||||
from .host_info import HostInfo
|
||||
from .error_toast import error_toast
|
||||
|
||||
@Gtk.Template(resource_path="/io/github/flattool/Warehouse/install_page/file_install_dialog.ui")
|
||||
class FileInstallDialog(Adw.Dialog):
|
||||
__gtype_name__ = "FileInstallDialog"
|
||||
gtc = Gtk.Template.Child
|
||||
|
||||
cancel_button = gtc()
|
||||
apply_button = gtc()
|
||||
toast_overlay = gtc()
|
||||
content_page = gtc()
|
||||
list_box = gtc()
|
||||
|
||||
def generate_list(self):
|
||||
for file in self.files:
|
||||
row = Adw.ActionRow(title=file.get_basename())
|
||||
self.list_box.append(row)
|
||||
|
||||
def __init__(self, parent_page, files, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
# Extra Object Creation
|
||||
self.parent_page = parent_page
|
||||
self.files = files
|
||||
|
||||
# Apply
|
||||
self.generate_list()
|
||||
|
||||
# Connections
|
||||
@@ -23,6 +23,7 @@ blueprints = custom_target('blueprints',
|
||||
'snapshot_page/snapshots_list_page.blp',
|
||||
'snapshot_page/snapshot_box.blp',
|
||||
'snapshot_page/new_snapshot_dialog.blp',
|
||||
'install_page/file_install_dialog.blp',
|
||||
'install_page/install_page.blp',
|
||||
'install_page/result_row.blp',
|
||||
'install_page/select_page.blp',
|
||||
@@ -92,6 +93,7 @@ warehouse_sources = [
|
||||
'snapshot_page/snapshots_list_page.py',
|
||||
'snapshot_page/snapshot_box.py',
|
||||
'snapshot_page/new_snapshot_dialog.py',
|
||||
'install_page/file_install_dialog.py',
|
||||
'install_page/install_page.py',
|
||||
'install_page/result_row.py',
|
||||
'install_page/select_page.py',
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
<file preprocess="xml-stripblanks">snapshot_page/snapshots_list_page.ui</file>
|
||||
<file preprocess="xml-stripblanks">snapshot_page/snapshot_box.ui</file>
|
||||
<file preprocess="xml-stripblanks">snapshot_page/new_snapshot_dialog.ui</file>
|
||||
<file preprocess="xml-stripblanks">install_page/file_install_dialog.ui</file>
|
||||
<file preprocess="xml-stripblanks">install_page/install_page.ui</file>
|
||||
<file preprocess="xml-stripblanks">install_page/result_row.ui</file>
|
||||
<file preprocess="xml-stripblanks">install_page/select_page.ui</file>
|
||||
|
||||
Reference in New Issue
Block a user