93 lines
2.7 KiB
Python
93 lines
2.7 KiB
Python
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
|
|
|
|
# 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(
|
|
"Proprietary NVIDIA Drivers",
|
|
"Install proprietary drivers for NVIDIA graphics cards for better performance.",
|
|
"nvidia_drivers",
|
|
)
|
|
|
|
# Chromebook Audio
|
|
self.add_module_row(
|
|
"Chromebook Audio Fixes",
|
|
"Install additional audio drivers for Chromebook devices.",
|
|
"chromebook_audio",
|
|
)
|
|
|
|
# Android Apps
|
|
self.add_module_row(
|
|
"Android Apps Support",
|
|
"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):
|
|
return {
|
|
"nvidia_drivers": self.nvidia_drivers,
|
|
"chromebook_audio": self.chromebook_audio,
|
|
"android_apps": self.android_apps,
|
|
}
|