Update window.py
This commit is contained in:
@@ -233,18 +233,30 @@ class InstallerWindow(Adw.ApplicationWindow):
|
||||
|
||||
finish_page = Adw.StatusPage()
|
||||
finish_page.set_title(message)
|
||||
|
||||
btn = Gtk.Button()
|
||||
btn.set_halign(Gtk.Align.CENTER)
|
||||
|
||||
if success:
|
||||
finish_page.set_icon_name("emblem-ok-symbolic")
|
||||
finish_page.set_description("You can now restart your computer.")
|
||||
btn_label = "Restart"
|
||||
btn.set_label("Restart System")
|
||||
btn.add_css_class("suggested-action")
|
||||
btn.add_css_class("pill")
|
||||
|
||||
def on_restart(b):
|
||||
import subprocess
|
||||
try:
|
||||
subprocess.run(["systemctl", "reboot"])
|
||||
except Exception as e:
|
||||
print(f"Failed to reboot: {e}")
|
||||
self.close()
|
||||
|
||||
btn.connect("clicked", on_restart)
|
||||
else:
|
||||
finish_page.set_icon_name("dialog-error-symbolic")
|
||||
finish_page.set_description("An error occurred during installation.")
|
||||
btn_label = "Close"
|
||||
|
||||
btn = Gtk.Button(label=btn_label)
|
||||
btn.set_halign(Gtk.Align.CENTER)
|
||||
btn.add_css_class("suggested-action")
|
||||
btn.set_label("Close Installer")
|
||||
btn.connect("clicked", lambda b: self.close())
|
||||
|
||||
finish_page.set_child(btn)
|
||||
|
||||
Reference in New Issue
Block a user