Can't continue without selecting disk

This commit is contained in:
2026-02-02 15:03:30 +01:00
parent a098f20a38
commit 7c899b8e86
2 changed files with 28 additions and 16 deletions

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
@@ -66,6 +67,7 @@ class InstallerWindow(Adw.ApplicationWindow):
self.storage_page = StoragePage()
self.install_mode_page = InstallModePage()
self.partitioning_page = PartitioningPage()
self.modules_page = ModulesPage()
self.user_page = UserPage()
# Add Pages
@@ -73,6 +75,7 @@ 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
@@ -99,21 +102,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]
# Default: go back one page
next_prev_index = self.current_page_index - 1
if current_page == "user":
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 +123,17 @@ 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)
if not selected_disk:
dialog = Adw.MessageDialog(
transient_for=self,
heading="No Disk Selected",
body="Please select a storage device to proceed."
)
dialog.add_response("ok", "OK")
dialog.present()
return
self.partitioning_page.load_partitions(selected_disk)
next_index = self.current_page_index + 1
@@ -130,7 +141,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 +152,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":