Fix logic error in page transitions

This commit is contained in:
2026-02-03 16:43:19 +01:00
parent 33d989cfad
commit 2f9338af0a

View File

@@ -287,6 +287,100 @@ class InstallerWindow(Adw.ApplicationWindow):
# self.bottom_bar.set_visible(True) # self.bottom_bar.set_visible(True)
# self.next_button.set_label("Finish") # self.next_button.set_label("Finish")
def on_next_clicked(self, button):
# Logic before transition
current_page_name = self.page_ids[self.current_page_index]
if current_page_name == "storage":
selected_disk = self.storage_page.get_selected_disk()
self.partitioning_page.load_partitions(selected_disk)
next_index = self.current_page_index + 1
if current_page_name == "install_mode":
mode = self.install_mode_page.get_mode()
if mode == "automatic":
# Skip partitioning page
next_index = self.page_ids.index("modules")
else:
# Go to partitioning page
next_index = self.page_ids.index("partitioning")
if current_page_name == "user":
# Prepare summary instead of installing immediately
disk = self.storage_page.get_selected_disk()
mode = self.install_mode_page.get_mode()
modules = self.modules_page.get_modules()
user_info = self.user_page.get_user_info()
partitions_config = {}
if mode == "manual":
partitions_config = self.partitioning_page.get_config()
elif mode == "automatic":
partitions = calculate_auto_partitions(disk)
partitions_config = {"partitions": partitions}
# Update summary page
self.summary_page.update_summary(
disk_info=disk,
mode=mode,
partitions=partitions_config,
user_info=user_info,
modules=modules,
)
# Proceed to summary page (which is next_index after user)
if current_page_name == "summary":
# THIS IS THE REAL INSTALL TRIGGER
print("Install process triggered!")
disk = self.storage_page.get_selected_disk()
mode = self.install_mode_page.get_mode()
modules = self.modules_page.get_modules()
user_info = self.user_page.get_user_info()
if self.mock_mode:
print("!!! MOCK MODE ENABLED - NO CHANGES WILL BE MADE !!!")
print(f"Target Disk: {disk}")
print(f"Mode: {mode}")
print(f"Modules: {modules}")
print(f"User: {user_info}")
print("Simulation complete.")
# Show success in UI even in mock
self.show_finish_page("Mock Installation Complete!")
else:
from ..backend.disk import auto_partition_disk, mount_partitions
from ..backend.os_install import install_minimal_os, configure_system
# Simple progress UI transition
self.show_progress_page("Installing Iridium OS...")
# We should really run this in a thread to keep UI responsive,
# but for "barely bootable" requirement and simplicity:
try:
# Step 1: Partitioning
print("Step 1: Partitioning...")
parts = auto_partition_disk(disk)
# Step 2: Mounting
print("Step 2: Mounting...")
mount_root = "/mnt"
mount_partitions(parts, mount_root)
# Step 3: OS Installation
print("Step 3: OS Installation...")
install_minimal_os(mount_root)
# Step 4: Configure
print("Step 4: Configuration...")
configure_system(mount_root, parts)
self.show_finish_page("Installation Successful!")
except Exception as e:
print(f"Installation failed: {e}")
self.show_finish_page(f"Installation Failed: {e}", success=False)
return
if next_index < len(self.page_ids): if next_index < len(self.page_ids):
self.current_page_index = next_index self.current_page_index = next_index
self.stack.set_visible_child_name(self.page_ids[self.current_page_index]) self.stack.set_visible_child_name(self.page_ids[self.current_page_index])