75 lines
2.3 KiB
Python
75 lines
2.3 KiB
Python
import gi
|
|
|
|
gi.require_version("Gtk", "4.0")
|
|
gi.require_version("Adw", "1")
|
|
from gi.repository import Adw, Gtk
|
|
|
|
|
|
class InstallModePage(Adw.Bin):
|
|
def __init__(self, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
|
|
self.mode = "automatic"
|
|
|
|
# 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_valign(Gtk.Align.CENTER) # Vertically Center
|
|
box.set_margin_top(24)
|
|
box.set_margin_bottom(24)
|
|
clamp.set_child(box)
|
|
|
|
# Title
|
|
title = Gtk.Label(label="Installation Type")
|
|
title.add_css_class("title-1")
|
|
box.append(title)
|
|
|
|
descr = Gtk.Label(label="How would you like to install Iridium OS?")
|
|
descr.set_wrap(True)
|
|
box.append(descr)
|
|
|
|
# Selection Group
|
|
group = Adw.PreferencesGroup()
|
|
box.append(group)
|
|
|
|
# Automatic
|
|
self.auto_row = Adw.ActionRow()
|
|
self.auto_row.set_title("Automatic")
|
|
self.auto_row.set_subtitle(
|
|
"Erase the selected disk and install Iridium. (Recommended)"
|
|
)
|
|
self.auto_row.set_icon_name("drive-harddisk-solidstate-symbolic")
|
|
group.add(self.auto_row)
|
|
|
|
self.auto_radio = Gtk.CheckButton()
|
|
self.auto_radio.set_active(True)
|
|
self.auto_radio.connect("toggled", self.on_mode_toggled, "automatic")
|
|
self.auto_row.add_suffix(self.auto_radio)
|
|
self.auto_row.set_activatable_widget(self.auto_radio)
|
|
|
|
# Manual
|
|
self.manual_row = Adw.ActionRow()
|
|
self.manual_row.set_title("Manual Partitioning")
|
|
self.manual_row.set_subtitle(
|
|
"Create or resize partitions yourself. For advanced users."
|
|
)
|
|
self.manual_row.set_icon_name("preferences-system-symbolic")
|
|
group.add(self.manual_row)
|
|
|
|
self.manual_radio = Gtk.CheckButton()
|
|
self.manual_radio.set_group(self.auto_radio)
|
|
self.manual_radio.connect("toggled", self.on_mode_toggled, "manual")
|
|
self.manual_row.add_suffix(self.manual_radio)
|
|
self.manual_row.set_activatable_widget(self.manual_radio)
|
|
|
|
def on_mode_toggled(self, button, mode_name):
|
|
if button.get_active():
|
|
self.mode = mode_name
|
|
|
|
def get_mode(self):
|
|
return self.mode
|