fix(ui): correct mount point selection pre-fill and simplify partition creation dialog
This commit is contained in:
@@ -474,6 +474,13 @@ class PartitioningPage(Adw.Bin):
|
||||
|
||||
options = ["/", "/boot/efi", "[SWAP]", "None"]
|
||||
dropdown = Gtk.DropDown.new_from_strings(options)
|
||||
|
||||
current_mp = data.get("mount_point")
|
||||
if current_mp in options:
|
||||
dropdown.set_selected(options.index(current_mp))
|
||||
elif not current_mp:
|
||||
dropdown.set_selected(options.index("None"))
|
||||
|
||||
box.append(Gtk.Label(label=f"Mount point for {data['name']}:"))
|
||||
box.append(dropdown)
|
||||
|
||||
@@ -519,24 +526,6 @@ class PartitioningPage(Adw.Bin):
|
||||
box.append(Gtk.Label(label="Partition Type:"))
|
||||
box.append(type_dropdown)
|
||||
|
||||
# Filesystem dropdown
|
||||
fs_options = ["ext4", "fat32", "swap"]
|
||||
fs_dropdown = Gtk.DropDown.new_from_strings(fs_options)
|
||||
box.append(Gtk.Label(label="Filesystem:"))
|
||||
box.append(fs_dropdown)
|
||||
|
||||
# Auto-update FS based on Type
|
||||
def on_type_changed(dropdown, pspec):
|
||||
selected_type = type_names[dropdown.get_selected()]
|
||||
if selected_type == "EFI System":
|
||||
fs_dropdown.set_selected(1) # fat32
|
||||
elif selected_type == "Swap":
|
||||
fs_dropdown.set_selected(2) # swap
|
||||
else:
|
||||
fs_dropdown.set_selected(0) # ext4
|
||||
|
||||
type_dropdown.connect("notify::selected", on_type_changed)
|
||||
|
||||
error_label = Gtk.Label(label="")
|
||||
error_label.add_css_class("error")
|
||||
box.append(error_label)
|
||||
@@ -545,13 +534,16 @@ class PartitioningPage(Adw.Bin):
|
||||
from ...backend.disk import create_partition
|
||||
selected_type = type_names[type_dropdown.get_selected()]
|
||||
|
||||
# Default name based on type
|
||||
# Default name and fstype based on type
|
||||
if selected_type == "EFI System":
|
||||
name = "EFI System"
|
||||
fstype = "fat32"
|
||||
elif selected_type == "Swap":
|
||||
name = "Swap"
|
||||
fstype = "swap"
|
||||
else:
|
||||
name = "Linux filesystem"
|
||||
fstype = "ext4"
|
||||
|
||||
size_text = size_entry.get_text()
|
||||
try:
|
||||
@@ -564,7 +556,6 @@ class PartitioningPage(Adw.Bin):
|
||||
return
|
||||
|
||||
type_code = types[selected_type]
|
||||
fstype = fs_options[fs_dropdown.get_selected()]
|
||||
|
||||
try:
|
||||
create_partition(self.current_disk_path, size_mb, type_code, name, fstype)
|
||||
|
||||
@@ -27,15 +27,6 @@ class SummaryPage(Adw.Bin):
|
||||
content_box.set_spacing(24)
|
||||
clamp.set_child(content_box)
|
||||
|
||||
# Installation Settings
|
||||
self.install_group = Adw.PreferencesGroup()
|
||||
self.install_group.set_title("Installation Settings")
|
||||
content_box.append(self.install_group)
|
||||
|
||||
self.mount_row = Adw.ActionRow()
|
||||
self.mount_row.set_title("Installation Root (Mount Point)")
|
||||
self.install_group.add(self.mount_row)
|
||||
|
||||
# Storage and partitioning
|
||||
self.storage_group = Adw.PreferencesGroup()
|
||||
self.storage_group.set_title("Storage & Partitioning")
|
||||
@@ -75,10 +66,7 @@ class SummaryPage(Adw.Bin):
|
||||
self.modules_row.set_title("Additional Modules")
|
||||
self.software_group.add(self.modules_row)
|
||||
|
||||
def update_summary(self, disk_info, mode, partitions, user_info, modules, mount_root):
|
||||
# Update Mount Root
|
||||
self.mount_row.set_subtitle(mount_root)
|
||||
|
||||
def update_summary(self, disk_info, mode, partitions, user_info, modules):
|
||||
# Update Disk
|
||||
self.disk_row.set_subtitle(str(disk_info))
|
||||
|
||||
|
||||
@@ -50,19 +50,6 @@ class WelcomePage(Adw.Bin):
|
||||
dropdown = Gtk.DropDown.new_from_strings(languages)
|
||||
box.append(dropdown)
|
||||
|
||||
# Mount Point Entry
|
||||
mount_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
|
||||
mount_box.set_margin_top(24)
|
||||
mount_label = Gtk.Label(label="Installation Root (Mount Point):")
|
||||
mount_label.set_halign(Gtk.Align.START)
|
||||
self.mount_entry = Gtk.Entry(text="/mnt")
|
||||
mount_box.append(mount_label)
|
||||
mount_box.append(self.mount_entry)
|
||||
box.append(mount_box)
|
||||
|
||||
page.set_child(box)
|
||||
|
||||
self.set_child(page)
|
||||
|
||||
def get_mount_root(self):
|
||||
return self.mount_entry.get_text()
|
||||
|
||||
@@ -214,7 +214,6 @@ class InstallerWindow(Adw.ApplicationWindow):
|
||||
mode = self.install_mode_page.get_mode()
|
||||
modules = self.modules_page.get_modules()
|
||||
user_info = self.user_page.get_user_info()
|
||||
mount_root = self.welcome_page.get_mount_root()
|
||||
|
||||
partitions_config = {}
|
||||
if mode == "manual":
|
||||
@@ -230,7 +229,6 @@ class InstallerWindow(Adw.ApplicationWindow):
|
||||
partitions=partitions_config,
|
||||
user_info=user_info,
|
||||
modules=modules,
|
||||
mount_root=mount_root,
|
||||
)
|
||||
# Proceed to summary page (which is next_index after user)
|
||||
|
||||
@@ -241,7 +239,6 @@ class InstallerWindow(Adw.ApplicationWindow):
|
||||
mode = self.install_mode_page.get_mode()
|
||||
modules = self.modules_page.get_modules()
|
||||
user_info = self.user_page.get_user_info()
|
||||
mount_root = self.welcome_page.get_mount_root()
|
||||
|
||||
if self.mock_mode:
|
||||
print("!!! MOCK MODE ENABLED - NO CHANGES WILL BE MADE !!!")
|
||||
@@ -249,7 +246,6 @@ class InstallerWindow(Adw.ApplicationWindow):
|
||||
print(f"Mode: {mode}")
|
||||
print(f"Modules: {modules}")
|
||||
print(f"User: {user_info}")
|
||||
print(f"Mount Root: {mount_root}")
|
||||
print("Simulation complete.")
|
||||
# Show success in UI even in mock
|
||||
self.show_finish_page("Mock Installation Complete!")
|
||||
@@ -269,6 +265,7 @@ class InstallerWindow(Adw.ApplicationWindow):
|
||||
|
||||
# Step 2: Mounting
|
||||
print("Step 2: Mounting...")
|
||||
mount_root = "/mnt"
|
||||
mount_partitions(parts, mount_root)
|
||||
|
||||
# Step 3: OS Installation
|
||||
|
||||
Reference in New Issue
Block a user