Compare commits
23 Commits
a27f38ef6a
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| aae235e81f | |||
| 759b4c4007 | |||
| 9958b9a65b | |||
| 1afdf99a6f | |||
| 26757288c4 | |||
| 7a69d62782 | |||
| f691be219d | |||
| 281f7488af | |||
| 931f701591 | |||
| 52897a1dd0 | |||
| 2c7b9c5b1f | |||
| 658040c138 | |||
| 7c899b8e86 | |||
| a098f20a38 | |||
| 3bff26928a | |||
| 001d07cc80 | |||
| ae16c2ca23 | |||
| 0f448bfa6c | |||
| f341fe0d60 | |||
| f642d7ef94 | |||
| f8b9cb62f9 | |||
| 62e1276881 | |||
| 17eac3de50 |
17
README.md
17
README.md
@@ -0,0 +1,17 @@
|
|||||||
|
<div align="center">
|
||||||
|
<img src="data/icons/org.iridium.Installer.svg" alt="Iridium OS Installer Icon" width="128" height="128">
|
||||||
|
|
||||||
|
# Iridium OS Installer
|
||||||
|
</div>
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> For now this is only a mockup and not actually functional.
|
||||||
|
|
||||||
|
## What is Iridium Installer?
|
||||||
|
Iridium Installer is a modern, GTK4/Libadwaita based installer designed for Iridium OS. It aims to provide a simple and elegant installation experience.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- Modern UI using **GTK4** and **Libadwaita**
|
||||||
|
- Automatic and Manual partitioning modes
|
||||||
|
- User configuration
|
||||||
|
- Module selection
|
||||||
|
|||||||
16
data/icons/org.iridium.Installer-symbolic.svg
Normal file
16
data/icons/org.iridium.Installer-symbolic.svg
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<svg
|
||||||
|
height="16px"
|
||||||
|
viewBox="0 0 16 16"
|
||||||
|
width="16px"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M 8 1 C 4.132812 1 1 4.132812 1 8 C 1 11.867188 4.132812 15 8 15 C 11.867188 15 15 11.867188 15 8 C 15 4.132812 11.867188 1 8 1 Z M 8 3 C 10.761719 3 13 5.238281 13 8 C 13 10.761719 10.761719 13 8 13 C 5.238281 13 3 10.761719 3 8 C 3 5.238281 5.238281 3 8 3 Z M 8 3"
|
||||||
|
fill="#2e3436"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M 8 5 C 6.34375 5 5 6.34375 5 8 C 5 9.65625 6.34375 11 8 11 C 9.65625 11 11 9.65625 11 8 C 11 6.34375 9.65625 5 8 5 Z M 8 6 C 9.105469 6 10 6.894531 10 8 C 10 9.105469 9.105469 10 8 10 C 6.894531 10 6 9.105469 6 8 C 6 6.894531 6.894531 6 8 6 Z M 8 6"
|
||||||
|
fill="#2e3436"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 772 B |
39
data/icons/org.iridium.Installer.svg
Normal file
39
data/icons/org.iridium.Installer.svg
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<svg
|
||||||
|
width="128"
|
||||||
|
height="128"
|
||||||
|
viewBox="0 0 128 128"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="circle-bg" x1="0%" y1="0%" x2="0%" y2="100%">
|
||||||
|
<stop offset="0%" stop-color="#5E5C64" />
|
||||||
|
<stop offset="100%" stop-color="#3D3846" />
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
<circle cx="64" cy="64" r="56" fill="url(#circle-bg)" />
|
||||||
|
<circle
|
||||||
|
cx="64"
|
||||||
|
cy="64"
|
||||||
|
r="40"
|
||||||
|
fill="none"
|
||||||
|
stroke="#F6D32D"
|
||||||
|
stroke-width="8"
|
||||||
|
stroke-dasharray="75 25"
|
||||||
|
stroke-linecap="round"
|
||||||
|
opacity="0.9"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<circle
|
||||||
|
cx="64"
|
||||||
|
cy="64"
|
||||||
|
r="28"
|
||||||
|
fill="none"
|
||||||
|
stroke="#F5C211"
|
||||||
|
stroke-width="4"
|
||||||
|
stroke-dasharray="45 20"
|
||||||
|
stroke-linecap="round"
|
||||||
|
opacity="0.8"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<circle cx="64" cy="64" r="10" fill="#F6D32D" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 871 B |
9
data/org.iridium.Installer.desktop
Normal file
9
data/org.iridium.Installer.desktop
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Name=Iridium Installer
|
||||||
|
Comment=Install Iridium OS on your computer
|
||||||
|
Exec=iridium-installer
|
||||||
|
Icon=org.iridium.Installer
|
||||||
|
Type=Application
|
||||||
|
Categories=System;Settings;
|
||||||
|
StartupNotify=true
|
||||||
|
Terminal=false
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
@@ -11,21 +12,30 @@ from .ui.window import InstallerWindow
|
|||||||
|
|
||||||
|
|
||||||
class IridiumInstallerApp(Adw.Application):
|
class IridiumInstallerApp(Adw.Application):
|
||||||
def __init__(self):
|
def __init__(self, mock_mode=False):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
application_id="org.iridium.Installer",
|
application_id="org.iridium.Installer",
|
||||||
flags=Gio.ApplicationFlags.FLAGS_NONE,
|
flags=Gio.ApplicationFlags.FLAGS_NONE,
|
||||||
)
|
)
|
||||||
|
self.mock_mode = mock_mode
|
||||||
|
|
||||||
def do_activate(self):
|
def do_activate(self):
|
||||||
win = self.props.active_window
|
win = self.props.active_window
|
||||||
if not win:
|
if not win:
|
||||||
win = InstallerWindow(application=self)
|
win = InstallerWindow(application=self, mock_mode=self.mock_mode)
|
||||||
win.present()
|
win.present()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
app = IridiumInstallerApp()
|
parser = argparse.ArgumentParser(description="Iridium OS Installer")
|
||||||
|
parser.add_argument(
|
||||||
|
"--mock",
|
||||||
|
action="store_true",
|
||||||
|
help="Run in mock mode (no actual changes to disk)",
|
||||||
|
)
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
app = IridiumInstallerApp(mock_mode=args.mock)
|
||||||
return app.run(sys.argv)
|
return app.run(sys.argv)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
101
iridium_installer/ui/pages/additional_modules.py
Normal file
101
iridium_installer/ui/pages/additional_modules.py
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
self.module_titles = {
|
||||||
|
"nvidia_drivers": "Proprietary NVIDIA Drivers",
|
||||||
|
"chromebook_audio": "Chromebook Audio Fixes",
|
||||||
|
"android_apps": "Android Apps Support",
|
||||||
|
}
|
||||||
|
|
||||||
|
# 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(
|
||||||
|
self.module_titles["nvidia_drivers"],
|
||||||
|
"Install proprietary drivers for NVIDIA graphics cards for better performance.",
|
||||||
|
"nvidia_drivers",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Chromebook Audio
|
||||||
|
self.add_module_row(
|
||||||
|
self.module_titles["chromebook_audio"],
|
||||||
|
"Install additional audio drivers for Chromebook devices.",
|
||||||
|
"chromebook_audio",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Android Apps
|
||||||
|
self.add_module_row(
|
||||||
|
self.module_titles["android_apps"],
|
||||||
|
"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):
|
||||||
|
enabled_modules = []
|
||||||
|
if self.nvidia_drivers:
|
||||||
|
enabled_modules.append(self.module_titles["nvidia_drivers"])
|
||||||
|
if self.chromebook_audio:
|
||||||
|
enabled_modules.append(self.module_titles["chromebook_audio"])
|
||||||
|
if self.android_apps:
|
||||||
|
enabled_modules.append(self.module_titles["android_apps"])
|
||||||
|
return enabled_modules
|
||||||
74
iridium_installer/ui/pages/install_mode.py
Normal file
74
iridium_installer/ui/pages/install_mode.py
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
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
|
||||||
473
iridium_installer/ui/pages/partitioning.py
Normal file
473
iridium_installer/ui/pages/partitioning.py
Normal file
@@ -0,0 +1,473 @@
|
|||||||
|
import json
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
import gi
|
||||||
|
|
||||||
|
gi.require_version("Gtk", "4.0")
|
||||||
|
gi.require_version("Adw", "1")
|
||||||
|
from gi.repository import Adw, Gdk, Gio, GObject, Gtk
|
||||||
|
|
||||||
|
CSS = """
|
||||||
|
.part-segment {
|
||||||
|
border-radius: 0;
|
||||||
|
box-shadow: none;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
.part-segment:first-child {
|
||||||
|
border-top-left-radius: 6px;
|
||||||
|
border-bottom-left-radius: 6px;
|
||||||
|
}
|
||||||
|
.part-segment:last-child {
|
||||||
|
border-top-right-radius: 6px;
|
||||||
|
border-bottom-right-radius: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.part-efi {
|
||||||
|
background-color: #3584e4; /* Blue */
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.part-root {
|
||||||
|
background-color: #2ec27e; /* Green */
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.part-swap {
|
||||||
|
background-color: #e66100; /* Orange */
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.part-empty {
|
||||||
|
background-color: #deddda; /* Gray */
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
def get_total_memory() -> int:
|
||||||
|
"""Returns total system memory in bytes."""
|
||||||
|
try:
|
||||||
|
return os.sysconf("SC_PAGE_SIZE") * os.sysconf("SC_PHYS_PAGES")
|
||||||
|
except (ValueError, OSError):
|
||||||
|
with open("/proc/meminfo", "r") as f:
|
||||||
|
for line in f:
|
||||||
|
if line.startswith("MemTotal:"):
|
||||||
|
parts = line.split()
|
||||||
|
return int(parts[1]) * 1024
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
def calculate_auto_partitions(disk_device):
|
||||||
|
"""
|
||||||
|
Generates an automatic partition layout.
|
||||||
|
- 2GB EFI
|
||||||
|
- RAM + 2GB Swap
|
||||||
|
- Rest Root (ext4)
|
||||||
|
"""
|
||||||
|
disk_size = 0
|
||||||
|
try:
|
||||||
|
# Get disk size in bytes
|
||||||
|
result = subprocess.run(
|
||||||
|
["lsblk", "-J", "-b", "-o", "NAME,SIZE,TYPE"],
|
||||||
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
)
|
||||||
|
if result.returncode == 0:
|
||||||
|
data = json.loads(result.stdout)
|
||||||
|
devices = data.get("blockdevices", [])
|
||||||
|
dev_name = disk_device.replace("/dev/", "")
|
||||||
|
|
||||||
|
for dev in devices:
|
||||||
|
if dev.get("name") == dev_name:
|
||||||
|
disk_size = int(dev.get("size", 0))
|
||||||
|
break
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error getting disk size for auto partitioning: {e}")
|
||||||
|
return []
|
||||||
|
|
||||||
|
if disk_size == 0:
|
||||||
|
return []
|
||||||
|
|
||||||
|
ram_size = get_total_memory()
|
||||||
|
|
||||||
|
# Sizes in bytes
|
||||||
|
efi_size = 2 * 1024 * 1024 * 1024
|
||||||
|
swap_size = ram_size + (2 * 1024 * 1024 * 1024)
|
||||||
|
|
||||||
|
# Check if disk is large enough
|
||||||
|
min_root = 10 * 1024 * 1024 * 1024 # minimum 10GB for root
|
||||||
|
if disk_size < (efi_size + swap_size + min_root):
|
||||||
|
print("Disk too small for automatic partitioning scheme.")
|
||||||
|
return []
|
||||||
|
|
||||||
|
root_size = disk_size - efi_size - swap_size
|
||||||
|
|
||||||
|
partitions = [
|
||||||
|
{
|
||||||
|
"type": "partition",
|
||||||
|
"name": "EFI System",
|
||||||
|
"filesystem": "vfat",
|
||||||
|
"mount_point": "/boot/efi",
|
||||||
|
"size": f"{efi_size / (1024**3):.1f} GB",
|
||||||
|
"bytes": efi_size,
|
||||||
|
"style_class": "part-efi",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "partition",
|
||||||
|
"name": "Swap",
|
||||||
|
"filesystem": "swap",
|
||||||
|
"mount_point": "[SWAP]",
|
||||||
|
"size": f"{swap_size / (1024**3):.1f} GB",
|
||||||
|
"bytes": swap_size,
|
||||||
|
"style_class": "part-swap",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "partition",
|
||||||
|
"name": "Root",
|
||||||
|
"filesystem": "ext4",
|
||||||
|
"mount_point": "/",
|
||||||
|
"size": f"{root_size / (1024**3):.1f} GB",
|
||||||
|
"bytes": root_size,
|
||||||
|
"style_class": "part-root",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
return partitions
|
||||||
|
|
||||||
|
|
||||||
|
class PartitionSegment(Gtk.Button):
|
||||||
|
def __init__(self, part_data, page, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
self.part_data = part_data
|
||||||
|
self.page = page
|
||||||
|
|
||||||
|
self.add_css_class("part-segment")
|
||||||
|
self.add_css_class(part_data["style_class"])
|
||||||
|
|
||||||
|
self.set_hexpand(part_data.get("expand", False))
|
||||||
|
|
||||||
|
if "width_request" in part_data:
|
||||||
|
self.set_size_request(part_data["width_request"], -1)
|
||||||
|
|
||||||
|
if part_data.get("label"):
|
||||||
|
lbl = Gtk.Label(label=part_data["label"])
|
||||||
|
lbl.set_ellipsize(3)
|
||||||
|
self.set_child(lbl)
|
||||||
|
|
||||||
|
self.connect("clicked", self.on_clicked)
|
||||||
|
|
||||||
|
right_click = Gtk.GestureClick()
|
||||||
|
right_click.set_button(3)
|
||||||
|
right_click.connect("pressed", self.on_right_click)
|
||||||
|
self.add_controller(right_click)
|
||||||
|
|
||||||
|
def on_clicked(self, button):
|
||||||
|
self.page.show_details_window(self.part_data)
|
||||||
|
|
||||||
|
def on_right_click(self, gesture, n_press, x, y):
|
||||||
|
self.page.show_context_menu(self, x, y)
|
||||||
|
|
||||||
|
|
||||||
|
class PartitioningPage(Adw.Bin):
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
provider = Gtk.CssProvider()
|
||||||
|
provider.load_from_data(CSS.encode())
|
||||||
|
Gtk.StyleContext.add_provider_for_display(
|
||||||
|
Gdk.Display.get_default(), provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
|
||||||
|
)
|
||||||
|
|
||||||
|
clamp = Adw.Clamp()
|
||||||
|
clamp.set_maximum_size(800)
|
||||||
|
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 = Gtk.Label(label="Manual Partitioning")
|
||||||
|
title.add_css_class("title-1")
|
||||||
|
box.append(title)
|
||||||
|
|
||||||
|
descr = Gtk.Label(
|
||||||
|
label="Modify the partition layout below. Right-click segments for options."
|
||||||
|
)
|
||||||
|
descr.set_wrap(True)
|
||||||
|
box.append(descr)
|
||||||
|
|
||||||
|
disk_info_group = Adw.PreferencesGroup()
|
||||||
|
disk_info_group.set_title("Selected Drive")
|
||||||
|
box.append(disk_info_group)
|
||||||
|
|
||||||
|
row = Adw.ActionRow()
|
||||||
|
row.set_title("Current Disk")
|
||||||
|
row.set_subtitle("Detecting...")
|
||||||
|
row.set_icon_name("drive-harddisk-symbolic")
|
||||||
|
disk_info_group.add(row)
|
||||||
|
self.disk_row = row
|
||||||
|
|
||||||
|
bar_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||||
|
bar_box.set_spacing(12)
|
||||||
|
box.append(bar_box)
|
||||||
|
|
||||||
|
bar_label = Gtk.Label(label="Partition Layout", xalign=0)
|
||||||
|
bar_label.add_css_class("heading")
|
||||||
|
bar_box.append(bar_label)
|
||||||
|
|
||||||
|
self.visual_bar = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
|
||||||
|
self.visual_bar.add_css_class("card")
|
||||||
|
self.visual_bar.set_overflow(Gtk.Overflow.HIDDEN)
|
||||||
|
self.visual_bar.set_size_request(-1, 80)
|
||||||
|
|
||||||
|
bar_box.append(self.visual_bar)
|
||||||
|
|
||||||
|
legend_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
|
||||||
|
legend_box.set_spacing(12)
|
||||||
|
legend_box.set_halign(Gtk.Align.CENTER)
|
||||||
|
bar_box.append(legend_box)
|
||||||
|
|
||||||
|
self.add_legend_item(legend_box, "part-efi", "EFI System")
|
||||||
|
self.add_legend_item(legend_box, "part-root", "Root Filesystem")
|
||||||
|
self.add_legend_item(legend_box, "part-empty", "Free Space")
|
||||||
|
|
||||||
|
self.partitions = []
|
||||||
|
# Initially empty until loaded with a specific disk
|
||||||
|
|
||||||
|
def load_partitions(self, disk_device=None):
|
||||||
|
target_disk = None
|
||||||
|
|
||||||
|
try:
|
||||||
|
result = subprocess.run(
|
||||||
|
["lsblk", "-J", "-b", "-o", "NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT,PKNAME"],
|
||||||
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
)
|
||||||
|
if result.returncode == 0:
|
||||||
|
data = json.loads(result.stdout)
|
||||||
|
devices = data.get("blockdevices", [])
|
||||||
|
|
||||||
|
if disk_device:
|
||||||
|
# Look for the specific device (match name, e.g. "nvme0n1")
|
||||||
|
# disk_device from storage page is usually just the name like "nvme0n1" or "sda"
|
||||||
|
# But if it's full path /dev/sda, we need to strip /dev/
|
||||||
|
dev_name = disk_device.replace("/dev/", "")
|
||||||
|
|
||||||
|
for dev in devices:
|
||||||
|
if dev.get("name") == dev_name:
|
||||||
|
target_disk = dev
|
||||||
|
break
|
||||||
|
|
||||||
|
# If no specific disk requested or not found, maybe fallback or do nothing
|
||||||
|
# The previous logic found the first one. Let's keep strict if device is provided.
|
||||||
|
if not target_disk and not disk_device:
|
||||||
|
for dev in devices:
|
||||||
|
if (
|
||||||
|
dev.get("type") == "disk"
|
||||||
|
and not dev.get("name").startswith("zram")
|
||||||
|
and not dev.get("name").startswith("loop")
|
||||||
|
):
|
||||||
|
target_disk = dev
|
||||||
|
break
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error loading disks: {e}")
|
||||||
|
|
||||||
|
if target_disk:
|
||||||
|
self.disk_row.set_title(target_disk.get("name", "Unknown Disk"))
|
||||||
|
self.disk_row.set_subtitle(
|
||||||
|
f"Size: {self.format_size(target_disk.get('size', 0))}"
|
||||||
|
)
|
||||||
|
|
||||||
|
raw_parts = target_disk.get("children", [])
|
||||||
|
self.partitions = []
|
||||||
|
|
||||||
|
total_disk_size = int(target_disk.get("size", 0))
|
||||||
|
covered_size = 0
|
||||||
|
|
||||||
|
for p in raw_parts:
|
||||||
|
p_size = int(p.get("size", 0))
|
||||||
|
covered_size += p_size
|
||||||
|
|
||||||
|
fstype = p.get("fstype", "").lower()
|
||||||
|
style = "part-root"
|
||||||
|
if "fat" in fstype or "efi" in fstype:
|
||||||
|
style = "part-efi"
|
||||||
|
elif "swap" in fstype:
|
||||||
|
style = "part-swap"
|
||||||
|
|
||||||
|
self.partitions.append(
|
||||||
|
{
|
||||||
|
"type": "partition",
|
||||||
|
"name": p.get("name"),
|
||||||
|
"filesystem": p.get("fstype", "Unknown"),
|
||||||
|
"label": p.get("name"),
|
||||||
|
"mount_point": p.get("mountpoint", ""),
|
||||||
|
"size": self.format_size(p_size),
|
||||||
|
"bytes": p_size,
|
||||||
|
"style_class": style,
|
||||||
|
"expand": False,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
remaining = total_disk_size - covered_size
|
||||||
|
if remaining > 100 * 1024 * 1024:
|
||||||
|
self.partitions.append(
|
||||||
|
{
|
||||||
|
"type": "empty",
|
||||||
|
"name": "Unallocated",
|
||||||
|
"size": self.format_size(remaining),
|
||||||
|
"bytes": remaining,
|
||||||
|
"style_class": "part-empty",
|
||||||
|
"expand": False,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
total_display_units = 1000
|
||||||
|
for p in self.partitions:
|
||||||
|
ratio = p["bytes"] / total_disk_size if total_disk_size > 0 else 0
|
||||||
|
width = int(ratio * 800)
|
||||||
|
if width < 50:
|
||||||
|
width = 50
|
||||||
|
p["width_request"] = width
|
||||||
|
|
||||||
|
else:
|
||||||
|
self.partitions = [
|
||||||
|
{
|
||||||
|
"type": "empty",
|
||||||
|
"name": "No Disk Selected",
|
||||||
|
"size": "-",
|
||||||
|
"style_class": "part-empty",
|
||||||
|
"width_request": 300,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
self.refresh_bar()
|
||||||
|
|
||||||
|
def format_size(self, size_bytes):
|
||||||
|
size = float(size_bytes)
|
||||||
|
for unit in ["B", "KB", "MB", "GB", "TB"]:
|
||||||
|
if size < 1024.0:
|
||||||
|
return f"{size:.1f} {unit}"
|
||||||
|
size /= 1024.0
|
||||||
|
return f"{size:.1f} PB"
|
||||||
|
|
||||||
|
def add_legend_item(self, box, style_class, label_text):
|
||||||
|
item = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
|
||||||
|
item.set_spacing(6)
|
||||||
|
|
||||||
|
swatch = Gtk.Box()
|
||||||
|
swatch.set_size_request(16, 16)
|
||||||
|
swatch.add_css_class(style_class)
|
||||||
|
swatch.add_css_class("circular")
|
||||||
|
|
||||||
|
label = Gtk.Label(label=label_text)
|
||||||
|
|
||||||
|
item.append(swatch)
|
||||||
|
item.append(label)
|
||||||
|
box.append(item)
|
||||||
|
|
||||||
|
def refresh_bar(self):
|
||||||
|
child = self.visual_bar.get_first_child()
|
||||||
|
while child:
|
||||||
|
next_child = child.get_next_sibling()
|
||||||
|
self.visual_bar.remove(child)
|
||||||
|
child = next_child
|
||||||
|
|
||||||
|
for part in self.partitions:
|
||||||
|
segment = PartitionSegment(part, self)
|
||||||
|
self.visual_bar.append(segment)
|
||||||
|
|
||||||
|
def show_details_window(self, data):
|
||||||
|
win = Adw.Window(title="Partition Details")
|
||||||
|
win.set_transient_for(self.get_root())
|
||||||
|
win.set_modal(True)
|
||||||
|
win.set_default_size(300, 200)
|
||||||
|
|
||||||
|
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||||
|
box.set_spacing(12)
|
||||||
|
box.set_margin_top(24)
|
||||||
|
box.set_margin_bottom(24)
|
||||||
|
box.set_margin_start(24)
|
||||||
|
box.set_margin_end(24)
|
||||||
|
win.set_content(box)
|
||||||
|
|
||||||
|
title = Gtk.Label(label=data.get("name", "Unknown"))
|
||||||
|
title.add_css_class("title-2")
|
||||||
|
box.append(title)
|
||||||
|
|
||||||
|
grid = Gtk.Grid()
|
||||||
|
grid.set_column_spacing(12)
|
||||||
|
grid.set_row_spacing(6)
|
||||||
|
grid.set_halign(Gtk.Align.CENTER)
|
||||||
|
box.append(grid)
|
||||||
|
|
||||||
|
rows = [
|
||||||
|
("Type", data.get("type", "-")),
|
||||||
|
("Size", data.get("size", "-")),
|
||||||
|
]
|
||||||
|
if data.get("type") == "partition":
|
||||||
|
rows.append(("Filesystem", data.get("filesystem", "-")))
|
||||||
|
rows.append(("Mount Point", data.get("mount_point") or "None"))
|
||||||
|
|
||||||
|
for i, (key, val) in enumerate(rows):
|
||||||
|
k_lbl = Gtk.Label(label=key, xalign=1)
|
||||||
|
k_lbl.add_css_class("dim-label")
|
||||||
|
v_lbl = Gtk.Label(label=val, xalign=0)
|
||||||
|
|
||||||
|
grid.attach(k_lbl, 0, i, 1, 1)
|
||||||
|
grid.attach(v_lbl, 1, i, 1, 1)
|
||||||
|
|
||||||
|
btn = Gtk.Button(label="Close")
|
||||||
|
btn.connect("clicked", lambda b: win.close())
|
||||||
|
btn.set_halign(Gtk.Align.CENTER)
|
||||||
|
box.append(btn)
|
||||||
|
|
||||||
|
win.present()
|
||||||
|
|
||||||
|
def show_context_menu(self, widget, x, y):
|
||||||
|
data = widget.part_data
|
||||||
|
|
||||||
|
popover = Gtk.Popover()
|
||||||
|
popover.set_parent(widget)
|
||||||
|
|
||||||
|
menu_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||||
|
menu_box.set_spacing(0)
|
||||||
|
popover.set_child(menu_box)
|
||||||
|
|
||||||
|
def add_menu_item(label, icon_name=None, destructive=False):
|
||||||
|
btn = Gtk.Button(label=label)
|
||||||
|
btn.add_css_class("flat")
|
||||||
|
btn.set_halign(Gtk.Align.FILL)
|
||||||
|
if destructive:
|
||||||
|
btn.add_css_class("destructive-action")
|
||||||
|
|
||||||
|
if icon_name:
|
||||||
|
content = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
|
||||||
|
content.set_spacing(12)
|
||||||
|
icon = Gtk.Image.new_from_icon_name(icon_name)
|
||||||
|
lbl = Gtk.Label(label=label)
|
||||||
|
content.append(icon)
|
||||||
|
content.append(lbl)
|
||||||
|
btn.set_child(content)
|
||||||
|
|
||||||
|
menu_box.append(btn)
|
||||||
|
return btn
|
||||||
|
|
||||||
|
if data.get("type") == "partition":
|
||||||
|
add_menu_item("Select Mount Point", "folder-open-symbolic")
|
||||||
|
add_menu_item("Format", "drive-harddisk-symbolic")
|
||||||
|
add_menu_item("Resize", "object-resize-symbolic")
|
||||||
|
separator = Gtk.Separator()
|
||||||
|
menu_box.append(separator)
|
||||||
|
btn_del = add_menu_item("Delete", "user-trash-symbolic", destructive=True)
|
||||||
|
btn_del.add_css_class("error")
|
||||||
|
|
||||||
|
elif data.get("type") == "empty":
|
||||||
|
add_menu_item("Create Partition", "list-add-symbolic")
|
||||||
|
|
||||||
|
popover.popup()
|
||||||
|
|
||||||
|
def get_config(self):
|
||||||
|
return {"partitions": self.partitions}
|
||||||
@@ -1,14 +1,24 @@
|
|||||||
|
import json
|
||||||
|
import subprocess
|
||||||
|
from functools import partial
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
|
|
||||||
gi.require_version("Gtk", "4.0")
|
gi.require_version("Gtk", "4.0")
|
||||||
gi.require_version("Adw", "1")
|
gi.require_version("Adw", "1")
|
||||||
from gi.repository import Adw, Gtk
|
from gi.repository import Adw, GObject, Gtk
|
||||||
|
|
||||||
|
|
||||||
class StoragePage(Adw.Bin):
|
class StoragePage(Adw.Bin):
|
||||||
|
__gsignals__ = {
|
||||||
|
"disk-selected": (GObject.SignalFlags.RUN_FIRST, None, (str,)),
|
||||||
|
}
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
self.selected_disk = None
|
||||||
|
|
||||||
# Main Layout
|
# Main Layout
|
||||||
clamp = Adw.Clamp()
|
clamp = Adw.Clamp()
|
||||||
clamp.set_maximum_size(600)
|
clamp.set_maximum_size(600)
|
||||||
@@ -16,6 +26,7 @@ class StoragePage(Adw.Bin):
|
|||||||
|
|
||||||
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||||
box.set_spacing(24)
|
box.set_spacing(24)
|
||||||
|
box.set_valign(Gtk.Align.CENTER)
|
||||||
box.set_margin_top(24)
|
box.set_margin_top(24)
|
||||||
box.set_margin_bottom(24)
|
box.set_margin_bottom(24)
|
||||||
clamp.set_child(box)
|
clamp.set_child(box)
|
||||||
@@ -32,11 +43,13 @@ class StoragePage(Adw.Bin):
|
|||||||
box.append(descr)
|
box.append(descr)
|
||||||
|
|
||||||
# Disk List
|
# Disk List
|
||||||
group = Adw.PreferencesGroup()
|
self.disk_group = Adw.PreferencesGroup()
|
||||||
group.set_title("Available Disks")
|
self.disk_group.set_title("Available Disks")
|
||||||
box.append(group)
|
box.append(self.disk_group)
|
||||||
|
|
||||||
# Mock Disks
|
# Fetch real disks or fallback to mock
|
||||||
|
disks = self.get_disks()
|
||||||
|
if not disks:
|
||||||
disks = [
|
disks = [
|
||||||
(
|
(
|
||||||
"NVMe Samsung 970 EVO (500GB)",
|
"NVMe Samsung 970 EVO (500GB)",
|
||||||
@@ -47,37 +60,73 @@ class StoragePage(Adw.Bin):
|
|||||||
]
|
]
|
||||||
|
|
||||||
self.disk_rows = []
|
self.disk_rows = []
|
||||||
for name, dev, icon in disks:
|
self.first_radio = None
|
||||||
|
|
||||||
|
for i, (name, dev, icon) in enumerate(disks):
|
||||||
row = Adw.ActionRow()
|
row = Adw.ActionRow()
|
||||||
row.set_title(name)
|
row.set_title(name)
|
||||||
row.set_subtitle(f"/dev/{dev}")
|
row.set_subtitle(f"/dev/{dev}")
|
||||||
row.set_icon_name(icon)
|
row.set_icon_name(icon)
|
||||||
|
|
||||||
# Radio button for selection
|
# Radio button for selection
|
||||||
if not self.disk_rows:
|
if not self.first_radio:
|
||||||
radio = Gtk.CheckButton()
|
radio = Gtk.CheckButton()
|
||||||
self.first_radio = radio
|
self.first_radio = radio
|
||||||
|
# No default selection to force user interaction, for safety reasons
|
||||||
else:
|
else:
|
||||||
radio = Gtk.CheckButton()
|
radio = Gtk.CheckButton()
|
||||||
radio.set_group(self.first_radio)
|
radio.set_group(self.first_radio)
|
||||||
|
|
||||||
radio.set_valign(Gtk.Align.CENTER)
|
radio.set_valign(Gtk.Align.CENTER)
|
||||||
|
# Connect signal to update selection
|
||||||
|
radio.connect("toggled", self.on_disk_toggled, dev)
|
||||||
|
|
||||||
row.add_suffix(radio)
|
row.add_suffix(radio)
|
||||||
row.set_activatable_widget(radio)
|
row.set_activatable_widget(radio)
|
||||||
|
|
||||||
group.add(row)
|
self.disk_group.add(row)
|
||||||
self.disk_rows.append(row)
|
self.disk_rows.append(row)
|
||||||
|
|
||||||
# Partitioning Options
|
def on_disk_toggled(self, button, device_name):
|
||||||
part_group = Adw.PreferencesGroup()
|
if button.get_active():
|
||||||
part_group.set_title("Configuration")
|
self.selected_disk = device_name
|
||||||
box.append(part_group)
|
self.emit("disk-selected", device_name)
|
||||||
|
|
||||||
auto_row = Adw.ActionRow()
|
def get_selected_disk(self):
|
||||||
auto_row.set_title("Automatic Partitioning")
|
return self.selected_disk
|
||||||
auto_row.set_subtitle("Erase disk and install Iridium")
|
|
||||||
part_switch = Gtk.Switch()
|
def get_disks(self):
|
||||||
part_switch.set_active(True)
|
try:
|
||||||
part_switch.set_valign(Gtk.Align.CENTER)
|
# lsblk -J -o NAME,SIZE,MODEL,TYPE,TRAN
|
||||||
auto_row.add_suffix(part_switch)
|
result = subprocess.run(
|
||||||
part_group.add(auto_row)
|
["lsblk", "-J", "-o", "NAME,SIZE,MODEL,TYPE,TRAN"],
|
||||||
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
)
|
||||||
|
if result.returncode != 0:
|
||||||
|
print(f"lsblk failed with code {result.returncode}: {result.stderr}")
|
||||||
|
return []
|
||||||
|
|
||||||
|
data = json.loads(result.stdout)
|
||||||
|
disks = []
|
||||||
|
for device in data.get("blockdevices", []):
|
||||||
|
# Filter for physical disks usually
|
||||||
|
if device.get("type") == "disk":
|
||||||
|
model = device.get("model")
|
||||||
|
size = device.get("size")
|
||||||
|
name = f"{model} ({size})" if model else f"Unknown Drive ({size})"
|
||||||
|
dev = device.get("name")
|
||||||
|
|
||||||
|
tran = device.get("tran", "").lower() if device.get("tran") else ""
|
||||||
|
if "usb" in tran:
|
||||||
|
icon = "drive-removable-media-symbolic"
|
||||||
|
elif "nvme" in dev:
|
||||||
|
icon = "drive-harddisk-solidstate-symbolic"
|
||||||
|
else:
|
||||||
|
icon = "drive-harddisk-symbolic"
|
||||||
|
|
||||||
|
disks.append((name, dev, icon))
|
||||||
|
return disks
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error getting disks: {e}")
|
||||||
|
return []
|
||||||
|
|||||||
85
iridium_installer/ui/pages/summary.py
Normal file
85
iridium_installer/ui/pages/summary.py
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
import gi
|
||||||
|
|
||||||
|
gi.require_version("Gtk", "4.0")
|
||||||
|
gi.require_version("Adw", "1")
|
||||||
|
from gi.repository import Adw, Gtk
|
||||||
|
|
||||||
|
|
||||||
|
class SummaryPage(Adw.Bin):
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
self.status_page = Adw.StatusPage()
|
||||||
|
self.status_page.set_title("Summary")
|
||||||
|
self.status_page.set_description("Review your choices before installing")
|
||||||
|
self.status_page.set_icon_name("document-save-symbolic")
|
||||||
|
self.set_child(self.status_page)
|
||||||
|
|
||||||
|
# Main content box
|
||||||
|
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||||
|
box.set_spacing(24)
|
||||||
|
|
||||||
|
clamp = Adw.Clamp()
|
||||||
|
clamp.set_maximum_size(600)
|
||||||
|
self.status_page.set_child(clamp)
|
||||||
|
|
||||||
|
content_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||||
|
content_box.set_spacing(24)
|
||||||
|
clamp.set_child(content_box)
|
||||||
|
|
||||||
|
# Storage and partitioning
|
||||||
|
self.storage_group = Adw.PreferencesGroup()
|
||||||
|
self.storage_group.set_title("Storage & Partitioning")
|
||||||
|
content_box.append(self.storage_group)
|
||||||
|
|
||||||
|
self.disk_row = Adw.ActionRow()
|
||||||
|
self.disk_row.set_title("Target Disk")
|
||||||
|
self.storage_group.add(self.disk_row)
|
||||||
|
|
||||||
|
self.mode_row = Adw.ActionRow()
|
||||||
|
self.mode_row.set_title("Partitioning Mode")
|
||||||
|
self.storage_group.add(self.mode_row)
|
||||||
|
|
||||||
|
# User configuration
|
||||||
|
self.user_group = Adw.PreferencesGroup()
|
||||||
|
self.user_group.set_title("User Configuration")
|
||||||
|
content_box.append(self.user_group)
|
||||||
|
|
||||||
|
self.fullname_row = Adw.ActionRow()
|
||||||
|
self.fullname_row.set_title("Full Name")
|
||||||
|
self.user_group.add(self.fullname_row)
|
||||||
|
|
||||||
|
self.username_row = Adw.ActionRow()
|
||||||
|
self.username_row.set_title("Username")
|
||||||
|
self.user_group.add(self.username_row)
|
||||||
|
|
||||||
|
self.hostname_row = Adw.ActionRow()
|
||||||
|
self.hostname_row.set_title("Hostname")
|
||||||
|
self.user_group.add(self.hostname_row)
|
||||||
|
|
||||||
|
# Software
|
||||||
|
self.software_group = Adw.PreferencesGroup()
|
||||||
|
self.software_group.set_title("Software")
|
||||||
|
content_box.append(self.software_group)
|
||||||
|
|
||||||
|
self.modules_row = Adw.ActionRow()
|
||||||
|
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):
|
||||||
|
# Update Disk
|
||||||
|
self.disk_row.set_subtitle(str(disk_info))
|
||||||
|
|
||||||
|
# Update Mode
|
||||||
|
self.mode_row.set_subtitle(mode.capitalize())
|
||||||
|
|
||||||
|
# Update User Info
|
||||||
|
self.fullname_row.set_subtitle(user_info.get("fullname", ""))
|
||||||
|
self.username_row.set_subtitle(user_info.get("username", ""))
|
||||||
|
self.hostname_row.set_subtitle(user_info.get("hostname", ""))
|
||||||
|
|
||||||
|
# Update Modules
|
||||||
|
if modules:
|
||||||
|
self.modules_row.set_subtitle(", ".join(modules))
|
||||||
|
else:
|
||||||
|
self.modules_row.set_subtitle("None")
|
||||||
@@ -1,20 +1,29 @@
|
|||||||
|
import re
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
|
|
||||||
gi.require_version("Gtk", "4.0")
|
gi.require_version("Gtk", "4.0")
|
||||||
gi.require_version("Adw", "1")
|
gi.require_version("Adw", "1")
|
||||||
from gi.repository import Adw, Gtk
|
from gi.repository import Adw, GObject, Gtk
|
||||||
|
|
||||||
|
|
||||||
class UserPage(Adw.Bin):
|
class UserPage(Adw.Bin):
|
||||||
|
__gsignals__ = {
|
||||||
|
"validity-changed": (GObject.SignalFlags.RUN_FIRST, None, (bool,)),
|
||||||
|
}
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
self._is_valid = False
|
||||||
|
|
||||||
clamp = Adw.Clamp()
|
clamp = Adw.Clamp()
|
||||||
clamp.set_maximum_size(500)
|
clamp.set_maximum_size(500)
|
||||||
self.set_child(clamp)
|
self.set_child(clamp)
|
||||||
|
|
||||||
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||||
box.set_spacing(24)
|
box.set_spacing(24)
|
||||||
|
box.set_valign(Gtk.Align.CENTER)
|
||||||
box.set_margin_top(24)
|
box.set_margin_top(24)
|
||||||
box.set_margin_bottom(24)
|
box.set_margin_bottom(24)
|
||||||
clamp.set_child(box)
|
clamp.set_child(box)
|
||||||
@@ -29,18 +38,28 @@ class UserPage(Adw.Bin):
|
|||||||
|
|
||||||
self.fullname_row = Adw.EntryRow()
|
self.fullname_row = Adw.EntryRow()
|
||||||
self.fullname_row.set_title("Full Name")
|
self.fullname_row.set_title("Full Name")
|
||||||
|
self.fullname_row.set_text("Administrator")
|
||||||
|
self.fullname_row.connect("notify::text", self.on_fullname_changed)
|
||||||
|
self.fullname_row.connect("notify::text", self.on_input_changed)
|
||||||
group.add(self.fullname_row)
|
group.add(self.fullname_row)
|
||||||
|
|
||||||
self.username_row = Adw.EntryRow()
|
self.username_row = Adw.EntryRow()
|
||||||
self.username_row.set_title("Username")
|
self.username_row.set_title("Username")
|
||||||
|
self.username_row.set_text("admin")
|
||||||
|
self.username_handler_id = self.username_row.connect(
|
||||||
|
"notify::text", self.on_username_changed
|
||||||
|
)
|
||||||
|
self.username_row.connect("notify::text", self.on_input_changed)
|
||||||
group.add(self.username_row)
|
group.add(self.username_row)
|
||||||
|
|
||||||
self.password_row = Adw.PasswordEntryRow()
|
self.password_row = Adw.PasswordEntryRow()
|
||||||
self.password_row.set_title("Password")
|
self.password_row.set_title("Password")
|
||||||
|
self.password_row.connect("notify::text", self.on_input_changed)
|
||||||
group.add(self.password_row)
|
group.add(self.password_row)
|
||||||
|
|
||||||
self.confirm_row = Adw.PasswordEntryRow()
|
self.confirm_row = Adw.PasswordEntryRow()
|
||||||
self.confirm_row.set_title("Confirm Password")
|
self.confirm_row.set_title("Confirm Password")
|
||||||
|
self.confirm_row.connect("notify::text", self.on_input_changed)
|
||||||
group.add(self.confirm_row)
|
group.add(self.confirm_row)
|
||||||
|
|
||||||
# Hostname
|
# Hostname
|
||||||
@@ -50,16 +69,117 @@ class UserPage(Adw.Bin):
|
|||||||
|
|
||||||
self.hostname_row = Adw.EntryRow()
|
self.hostname_row = Adw.EntryRow()
|
||||||
self.hostname_row.set_title("Hostname")
|
self.hostname_row.set_title("Hostname")
|
||||||
self.hostname_row.set_text("iridium-pc")
|
self.hostname_row.set_text("iridium")
|
||||||
|
self.hostname_row.connect("notify::text", self.on_input_changed)
|
||||||
host_group.add(self.hostname_row)
|
host_group.add(self.hostname_row)
|
||||||
|
|
||||||
# Administrator
|
self.username_manually_set = False
|
||||||
admin_group = Adw.PreferencesGroup()
|
|
||||||
admin_group.set_margin_top(12)
|
|
||||||
box.append(admin_group)
|
|
||||||
|
|
||||||
admin_row = Adw.SwitchRow()
|
# Initial validation
|
||||||
admin_row.set_title("Make this user administrator")
|
self.validate()
|
||||||
admin_row.set_subtitle("Add to sudoers group")
|
|
||||||
admin_row.set_active(True)
|
def on_fullname_changed(self, entry, _pspec):
|
||||||
admin_group.add(admin_row)
|
if self.username_manually_set:
|
||||||
|
return
|
||||||
|
|
||||||
|
username = entry.get_text().lower()
|
||||||
|
if username == "administrator":
|
||||||
|
username = "admin"
|
||||||
|
for sign in (
|
||||||
|
" ",
|
||||||
|
"-",
|
||||||
|
"_",
|
||||||
|
".",
|
||||||
|
",",
|
||||||
|
":",
|
||||||
|
";",
|
||||||
|
"!",
|
||||||
|
"?",
|
||||||
|
"/",
|
||||||
|
"\\",
|
||||||
|
"|",
|
||||||
|
"@",
|
||||||
|
"#",
|
||||||
|
"$",
|
||||||
|
"%",
|
||||||
|
"^",
|
||||||
|
"&",
|
||||||
|
"*",
|
||||||
|
"(",
|
||||||
|
")",
|
||||||
|
"[",
|
||||||
|
"]",
|
||||||
|
"{",
|
||||||
|
"}",
|
||||||
|
"'",
|
||||||
|
'"',
|
||||||
|
"`",
|
||||||
|
"~",
|
||||||
|
"<",
|
||||||
|
">",
|
||||||
|
"=",
|
||||||
|
"+",
|
||||||
|
):
|
||||||
|
username = username.replace(sign, "_")
|
||||||
|
|
||||||
|
self.username_row.handler_block(self.username_handler_id)
|
||||||
|
self.username_row.set_text(username)
|
||||||
|
self.username_row.handler_unblock(self.username_handler_id)
|
||||||
|
|
||||||
|
def on_username_changed(self, entry, _pspec):
|
||||||
|
self.username_manually_set = True
|
||||||
|
|
||||||
|
def on_input_changed(self, *args):
|
||||||
|
self.validate()
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
valid = True
|
||||||
|
|
||||||
|
# Username validation
|
||||||
|
username = self.username_row.get_text()
|
||||||
|
if not username:
|
||||||
|
valid = False
|
||||||
|
self.username_row.add_css_class("error")
|
||||||
|
elif not re.match(r"^[a-z_][a-z0-9_-]*$", username):
|
||||||
|
valid = False
|
||||||
|
self.username_row.add_css_class("error")
|
||||||
|
else:
|
||||||
|
self.username_row.remove_css_class("error")
|
||||||
|
|
||||||
|
# Password validation
|
||||||
|
pw = self.password_row.get_text()
|
||||||
|
confirm = self.confirm_row.get_text()
|
||||||
|
|
||||||
|
if not pw:
|
||||||
|
valid = False
|
||||||
|
# Don't show error for empty password initially, just invalidate
|
||||||
|
# It looks a lot nicer like that
|
||||||
|
|
||||||
|
if pw != confirm:
|
||||||
|
valid = False
|
||||||
|
self.confirm_row.add_css_class("error")
|
||||||
|
else:
|
||||||
|
self.confirm_row.remove_css_class("error")
|
||||||
|
|
||||||
|
# Hostname validation
|
||||||
|
hostname = self.hostname_row.get_text()
|
||||||
|
if not hostname:
|
||||||
|
valid = False
|
||||||
|
self.hostname_row.add_css_class("error")
|
||||||
|
else:
|
||||||
|
self.hostname_row.remove_css_class("error")
|
||||||
|
|
||||||
|
if self._is_valid != valid:
|
||||||
|
self._is_valid = valid
|
||||||
|
self.emit("validity-changed", valid)
|
||||||
|
|
||||||
|
def is_valid(self):
|
||||||
|
return self._is_valid
|
||||||
|
|
||||||
|
def get_user_info(self):
|
||||||
|
return {
|
||||||
|
"fullname": self.fullname_row.get_text(),
|
||||||
|
"username": self.username_row.get_text(),
|
||||||
|
"password": self.password_row.get_text(),
|
||||||
|
"hostname": self.hostname_row.get_text(),
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
|
|
||||||
gi.require_version("Gtk", "4.0")
|
gi.require_version("Gtk", "4.0")
|
||||||
gi.require_version("Adw", "1")
|
gi.require_version("Adw", "1")
|
||||||
from gi.repository import Adw, Gtk
|
from gi.repository import Adw, Gdk, Gtk
|
||||||
|
|
||||||
|
|
||||||
class WelcomePage(Adw.Bin):
|
class WelcomePage(Adw.Bin):
|
||||||
@@ -11,7 +13,25 @@ class WelcomePage(Adw.Bin):
|
|||||||
|
|
||||||
page = Adw.StatusPage()
|
page = Adw.StatusPage()
|
||||||
page.set_title("Welcome to Iridium OS")
|
page.set_title("Welcome to Iridium OS")
|
||||||
page.set_description("The future of computing is here. Let's get you set up.")
|
page.set_description("The installation will begin shortly")
|
||||||
|
|
||||||
|
# Load custom icon
|
||||||
|
icon_path = os.path.join(
|
||||||
|
os.path.dirname(__file__),
|
||||||
|
"..",
|
||||||
|
"..",
|
||||||
|
"..",
|
||||||
|
"data",
|
||||||
|
"icons",
|
||||||
|
"org.iridium.Installer.svg",
|
||||||
|
)
|
||||||
|
if os.path.exists(icon_path):
|
||||||
|
try:
|
||||||
|
paintable = Gdk.Texture.new_from_filename(icon_path)
|
||||||
|
page.set_paintable(paintable)
|
||||||
|
except Exception:
|
||||||
|
page.set_icon_name("system-software-install-symbolic")
|
||||||
|
else:
|
||||||
page.set_icon_name("system-software-install-symbolic")
|
page.set_icon_name("system-software-install-symbolic")
|
||||||
|
|
||||||
# Content Box
|
# Content Box
|
||||||
@@ -25,15 +45,9 @@ class WelcomePage(Adw.Bin):
|
|||||||
|
|
||||||
# Language Dropdown
|
# Language Dropdown
|
||||||
languages = [
|
languages = [
|
||||||
"English (US)",
|
"English",
|
||||||
"Spanish",
|
|
||||||
"French",
|
|
||||||
"German",
|
|
||||||
"Japanese",
|
|
||||||
"Chinese (Simplified)",
|
|
||||||
]
|
]
|
||||||
dropdown = Gtk.DropDown.new_from_strings(languages)
|
dropdown = Gtk.DropDown.new_from_strings(languages)
|
||||||
dropdown.set_margin_bottom(20)
|
|
||||||
box.append(dropdown)
|
box.append(dropdown)
|
||||||
|
|
||||||
page.set_child(box)
|
page.set_child(box)
|
||||||
|
|||||||
@@ -4,82 +4,123 @@ gi.require_version("Gtk", "4.0")
|
|||||||
gi.require_version("Adw", "1")
|
gi.require_version("Adw", "1")
|
||||||
from gi.repository import Adw, Gtk
|
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
|
from .pages.storage import StoragePage
|
||||||
|
from .pages.summary import SummaryPage
|
||||||
from .pages.user import UserPage
|
from .pages.user import UserPage
|
||||||
from .pages.welcome import WelcomePage
|
from .pages.welcome import WelcomePage
|
||||||
|
|
||||||
|
|
||||||
class InstallerWindow(Adw.ApplicationWindow):
|
class InstallerWindow(Adw.ApplicationWindow):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, mock_mode=False, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
self.mock_mode = mock_mode
|
||||||
|
|
||||||
self.set_default_size(900, 650)
|
self.set_default_size(900, 650)
|
||||||
self.set_title("Iridium Installer")
|
self.set_title("Iridium Installer" + (" (MOCK MODE)" if mock_mode else ""))
|
||||||
|
self.set_icon_name("org.iridium.Installer")
|
||||||
|
|
||||||
# Main Layout
|
self.toolbar_view = Adw.ToolbarView()
|
||||||
main_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
self.set_content(self.toolbar_view)
|
||||||
self.set_content(main_box)
|
|
||||||
|
|
||||||
# Header Bar
|
# Header Bar (Top)
|
||||||
header = Adw.HeaderBar()
|
self.header_bar = Adw.HeaderBar()
|
||||||
main_box.append(header)
|
self.toolbar_view.add_top_bar(self.header_bar)
|
||||||
|
|
||||||
# Content Stack
|
# Content Stack
|
||||||
self.stack = Adw.ViewStack()
|
self.stack = Adw.ViewStack()
|
||||||
self.stack.set_vexpand(True)
|
self.stack.set_vexpand(True)
|
||||||
main_box.append(self.stack)
|
self.toolbar_view.set_content(self.stack)
|
||||||
|
|
||||||
# Navigation Bar (Bottom)
|
# Navigation Bar (Bottom)
|
||||||
nav_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
|
self.bottom_bar = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
|
||||||
nav_box.add_css_class("toolbar")
|
self.bottom_bar.add_css_class("toolbar")
|
||||||
nav_box.set_margin_top(12)
|
self.bottom_bar.set_margin_top(12)
|
||||||
nav_box.set_margin_bottom(12)
|
self.bottom_bar.set_margin_bottom(12)
|
||||||
nav_box.set_margin_start(12)
|
self.bottom_bar.set_margin_start(12)
|
||||||
nav_box.set_margin_end(12)
|
self.bottom_bar.set_margin_end(12)
|
||||||
nav_box.set_spacing(12)
|
self.bottom_bar.set_spacing(12)
|
||||||
main_box.append(nav_box)
|
self.toolbar_view.add_bottom_bar(self.bottom_bar)
|
||||||
|
|
||||||
# Back Button
|
# Back Button
|
||||||
self.back_button = Gtk.Button(label="Back")
|
self.back_button = Gtk.Button(label="Back")
|
||||||
self.back_button.connect("clicked", self.on_back_clicked)
|
self.back_button.connect("clicked", self.on_back_clicked)
|
||||||
self.back_button.set_sensitive(False)
|
self.back_button.set_sensitive(False)
|
||||||
nav_box.append(self.back_button)
|
self.bottom_bar.append(self.back_button)
|
||||||
|
|
||||||
# Spacer to push Next button to the right
|
# Spacer to push Next button to the right
|
||||||
spacer = Gtk.Label()
|
spacer = Gtk.Label()
|
||||||
spacer.set_hexpand(True)
|
spacer.set_hexpand(True)
|
||||||
nav_box.append(spacer)
|
self.bottom_bar.append(spacer)
|
||||||
|
|
||||||
# Next Button
|
# Next Button
|
||||||
self.next_button = Gtk.Button(label="Next")
|
self.next_button = Gtk.Button(label="Next")
|
||||||
self.next_button.add_css_class("suggested-action")
|
self.next_button.add_css_class("suggested-action")
|
||||||
self.next_button.connect("clicked", self.on_next_clicked)
|
self.next_button.connect("clicked", self.on_next_clicked)
|
||||||
nav_box.append(self.next_button)
|
self.bottom_bar.append(self.next_button)
|
||||||
|
|
||||||
# Page Management
|
# Page Management
|
||||||
self.page_ids = []
|
self.page_ids = []
|
||||||
self.current_page_index = 0
|
self.current_page_index = 0
|
||||||
|
|
||||||
|
# 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()
|
||||||
|
self.user_page.connect("validity-changed", self.on_user_validity_changed)
|
||||||
|
self.summary_page = SummaryPage()
|
||||||
|
|
||||||
# Add Pages
|
# Add Pages
|
||||||
self.add_page(WelcomePage(), "welcome")
|
self.add_page(self.welcome_page, "welcome")
|
||||||
self.add_page(StoragePage(), "storage")
|
self.add_page(self.storage_page, "storage")
|
||||||
self.add_page(UserPage(), "user")
|
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")
|
||||||
|
self.add_page(self.summary_page, "summary")
|
||||||
|
|
||||||
# Initialize view
|
# Initialize view
|
||||||
if self.page_ids:
|
if self.page_ids:
|
||||||
self.stack.set_visible_child_name(self.page_ids[0])
|
self.stack.set_visible_child_name(self.page_ids[0])
|
||||||
|
self.update_buttons()
|
||||||
|
|
||||||
def add_page(self, widget, name):
|
def add_page(self, widget, name):
|
||||||
self.stack.add_named(widget, name)
|
self.stack.add_named(widget, name)
|
||||||
self.page_ids.append(name)
|
self.page_ids.append(name)
|
||||||
|
|
||||||
|
def on_disk_selected(self, page, device_name):
|
||||||
|
self.update_buttons()
|
||||||
|
|
||||||
|
def on_user_validity_changed(self, page, valid):
|
||||||
|
self.update_buttons()
|
||||||
|
|
||||||
def update_buttons(self):
|
def update_buttons(self):
|
||||||
# Back button state
|
# Back button state
|
||||||
self.back_button.set_sensitive(self.current_page_index > 0)
|
self.back_button.set_sensitive(self.current_page_index > 0)
|
||||||
|
|
||||||
# Next button label/state
|
# Next button label/state
|
||||||
if self.current_page_index == len(self.page_ids) - 1:
|
current_page_name = self.page_ids[self.current_page_index]
|
||||||
self.next_button.set_label("Install")
|
|
||||||
|
# Forced selection logic
|
||||||
|
forced_selection = True
|
||||||
|
if current_page_name == "storage":
|
||||||
|
forced_selection = self.storage_page.get_selected_disk() is not None
|
||||||
|
elif current_page_name == "user":
|
||||||
|
forced_selection = self.user_page.is_valid()
|
||||||
|
|
||||||
|
self.next_button.set_sensitive(forced_selection)
|
||||||
|
|
||||||
|
if current_page_name == "summary":
|
||||||
|
self.next_button.set_label(
|
||||||
|
"Install" + (" (MOCK)" if self.mock_mode else "")
|
||||||
|
)
|
||||||
self.next_button.add_css_class("destructive-action")
|
self.next_button.add_css_class("destructive-action")
|
||||||
self.next_button.remove_css_class("suggested-action")
|
self.next_button.remove_css_class("suggested-action")
|
||||||
else:
|
else:
|
||||||
@@ -88,15 +129,94 @@ class InstallerWindow(Adw.ApplicationWindow):
|
|||||||
self.next_button.add_css_class("suggested-action")
|
self.next_button.add_css_class("suggested-action")
|
||||||
|
|
||||||
def on_back_clicked(self, button):
|
def on_back_clicked(self, button):
|
||||||
if self.current_page_index > 0:
|
current_page = self.page_ids[self.current_page_index]
|
||||||
self.current_page_index -= 1
|
|
||||||
|
# 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 (which is immediately before modules)
|
||||||
|
next_prev_index = self.page_ids.index("install_mode")
|
||||||
|
|
||||||
|
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.stack.set_visible_child_name(self.page_ids[self.current_page_index])
|
||||||
self.update_buttons()
|
self.update_buttons()
|
||||||
|
|
||||||
def on_next_clicked(self, button):
|
def on_next_clicked(self, button):
|
||||||
if self.current_page_index < len(self.page_ids) - 1:
|
# Logic before transition
|
||||||
self.current_page_index += 1
|
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()
|
||||||
|
|
||||||
|
partitions_config = {}
|
||||||
|
if mode == "manual":
|
||||||
|
partitions_config = self.partitioning_page.get_config()
|
||||||
|
elif mode == "automatic":
|
||||||
|
partitions = calculate_auto_partitions(disk)
|
||||||
|
partitions_config = {"partitions": partitions}
|
||||||
|
|
||||||
|
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(f"Partition Config: {partitions_config}")
|
||||||
|
print("Simulation complete.")
|
||||||
|
else:
|
||||||
|
print("NOT IMPLEMENTED")
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
if next_index < len(self.page_ids):
|
||||||
|
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])
|
||||||
self.update_buttons()
|
self.update_buttons()
|
||||||
else:
|
|
||||||
print("Install process triggered!")
|
|
||||||
|
|||||||
31
run.sh
31
run.sh
@@ -1,5 +1,32 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Install icons to ~/.local/share/icons if not already installed
|
||||||
|
ICON_DIR="$HOME/.local/share/icons/hicolor/128x128/apps"
|
||||||
|
SYMBOLIC_DIR="$HOME/.local/share/icons/hicolor/symbolic/apps"
|
||||||
|
|
||||||
|
mkdir -p "$ICON_DIR"
|
||||||
|
mkdir -p "$SYMBOLIC_DIR"
|
||||||
|
|
||||||
|
# Get script directory
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
# Copy main icon if not exists or if source is newer
|
||||||
|
if [ ! -f "$ICON_DIR/org.iridium.Installer.svg" ] || [ "${SCRIPT_DIR}/data/icons/org.iridium.Installer.svg" -nt "$ICON_DIR/org.iridium.Installer.svg" ]; then
|
||||||
|
cp "${SCRIPT_DIR}/data/icons/org.iridium.Installer.svg" "$ICON_DIR/"
|
||||||
|
echo "Installed 128x128 icon"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy symbolic icon if not exists or if source is newer
|
||||||
|
if [ ! -f "$SYMBOLIC_DIR/org.iridium.Installer-symbolic.svg" ] || [ "${SCRIPT_DIR}/data/icons/org.iridium.Installer-symbolic.svg" -nt "$SYMBOLIC_DIR/org.iridium.Installer-symbolic.svg" ]; then
|
||||||
|
cp "${SCRIPT_DIR}/data/icons/org.iridium.Installer-symbolic.svg" "$SYMBOLIC_DIR/org.iridium.Installer-symbolic.svg"
|
||||||
|
echo "Installed symbolic icon"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update icon cache if gtk-update-icon-cache exists
|
||||||
|
if command -v gtk-update-icon-cache &> /dev/null; then
|
||||||
|
gtk-update-icon-cache -f -t "$HOME/.local/share/icons/hicolor" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
export GSETTINGS_SCHEMA_DIR=.
|
export GSETTINGS_SCHEMA_DIR=.
|
||||||
|
|
||||||
echo "Starting Iridium Installer..."
|
python3 -m iridium_installer.main "$@"
|
||||||
python3 -m iridium_installer.main
|
|
||||||
|
|||||||
Reference in New Issue
Block a user