84 lines
2.4 KiB
Python
84 lines
2.4 KiB
Python
import gi
|
|
|
|
gi.require_version("Gtk", "4.0")
|
|
gi.require_version("Adw", "1")
|
|
from gi.repository import Adw, Gtk
|
|
|
|
|
|
class StoragePage(Adw.Bin):
|
|
def __init__(self, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
|
|
# Main Layout
|
|
clamp = Adw.Clamp()
|
|
clamp.set_maximum_size(600)
|
|
self.set_child(clamp)
|
|
|
|
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
|
box.set_spacing(24)
|
|
box.set_margin_top(24)
|
|
box.set_margin_bottom(24)
|
|
clamp.set_child(box)
|
|
|
|
# Title
|
|
title = Gtk.Label(label="Installation Destination")
|
|
title.add_css_class("title-1")
|
|
box.append(title)
|
|
|
|
descr = Gtk.Label(
|
|
label="Select the storage device where you want to install Iridium OS."
|
|
)
|
|
descr.set_wrap(True)
|
|
box.append(descr)
|
|
|
|
# Disk List
|
|
group = Adw.PreferencesGroup()
|
|
group.set_title("Available Disks")
|
|
box.append(group)
|
|
|
|
# Mock Disks
|
|
disks = [
|
|
(
|
|
"NVMe Samsung 970 EVO (500GB)",
|
|
"nvme0n1",
|
|
"icon-drive-harddisk-solidstate-symbolic",
|
|
),
|
|
("SATA Seagate Barracuda (1TB)", "sda", "icon-drive-harddisk-symbolic"),
|
|
]
|
|
|
|
self.disk_rows = []
|
|
for name, dev, icon in disks:
|
|
row = Adw.ActionRow()
|
|
row.set_title(name)
|
|
row.set_subtitle(f"/dev/{dev}")
|
|
row.set_icon_name(icon)
|
|
|
|
# Radio button for selection
|
|
if not self.disk_rows:
|
|
radio = Gtk.CheckButton()
|
|
self.first_radio = radio
|
|
else:
|
|
radio = Gtk.CheckButton()
|
|
radio.set_group(self.first_radio)
|
|
|
|
radio.set_valign(Gtk.Align.CENTER)
|
|
row.add_suffix(radio)
|
|
row.set_activatable_widget(radio)
|
|
|
|
group.add(row)
|
|
self.disk_rows.append(row)
|
|
|
|
# Partitioning Options
|
|
part_group = Adw.PreferencesGroup()
|
|
part_group.set_title("Configuration")
|
|
box.append(part_group)
|
|
|
|
auto_row = Adw.ActionRow()
|
|
auto_row.set_title("Automatic Partitioning")
|
|
auto_row.set_subtitle("Erase disk and install Iridium")
|
|
part_switch = Gtk.Switch()
|
|
part_switch.set_active(True)
|
|
part_switch.set_valign(Gtk.Align.CENTER)
|
|
auto_row.add_suffix(part_switch)
|
|
part_group.add(auto_row)
|