86 lines
2.8 KiB
Python
86 lines
2.8 KiB
Python
import gi
|
|
|
|
gi.require_version("Gtk", "4.0")
|
|
gi.require_version("Adw", "1")
|
|
from gi.repository import Adw, Gtk
|
|
|
|
|
|
class SummaryPage(Adw.Bin):
|
|
def __init__(self, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
|
|
self.status_page = Adw.StatusPage()
|
|
self.status_page.set_title("Summary")
|
|
self.status_page.set_description("Review your choices before installing")
|
|
self.status_page.set_icon_name("document-save-symbolic")
|
|
self.set_child(self.status_page)
|
|
|
|
# Main content box
|
|
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
|
box.set_spacing(24)
|
|
|
|
clamp = Adw.Clamp()
|
|
clamp.set_maximum_size(600)
|
|
self.status_page.set_child(clamp)
|
|
|
|
content_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
|
content_box.set_spacing(24)
|
|
clamp.set_child(content_box)
|
|
|
|
# Storage and partitioning
|
|
self.storage_group = Adw.PreferencesGroup()
|
|
self.storage_group.set_title("Storage & Partitioning")
|
|
content_box.append(self.storage_group)
|
|
|
|
self.disk_row = Adw.ActionRow()
|
|
self.disk_row.set_title("Target Disk")
|
|
self.storage_group.add(self.disk_row)
|
|
|
|
self.mode_row = Adw.ActionRow()
|
|
self.mode_row.set_title("Partitioning Mode")
|
|
self.storage_group.add(self.mode_row)
|
|
|
|
# User configuration
|
|
self.user_group = Adw.PreferencesGroup()
|
|
self.user_group.set_title("User Configuration")
|
|
content_box.append(self.user_group)
|
|
|
|
self.fullname_row = Adw.ActionRow()
|
|
self.fullname_row.set_title("Full Name")
|
|
self.user_group.add(self.fullname_row)
|
|
|
|
self.username_row = Adw.ActionRow()
|
|
self.username_row.set_title("Username")
|
|
self.user_group.add(self.username_row)
|
|
|
|
self.hostname_row = Adw.ActionRow()
|
|
self.hostname_row.set_title("Hostname")
|
|
self.user_group.add(self.hostname_row)
|
|
|
|
# Software
|
|
self.software_group = Adw.PreferencesGroup()
|
|
self.software_group.set_title("Software")
|
|
content_box.append(self.software_group)
|
|
|
|
self.modules_row = Adw.ActionRow()
|
|
self.modules_row.set_title("Additional Modules")
|
|
self.software_group.add(self.modules_row)
|
|
|
|
def update_summary(self, disk_info, mode, partitions, user_info, modules):
|
|
# Update Disk
|
|
self.disk_row.set_subtitle(str(disk_info))
|
|
|
|
# Update Mode
|
|
self.mode_row.set_subtitle(mode.capitalize())
|
|
|
|
# Update User Info
|
|
self.fullname_row.set_subtitle(user_info.get("fullname", ""))
|
|
self.username_row.set_subtitle(user_info.get("username", ""))
|
|
self.hostname_row.set_subtitle(user_info.get("hostname", ""))
|
|
|
|
# Update Modules
|
|
if modules:
|
|
self.modules_row.set_subtitle(", ".join(modules))
|
|
else:
|
|
self.modules_row.set_subtitle("None")
|