Compare commits

..

4 Commits

Author SHA1 Message Date
658040c138 Better - force selection, gray out button 2026-02-02 15:08:03 +01:00
7c899b8e86 Can't continue without selecting disk 2026-02-02 15:03:30 +01:00
a098f20a38 English as the only language option 2026-02-02 14:59:35 +01:00
3bff26928a Create additional_modules.py 2026-02-02 14:59:20 +01:00
4 changed files with 131 additions and 23 deletions

View File

@@ -0,0 +1,92 @@
import gi
gi.require_version("Gtk", "4.0")
gi.require_version("Adw", "1")
from gi.repository import Adw, Gtk
class ModulesPage(Adw.Bin):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.nvidia_drivers = False
self.chromebook_audio = False
self.android_apps = False
# 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)
box.set_margin_top(24)
box.set_margin_bottom(24)
clamp.set_child(box)
# Title
title = Gtk.Label(label="Additional Modules")
title.add_css_class("title-1")
box.append(title)
descr = Gtk.Label(
label="Select additional components you would like to install. (Internet connection required)"
)
descr.set_wrap(True)
box.append(descr)
dont_worry = Gtk.Label(label="Don't worry, you can always install them later.")
dont_worry.set_wrap(True)
box.append(dont_worry)
# Preferences Group
self.modules_group = Adw.PreferencesGroup()
self.modules_group.set_title("Optional Features")
box.append(self.modules_group)
# NVIDIA Drivers
self.add_module_row(
"NVIDIA Proprietary Drivers",
"Install proprietary drivers for NVIDIA graphics cards for better performance.",
"nvidia_drivers",
)
# Chromebook Audio
self.add_module_row(
"Chromebook Audio Fixes",
"Install additional audio drivers for Chromebook devices.",
"chromebook_audio",
)
# Android Apps
self.add_module_row(
"Android Apps Support",
"Install Waydroid to run Android applications on Iridium OS.",
"android_apps",
)
def add_module_row(self, title, subtitle, attr_name):
row = Adw.ActionRow()
row.set_title(title)
row.set_subtitle(subtitle)
switch = Gtk.Switch()
switch.set_valign(Gtk.Align.CENTER)
# Set initial state
switch.set_active(getattr(self, attr_name))
# Connect signal
switch.connect("notify::active", self.on_switch_toggled, attr_name)
row.add_suffix(switch)
self.modules_group.add(row)
def on_switch_toggled(self, switch, gparam, attr_name):
setattr(self, attr_name, switch.get_active())
def get_modules(self):
return {
"nvidia_drivers": self.nvidia_drivers,
"chromebook_audio": self.chromebook_audio,
"android_apps": self.android_apps,
}

View File

@@ -6,10 +6,14 @@ import gi
gi.require_version("Gtk", "4.0")
gi.require_version("Adw", "1")
from gi.repository import Adw, Gtk
from gi.repository import Adw, GObject, Gtk
class StoragePage(Adw.Bin):
__gsignals__ = {
"disk-selected": (GObject.SignalFlags.RUN_FIRST, None, (str,)),
}
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -68,8 +72,7 @@ class StoragePage(Adw.Bin):
if not self.first_radio:
radio = Gtk.CheckButton()
self.first_radio = radio
# Default selection
self.selected_disk = dev
# No default selection to force user interaction, for safety reasons
else:
radio = Gtk.CheckButton()
radio.set_group(self.first_radio)
@@ -87,6 +90,7 @@ class StoragePage(Adw.Bin):
def on_disk_toggled(self, button, device_name):
if button.get_active():
self.selected_disk = device_name
self.emit("disk-selected", device_name)
def get_selected_disk(self):
return self.selected_disk

View File

@@ -25,12 +25,7 @@ class WelcomePage(Adw.Bin):
# Language Dropdown
languages = [
"English (US)",
"Spanish",
"French",
"German",
"Japanese",
"Chinese (Simplified)",
"English",
]
dropdown = Gtk.DropDown.new_from_strings(languages)
dropdown.set_margin_bottom(20)

