mirror of
https://github.com/Snigdha-OS/snigdhaos-welcome.git
synced 2025-09-20 14:14:55 +02:00
⚡️ perf(advance): formatted strings for cleaner log output
This commit is contained in:
@@ -227,37 +227,43 @@ class Main(Gtk.Window):
|
||||
|
||||
|
||||
def on_adv_install_clicked(self, widget):
|
||||
"""
|
||||
Handles the "Advanced Install" button click. Configures online installation settings
|
||||
and launches the appropriate installer based on system state.
|
||||
"""
|
||||
# Check if the Pacman lockfile exists
|
||||
if not os.path.exists(self.pacman_lockfile):
|
||||
# Update the button's style and label to reflect the enabled state
|
||||
widget.set_name("button_adv_install_enabled")
|
||||
widget.get_child().set_markup(
|
||||
"<span size='large'>Online Installation</span>"
|
||||
)
|
||||
selected_bg_color = widget.get_style_context().lookup_color(
|
||||
"theme_selected_bg_color"
|
||||
)
|
||||
if selected_bg_color[0] is True:
|
||||
widget.get_child().set_markup("<span size='large'>Online Installation</span>")
|
||||
|
||||
# Retrieve the selected background color from the theme
|
||||
selected_bg_color = widget.get_style_context().lookup_color("theme_selected_bg_color")
|
||||
if selected_bg_color[0]: # If the color is successfully retrieved
|
||||
# Convert the Gdk.Color to HEX format for custom CSS
|
||||
theme_bg_hex_color = self.convert_to_hex(selected_bg_color[1])
|
||||
custom_css = css.replace("@theme_base_color_button", theme_bg_hex_color)
|
||||
self.style_provider.load_from_data(custom_css, len(custom_css))
|
||||
|
||||
# Reset the style for the "Easy Install" button
|
||||
self.button_easy_install.set_name("button_easy_install")
|
||||
|
||||
# Configuration files for the advanced installation
|
||||
settings_adv_file = "/etc/calamares/settings-advanced.conf"
|
||||
system_update_file = "/etc/calamares/modules/packages-system-update.conf"
|
||||
app_cmd = [
|
||||
"sudo",
|
||||
"cp",
|
||||
settings_adv_file,
|
||||
"/etc/calamares/settings.conf",
|
||||
]
|
||||
|
||||
# Copy the advanced settings configuration file
|
||||
app_cmd = ["sudo", "cp", settings_adv_file, "/etc/calamares/settings.conf"]
|
||||
threading.Thread(target=self.run_app, args=(app_cmd,), daemon=True).start()
|
||||
app_cmd = [
|
||||
"sudo",
|
||||
"cp",
|
||||
system_update_file,
|
||||
"/etc/calamares/modules/packages.conf",
|
||||
]
|
||||
|
||||
# Copy the system update configuration for online installation
|
||||
app_cmd = ["sudo", "cp", system_update_file, "/etc/calamares/modules/packages.conf"]
|
||||
threading.Thread(target=self.run_app, args=(app_cmd,), daemon=True).start()
|
||||
|
||||
# Check for EFI bootloader support
|
||||
efi_file_check = self.file_check("/sys/firmware/efi/fw_platform_size")
|
||||
if efi_file_check is True:
|
||||
if efi_file_check:
|
||||
# If EFI is supported, display the bootloader selection dialog
|
||||
md = MessageDialogBootloader(
|
||||
title="Choose Bootloader",
|
||||
install_method="Online Installation",
|
||||
@@ -267,23 +273,24 @@ class Main(Gtk.Window):
|
||||
)
|
||||
md.show_all()
|
||||
else:
|
||||
# Launch the Calamares installer directly if not an EFI system
|
||||
subprocess.Popen([self.calamares_polkit, "-d"], shell=False)
|
||||
else:
|
||||
print(
|
||||
"[ERROR]: Pacman lockfile found %s, is another pacman process running ?"
|
||||
% self.pacman_lockfile
|
||||
)
|
||||
# Handle the case where a Pacman lockfile exists
|
||||
print(f"[ERROR]: Pacman lockfile found {self.pacman_lockfile}, is another pacman process running?")
|
||||
|
||||
# Display a warning dialog about the lockfile
|
||||
md = Gtk.MessageDialog(
|
||||
parent=self,
|
||||
flags=0,
|
||||
message_type=Gtk.MessageType.WARNING,
|
||||
buttons=Gtk.ButtonsType.OK,
|
||||
text="Pacman lockfile found %s, is another pacman process running ?"
|
||||
% self.pacman_lockfile,
|
||||
text=f"Pacman lockfile found {self.pacman_lockfile}, is another pacman process running?",
|
||||
title="Warning",
|
||||
)
|
||||
md.run()
|
||||
md.destroy()
|
||||
|
||||
def on_gp_clicked(self, widget):
|
||||
app_cmd = ["/usr/bin/gparted"]
|
||||
pacman_cmd = [
|
||||
|
Reference in New Issue
Block a user