From 53743064f286b4424fcc58715501159c903573dd Mon Sep 17 00:00:00 2001 From: Mateus Melchiades Date: Mon, 6 Mar 2023 11:13:15 -0300 Subject: [PATCH] Run commands on new user --- vanilla_first_setup/defaults/user.py | 6 +++++- vanilla_first_setup/views/progress.py | 8 +++++--- vanilla_first_setup/window.py | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/vanilla_first_setup/defaults/user.py b/vanilla_first_setup/defaults/user.py index 129bb82..59306c5 100644 --- a/vanilla_first_setup/defaults/user.py +++ b/vanilla_first_setup/defaults/user.py @@ -46,7 +46,7 @@ class VanillaDefaultUser(Adw.Bin): self.__step = step # signals - self.btn_next.connect("clicked", self.__window.next) + self.btn_next.connect("clicked", self.__on_btn_next_clicked) self.fullname_entry.connect('changed', self.__on_fullname_entry_changed) self.username_entry.connect('changed', self.__on_username_entry_changed) self.password_entry.connect('changed', self.__on_password_changed) @@ -56,6 +56,10 @@ class VanillaDefaultUser(Adw.Bin): def step_id(self): return self.__key + def __on_btn_next_clicked(self, widget): + self.__window.set_user(self.username) + self.__window.next + def get_finals(self): return { "vars": { diff --git a/vanilla_first_setup/views/progress.py b/vanilla_first_setup/views/progress.py index 4a74b86..c1eca4d 100644 --- a/vanilla_first_setup/views/progress.py +++ b/vanilla_first_setup/views/progress.py @@ -119,12 +119,14 @@ class VanillaProgress(Gtk.Box): status = not bool(status) if self.__success_fn is not None and status: - self.__success_fn() + self.__success_fn(*self.__success_fn_args) self.__window.set_installation_result(status, self.__terminal) - def start(self, setup_commands, success_fn): + def start(self, setup_commands, success_fn, *fn_args): self.__success_fn = success_fn + self.__success_fn_args = fn_args + self.__terminal.spawn_async( Vte.PtyFlags.DEFAULT, ".", @@ -136,4 +138,4 @@ class VanillaProgress(Gtk.Box): -1, None, None - ) \ No newline at end of file + ) diff --git a/vanilla_first_setup/window.py b/vanilla_first_setup/window.py index a7de457..5540e41 100644 --- a/vanilla_first_setup/window.py +++ b/vanilla_first_setup/window.py @@ -172,7 +172,7 @@ class VanillaWindow(Adw.ApplicationWindow): commands ) - self.__view_progress.start(res, Processor.hide_first_setup) + self.__view_progress.start(res, Processor.hide_first_setup, self.__user) def set_installation_result(self, result, terminal): self.__view_done.set_result(result, terminal)