diff --git a/vanilla_first_setup/gtk/done.ui b/vanilla_first_setup/gtk/done.ui
index 08bd18f..f511936 100644
--- a/vanilla_first_setup/gtk/done.ui
+++ b/vanilla_first_setup/gtk/done.ui
@@ -46,8 +46,18 @@
center
center
+
+
+
+
@@ -57,8 +67,8 @@
center
false
diff --git a/vanilla_first_setup/utils/processor.py b/vanilla_first_setup/utils/processor.py
index 78a804a..7c886f1 100644
--- a/vanilla_first_setup/utils/processor.py
+++ b/vanilla_first_setup/utils/processor.py
@@ -37,14 +37,14 @@ class Processor:
logger.info("processing the following commands: \n%s" %
'\n'.join(commands))
-
+
# connection check
cn = subprocess.run(["wget", "-q", "--spider", "cloudflare.com"],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
if cn.returncode != 0:
logger.critical("No internet connection")
- return False, "No internet connection."
+ return False, "No internet connection.", True
# nextBoot commands are collected in ~/.local/org.vanillaos.FirstSetup.nextBoot
# and executed at the next boot by a desktop entry
@@ -95,7 +95,7 @@ class Processor:
if command.startswith("!noSudo"):
command = command.replace("!noSudo", "sudo -u $USER")
-
+
# outRun band is used to run a command outside of the main
# shell script.
if command.startswith("!outRun"):
@@ -112,7 +112,7 @@ class Processor:
# fake the process if VANILLA_FAKE is set
if "VANILLA_FAKE" in os.environ:
return True, ""
-
+
cmd = ["pkexec", "sh", f.name]
if abroot_bin := shutil.which("abroot"):
cmd = ["pkexec", abroot_bin, "exec", "--assume-yes", "sh", f.name]
@@ -132,7 +132,7 @@ class Processor:
logger.warning("failed to write to the log file: %s" % e)
logger.warning("the output of the commands is: %s" %
out)
-
+
if proc.returncode != 0:
logger.critical(
"Error while processing commands, see log for details.")
diff --git a/vanilla_first_setup/views/done.py b/vanilla_first_setup/views/done.py
index 8c78f94..5a30d2d 100644
--- a/vanilla_first_setup/views/done.py
+++ b/vanilla_first_setup/views/done.py
@@ -15,6 +15,7 @@
# along with this program. If not, see .
import subprocess
+from sys import intern
from gi.repository import Gtk, Adw
@@ -24,6 +25,7 @@ class VanillaDone(Adw.Bin):
status_page = Gtk.Template.Child()
btn_reboot = Gtk.Template.Child()
+ btn_retry = Gtk.Template.Child()
btn_close = Gtk.Template.Child()
log_box = Gtk.Template.Child()
log_output = Gtk.Template.Child()
@@ -33,7 +35,7 @@ class VanillaDone(Adw.Bin):
self.__window = window
self.__fail_title = fail_title
self.__fail_description = fail_description
-
+
if not title and not description:
self.status_page.set_description(
_("Restart your device to enjoy your {} experience.").format(
@@ -49,16 +51,29 @@ class VanillaDone(Adw.Bin):
else:
self.btn_reboot.set_visible(False)
self.btn_close.set_visible(True)
+
self.btn_close.connect("clicked", self.__on_close_clicked)
-
+ self.btn_retry.connect("clicked", self.__on_retry_clicked)
+
def set_result(self, result):
- res, msg = result
+ res, msg, *internet_fail = result
+
+ # Default to false if internet_fail wasn't passed with result
+ internet_fail = internet_fail[0] if len(internet_fail) > 0 else False
if res:
return
-
- self.status_page.set_icon_name("dialog-error-symbolic")
- if not self.__fail_title and not self.__fail_description:
+
+ if internet_fail:
+ self.status_page.set_icon_name("network-offline-symbolic")
+ else:
+ self.status_page.set_icon_name("dialog-error-symbolic")
+
+ if internet_fail:
+ self.status_page.set_title(_("No internet connection"))
+ self.status_page.set_description(_("Please ensure your system is connected to the internet and try again."))
+ self.log_box.set_visible(False)
+ elif not self.__fail_title and not self.__fail_description:
self.status_page.set_title(_("Something went wrong"))
self.status_page.set_description(_("Please contact the distribution developers."))
self.log_box.set_visible(True)
@@ -67,11 +82,20 @@ class VanillaDone(Adw.Bin):
self.status_page.set_title(self.__fail_title)
self.status_page.set_description(self.__fail_description)
self.log_box.set_visible(False)
+
self.btn_reboot.set_visible(False)
- self.btn_close.set_visible(True)
+ if internet_fail:
+ self.btn_retry.set_visible(True)
+ self.btn_close.set_visible(False)
+ else:
+ self.btn_retry.set_visible(False)
+ self.btn_close.set_visible(True)
def __on_reboot_clicked(self, button):
subprocess.run(['gnome-session-quit', '--reboot'])
def __on_close_clicked(self, button):
self.__window.close()
+
+ def __on_retry_clicked(self, button):
+ self.__window.back()
diff --git a/vanilla_first_setup/window.py b/vanilla_first_setup/window.py
index 9e181dd..42f276e 100644
--- a/vanilla_first_setup/window.py
+++ b/vanilla_first_setup/window.py
@@ -59,7 +59,7 @@ class VanillaWindow(Adw.ApplicationWindow):
self.__init_mode = 1
# system views
- self.__view_done = VanillaDone(self, reboot=False,
+ self.__view_done = VanillaDone(self, reboot=False,
title=_("Done!"), description=_("Your device is ready to use."),
fail_title=_("Error!"), fail_description=_("Something went wrong."))
@@ -91,7 +91,7 @@ class VanillaWindow(Adw.ApplicationWindow):
self.carousel.append(self.__view_post_script)
self.carousel.append(self.__view_done)
-
+
@property
def builder(self):
return self.__builder
@@ -125,11 +125,11 @@ class VanillaWindow(Adw.ApplicationWindow):
if self.__init_mode == 0:
self.__view_done.set_result(result)
self.next()
-
+
pages_check = [self.__view_done]
if self.__init_mode == 0:
pages_check.append(self.__view_progress)
-
+
cur_index = self.carousel.get_position()
page = self.carousel.get_nth_page(cur_index)
if page not in pages_check:
@@ -171,7 +171,7 @@ class VanillaWindow(Adw.ApplicationWindow):
cur_index = self.carousel.get_position()
page = self.carousel.get_nth_page(cur_index - 1)
self.carousel.scroll_to(page, True)
-
+
def toast(self, message, timeout=3):
toast = Adw.Toast.new(message)
toast.props.timeout = timeout