View File

@@ -4,6 +4,7 @@ gi.require_version("Gtk", "4.0")
gi.require_version("Adw", "1")
from gi.repository import Adw, Gtk
from .pages.additional_modules import ModulesPage
from .pages.install_mode import InstallModePage
from .pages.partitioning import PartitioningPage, calculate_auto_partitions
from .pages.storage import StoragePage
@@ -64,8 +65,10 @@ class InstallerWindow(Adw.ApplicationWindow):
# Initialize Pages
self.welcome_page = WelcomePage()
self.storage_page = StoragePage()
self.storage_page.connect("disk-selected", self.on_disk_selected)
self.install_mode_page = InstallModePage()
self.partitioning_page = PartitioningPage()
self.modules_page = ModulesPage()
self.user_page = UserPage()
# Add Pages
@@ -73,21 +76,35 @@ class InstallerWindow(Adw.ApplicationWindow):
self.add_page(self.storage_page, "storage")
self.add_page(self.install_mode_page, "install_mode")
self.add_page(self.partitioning_page, "partitioning")
self.add_page(self.modules_page, "modules")
self.add_page(self.user_page, "user")
# Initialize view
if self.page_ids:
self.stack.set_visible_child_name(self.page_ids[0])
self.update_buttons()
def add_page(self, widget, name):
self.stack.add_named(widget, name)
self.page_ids.append(name)
def on_disk_selected(self, page, device_name):
self.update_buttons()
def update_buttons(self):
# Back button state
self.back_button.set_sensitive(self.current_page_index > 0)
# Next button label/state
current_page_name = self.page_ids[self.current_page_index]
# Forced selection logic
forced_selection = True
if current_page_name == "storage":
forced_selection = self.storage_page.get_selected_disk() is not None
self.next_button.set_sensitive(forced_selection)
if self.current_page_index == len(self.page_ids) - 1:
self.next_button.set_label("Install")
self.next_button.add_css_class("destructive-action")
@@ -99,21 +116,20 @@ class InstallerWindow(Adw.ApplicationWindow):
def on_back_clicked(self, button):
current_page = self.page_ids[self.current_page_index]
prev_page = self.page_ids[self.current_page_index - 1]
if current_page == "user":
# Default: go back one page
next_prev_index = self.current_page_index - 1
if current_page == "modules":
mode = self.install_mode_page.get_mode()
if mode == "automatic":
# Skip partitioning
self.current_page_index = self.page_ids.index("install_mode")
else:
self.current_page_index -= 1
else:
if self.current_page_index > 0:
self.current_page_index -= 1
# Skip partitioning (which is immediately before modules)
next_prev_index = self.page_ids.index("install_mode")
self.stack.set_visible_child_name(self.page_ids[self.current_page_index])
self.update_buttons()
if next_prev_index >= 0:
self.current_page_index = next_prev_index
self.stack.set_visible_child_name(self.page_ids[self.current_page_index])
self.update_buttons()
def on_next_clicked(self, button):
# Logic before transition
@@ -121,8 +137,7 @@ class InstallerWindow(Adw.ApplicationWindow):
if current_page_name == "storage":
selected_disk = self.storage_page.get_selected_disk()
if selected_disk:
self.partitioning_page.load_partitions(selected_disk)
self.partitioning_page.load_partitions(selected_disk)
next_index = self.current_page_index + 1
@@ -130,7 +145,7 @@ class InstallerWindow(Adw.ApplicationWindow):
mode = self.install_mode_page.get_mode()
if mode == "automatic":
# Skip partitioning page
next_index = self.page_ids.index("user")
next_index = self.page_ids.index("modules")
else:
# Go to partitioning page
next_index = self.page_ids.index("partitioning")
@@ -141,6 +156,8 @@ class InstallerWindow(Adw.ApplicationWindow):
print(f"Disk: {disk}")
mode = self.install_mode_page.get_mode()
print(f"Mode: {mode}")
modules = self.modules_page.get_modules()
print(f"Modules: {modules}")
partitions_config = {}
if mode == "manual":