Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: view logs after post script run #361

Merged
merged 1 commit into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions vanilla_first_setup/gtk/done.ui
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,24 @@
</object>
</child>
<child>
<object class="GtkButton" id="btn_retry">
<property name="label">Retry</property>
<object class="GtkButton" id="btn_close">
<property name="label">Get Started</property>
<property name="halign">center</property>
<property name="visible">false</property>
<style>
<class name="pill"/>
<class name="suggested-action"/>
</style>
</object>
</child>
<child>
<object class="GtkButton" id="btn_close">
<property name="label">Get Started</property>
<object class="GtkButton" id="btn_logs">
<property name="label">View Logs</property>
<property name="halign">center</property>
<property name="visible">false</property>
<property name="visible">true</property>
<property name="margin-top">20</property>
<style>
<class name="pill"/>
<class name="suggested-action"/>
</style>
</object>
</child>
Expand Down
61 changes: 41 additions & 20 deletions vanilla_first_setup/gtk/post-script.ui
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,52 @@
<requires lib="libadwaita" version="1.0" />
<template class="VanillaPostScript" parent="AdwBin">
<child>
<object class="AdwStatusPage">
<property name="valign">fill</property>
<property name="halign">fill</property>
<property name="icon-name">org.vanillaos.FirstSetup-flower</property>
<property name="title" translatable="yes">Finalizing</property>
<property name="description" translatable="yes">Your device will be ready soon</property>
<object class="GtkOverlay">
<property name="valign">center</property>
<child type="overlay">
<object class="GtkButton" id="btn_next">
<property name="visible">false</property>
<property name="sensitive">True</property>
<property name="margin-end">12</property>
<property name="margin-start">12</property>
<property name="icon-name">go-next-symbolic</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="tooltip-text" translatable="yes">Next</property>
<style>
<class name="circular" />
<class name="suggested-action" />
</style>
</object>
</child>
<child>
<object class="GtkBox" id="console_box">
<property name="margin-start">40</property>
<property name="margin-end">40</property>
<property name="margin-top">1</property>
<property name="margin-bottom">18</property>
<property name="height-request">250</property>
<property name="orientation">vertical</property>
<object class="AdwStatusPage">
<property name="valign">fill</property>
<property name="halign">fill</property>
<property name="icon-name">org.vanillaos.FirstSetup-flower</property>
<property name="title" translatable="yes">Finalizing</property>
<property name="description" translatable="yes">Your device will be ready soon</property>
<child>
<object class="GtkBox" id="console_output">
<property name="margin-top">12</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<object class="GtkBox" id="console_box">
<property name="margin-start">50</property>
<property name="margin-end">50</property>
<property name="margin-top">1</property>
<property name="margin-bottom">18</property>
<property name="height-request">250</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="console_output">
<property name="margin-top">12</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="orientation">vertical</property>
</object>
</child>
<style>
<class name="card"/>
</style>
</object>
</child>
<style>
<class name="card"/>
</style>
</object>
</child>
</object>
Expand Down
10 changes: 7 additions & 3 deletions vanilla_first_setup/views/done.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class VanillaDone(Adw.Bin):

status_page = Gtk.Template.Child()
btn_reboot = Gtk.Template.Child()
btn_retry = Gtk.Template.Child()
btn_logs = Gtk.Template.Child()
btn_close = Gtk.Template.Child()
log_box = Gtk.Template.Child()
log_output = Gtk.Template.Child()
Expand Down Expand Up @@ -61,9 +61,13 @@ def __init__(

self.btn_reboot.set_visible(False)
self.btn_close.set_visible(True)

# hide when progress is previous step
if self.__init_mode != 1:
self.btn_logs.set_visible(False)

self.btn_close.connect("clicked", self.__on_close_clicked)
self.btn_retry.connect("clicked", self.__on_retry_clicked)
self.btn_logs.connect("clicked", self.__on_logs_clicked)
self.btn_reboot.connect("clicked", self.__on_reboot_clicked)

def set_reboot(self):
Expand Down Expand Up @@ -113,5 +117,5 @@ def __on_close_clicked(self, *args):

self.__window.close()

def __on_retry_clicked(self, *args):
def __on_logs_clicked(self, *args):
self.__window.back()
9 changes: 8 additions & 1 deletion vanilla_first_setup/views/post_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class VanillaPostScript(Adw.Bin):
__gtype_name__ = "VanillaPostScript"

console_output = Gtk.Template.Child()
btn_next = Gtk.Template.Child()

def __init__(self, window, post_script: str, **kwargs):
super().__init__(**kwargs)
Expand All @@ -35,6 +36,8 @@ def __init__(self, window, post_script: str, **kwargs):
self.__font.set_stretch(Pango.Stretch.NORMAL)
self.__style_manager = self.__window.style_manager

self.btn_next.connect("clicked", self.__on_next_clicked)

self.__build_ui()

self.__style_manager.connect("notify::dark", self.__build_ui)
Expand Down Expand Up @@ -104,4 +107,8 @@ def __build_ui(self, *args):

def on_vte_child_exited(self, terminal, status, *args):
status = not bool(status)
self.__window.next(result=status)
self.btn_next.set_visible(True)
self.__window.set_installation_result(status, self.__terminal)

def __on_next_clicked(self, *args):
self.__window.next()
Loading