Mockup
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
__pycache__/
|
||||
0
iridium_installer/__init__.py
Normal file
0
iridium_installer/__init__.py
Normal file
33
iridium_installer/main.py
Normal file
33
iridium_installer/main.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import sys
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "4.0")
|
||||
gi.require_version("Adw", "1")
|
||||
|
||||
from gi.repository import Adw, Gio, Gtk
|
||||
|
||||
from .ui.window import InstallerWindow
|
||||
|
||||
|
||||
class IridiumInstallerApp(Adw.Application):
|
||||
def __init__(self):
|
||||
super().__init__(
|
||||
application_id="org.iridium.Installer",
|
||||
flags=Gio.ApplicationFlags.FLAGS_NONE,
|
||||
)
|
||||
|
||||
def do_activate(self):
|
||||
win = self.props.active_window
|
||||
if not win:
|
||||
win = InstallerWindow(application=self)
|
||||
win.present()
|
||||
|
||||
|
||||
def main():
|
||||
app = IridiumInstallerApp()
|
||||
return app.run(sys.argv)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
0
iridium_installer/ui/__init__.py
Normal file
0
iridium_installer/ui/__init__.py
Normal file
0
iridium_installer/ui/pages/__init__.py
Normal file
0
iridium_installer/ui/pages/__init__.py
Normal file
83
iridium_installer/ui/pages/storage.py
Normal file
83
iridium_installer/ui/pages/storage.py
Normal file
@@ -0,0 +1,83 @@
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "4.0")
|
||||
gi.require_version("Adw", "1")
|
||||
from gi.repository import Adw, Gtk
|
||||
|
||||
|
||||
class StoragePage(Adw.Bin):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
# 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_margin_top(24)
|
||||
box.set_margin_bottom(24)
|
||||
clamp.set_child(box)
|
||||
|
||||
# Title
|
||||
title = Gtk.Label(label="Installation Destination")
|
||||
title.add_css_class("title-1")
|
||||
box.append(title)
|
||||
|
||||
descr = Gtk.Label(
|
||||
label="Select the storage device where you want to install Iridium OS."
|
||||
)
|
||||
descr.set_wrap(True)
|
||||
box.append(descr)
|
||||
|
||||
# Disk List
|
||||
group = Adw.PreferencesGroup()
|
||||
group.set_title("Available Disks")
|
||||
box.append(group)
|
||||
|
||||
# Mock Disks
|
||||
disks = [
|
||||
(
|
||||
"NVMe Samsung 970 EVO (500GB)",
|
||||
"nvme0n1",
|
||||
"icon-drive-harddisk-solidstate-symbolic",
|
||||
),
|
||||
("SATA Seagate Barracuda (1TB)", "sda", "icon-drive-harddisk-symbolic"),
|
||||
]
|
||||
|
||||
self.disk_rows = []
|
||||
for name, dev, icon in disks:
|
||||
row = Adw.ActionRow()
|
||||
row.set_title(name)
|
||||
row.set_subtitle(f"/dev/{dev}")
|
||||
row.set_icon_name(icon)
|
||||
|
||||
# Radio button for selection
|
||||
if not self.disk_rows:
|
||||
radio = Gtk.CheckButton()
|
||||
self.first_radio = radio
|
||||
else:
|
||||
radio = Gtk.CheckButton()
|
||||
radio.set_group(self.first_radio)
|
||||
|
||||
radio.set_valign(Gtk.Align.CENTER)
|
||||
row.add_suffix(radio)
|
||||
row.set_activatable_widget(radio)
|
||||
|
||||
group.add(row)
|
||||
self.disk_rows.append(row)
|
||||
|
||||
# Partitioning Options
|
||||
part_group = Adw.PreferencesGroup()
|
||||
part_group.set_title("Configuration")
|
||||
box.append(part_group)
|
||||
|
||||
auto_row = Adw.ActionRow()
|
||||
auto_row.set_title("Automatic Partitioning")
|
||||
auto_row.set_subtitle("Erase disk and install Iridium")
|
||||
part_switch = Gtk.Switch()
|
||||
part_switch.set_active(True)
|
||||
part_switch.set_valign(Gtk.Align.CENTER)
|
||||
auto_row.add_suffix(part_switch)
|
||||
part_group.add(auto_row)
|
||||
65
iridium_installer/ui/pages/user.py
Normal file
65
iridium_installer/ui/pages/user.py
Normal file
@@ -0,0 +1,65 @@
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "4.0")
|
||||
gi.require_version("Adw", "1")
|
||||
from gi.repository import Adw, Gtk
|
||||
|
||||
|
||||
class UserPage(Adw.Bin):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
clamp = Adw.Clamp()
|
||||
clamp.set_maximum_size(500)
|
||||
self.set_child(clamp)
|
||||
|
||||
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||
box.set_spacing(24)
|
||||
box.set_margin_top(24)
|
||||
box.set_margin_bottom(24)
|
||||
clamp.set_child(box)
|
||||
|
||||
title = Gtk.Label(label="Create User Account")
|
||||
title.add_css_class("title-1")
|
||||
box.append(title)
|
||||
|
||||
# Form Group
|
||||
group = Adw.PreferencesGroup()
|
||||
box.append(group)
|
||||
|
||||
self.fullname_row = Adw.EntryRow()
|
||||
self.fullname_row.set_title("Full Name")
|
||||
group.add(self.fullname_row)
|
||||
|
||||
self.username_row = Adw.EntryRow()
|
||||
self.username_row.set_title("Username")
|
||||
group.add(self.username_row)
|
||||
|
||||
self.password_row = Adw.PasswordEntryRow()
|
||||
self.password_row.set_title("Password")
|
||||
group.add(self.password_row)
|
||||
|
||||
self.confirm_row = Adw.PasswordEntryRow()
|
||||
self.confirm_row.set_title("Confirm Password")
|
||||
group.add(self.confirm_row)
|
||||
|
||||
# Hostname
|
||||
host_group = Adw.PreferencesGroup()
|
||||
host_group.set_margin_top(12)
|
||||
box.append(host_group)
|
||||
|
||||
self.hostname_row = Adw.EntryRow()
|
||||
self.hostname_row.set_title("Hostname")
|
||||
self.hostname_row.set_text("iridium-pc")
|
||||
host_group.add(self.hostname_row)
|
||||
|
||||
# Administrator
|
||||
admin_group = Adw.PreferencesGroup()
|
||||
admin_group.set_margin_top(12)
|
||||
box.append(admin_group)
|
||||
|
||||
admin_row = Adw.SwitchRow()
|
||||
admin_row.set_title("Make this user administrator")
|
||||
admin_row.set_subtitle("Add to sudoers group")
|
||||
admin_row.set_active(True)
|
||||
admin_group.add(admin_row)
|
||||
41
iridium_installer/ui/pages/welcome.py
Normal file
41
iridium_installer/ui/pages/welcome.py
Normal file
@@ -0,0 +1,41 @@
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "4.0")
|
||||
gi.require_version("Adw", "1")
|
||||
from gi.repository import Adw, Gtk
|
||||
|
||||
|
||||
class WelcomePage(Adw.Bin):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
page = Adw.StatusPage()
|
||||
page.set_title("Welcome to Iridium OS")
|
||||
page.set_description("The future of computing is here. Let's get you set up.")
|
||||
page.set_icon_name("system-software-install-symbolic")
|
||||
|
||||
# Content Box
|
||||
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||
box.set_spacing(12)
|
||||
box.set_halign(Gtk.Align.CENTER)
|
||||
|
||||
lbl = Gtk.Label(label="Select your language:")
|
||||
lbl.add_css_class("heading")
|
||||
box.append(lbl)
|
||||
|
||||
# Language Dropdown
|
||||
languages = [
|
||||
"English (US)",
|
||||
"Spanish",
|
||||
"French",
|
||||
"German",
|
||||
"Japanese",
|
||||
"Chinese (Simplified)",
|
||||
]
|
||||
dropdown = Gtk.DropDown.new_from_strings(languages)
|
||||
dropdown.set_margin_bottom(20)
|
||||
box.append(dropdown)
|
||||
|
||||
page.set_child(box)
|
||||
|
||||
self.set_child(page)
|
||||
102
iridium_installer/ui/window.py
Normal file
102
iridium_installer/ui/window.py
Normal file
@@ -0,0 +1,102 @@
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "4.0")
|
||||
gi.require_version("Adw", "1")
|
||||
from gi.repository import Adw, Gtk
|
||||
|
||||
from .pages.storage import StoragePage
|
||||
from .pages.user import UserPage
|
||||
from .pages.welcome import WelcomePage
|
||||
|
||||
|
||||
class InstallerWindow(Adw.ApplicationWindow):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
self.set_default_size(900, 650)
|
||||
self.set_title("Iridium Installer")
|
||||
|
||||
# Main Layout
|
||||
main_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||
self.set_content(main_box)
|
||||
|
||||
# Header Bar
|
||||
header = Adw.HeaderBar()
|
||||
main_box.append(header)
|
||||
|
||||
# Content Stack
|
||||
self.stack = Adw.ViewStack()
|
||||
self.stack.set_vexpand(True)
|
||||
main_box.append(self.stack)
|
||||
|
||||
# Navigation Bar (Bottom)
|
||||
nav_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
|
||||
nav_box.add_css_class("toolbar")
|
||||
nav_box.set_margin_top(12)
|
||||
nav_box.set_margin_bottom(12)
|
||||
nav_box.set_margin_start(12)
|
||||
nav_box.set_margin_end(12)
|
||||
nav_box.set_spacing(12)
|
||||
main_box.append(nav_box)
|
||||
|
||||
# Back Button
|
||||
self.back_button = Gtk.Button(label="Back")
|
||||
self.back_button.connect("clicked", self.on_back_clicked)
|
||||
self.back_button.set_sensitive(False)
|
||||
nav_box.append(self.back_button)
|
||||
|
||||
# Spacer to push Next button to the right
|
||||
spacer = Gtk.Label()
|
||||
spacer.set_hexpand(True)
|
||||
nav_box.append(spacer)
|
||||
|
||||
# Next Button
|
||||
self.next_button = Gtk.Button(label="Next")
|
||||
self.next_button.add_css_class("suggested-action")
|
||||
self.next_button.connect("clicked", self.on_next_clicked)
|
||||
nav_box.append(self.next_button)
|
||||
|
||||
# Page Management
|
||||
self.page_ids = []
|
||||
self.current_page_index = 0
|
||||
|
||||
# Add Pages
|
||||
self.add_page(WelcomePage(), "welcome")
|
||||
self.add_page(StoragePage(), "storage")
|
||||
self.add_page(UserPage(), "user")
|
||||
|
||||
# Initialize view
|
||||
if self.page_ids:
|
||||
self.stack.set_visible_child_name(self.page_ids[0])
|
||||
|
||||
def add_page(self, widget, name):
|
||||
self.stack.add_named(widget, name)
|
||||
self.page_ids.append(name)
|
||||
|
||||
def update_buttons(self):
|
||||
# Back button state
|
||||
self.back_button.set_sensitive(self.current_page_index > 0)
|
||||
|
||||
# Next button label/state
|
||||
if self.current_page_index == len(self.page_ids) - 1:
|
||||
self.next_button.set_label("Install")
|
||||
self.next_button.add_css_class("destructive-action")
|
||||
self.next_button.remove_css_class("suggested-action")
|
||||
else:
|
||||
self.next_button.set_label("Next")
|
||||
self.next_button.remove_css_class("destructive-action")
|
||||
self.next_button.add_css_class("suggested-action")
|
||||
|
||||
def on_back_clicked(self, button):
|
||||
if self.current_page_index > 0:
|
||||
self.current_page_index -= 1
|
||||
self.stack.set_visible_child_name(self.page_ids[self.current_page_index])
|
||||
self.update_buttons()
|
||||
|
||||
def on_next_clicked(self, button):
|
||||
if self.current_page_index < len(self.page_ids) - 1:
|
||||
self.current_page_index += 1
|
||||
self.stack.set_visible_child_name(self.page_ids[self.current_page_index])
|
||||
self.update_buttons()
|
||||
else:
|
||||
print("Install process triggered!")
|
||||
Reference in New Issue
Block a user