From ac0934cba5cdf1947aec615babe913b4a15e8363 Mon Sep 17 00:00:00 2001 From: mirkobrombin Date: Thu, 5 Jan 2023 16:29:07 +0100 Subject: [PATCH 1/2] misc: Do not process finals for applications if no pkg manager --- recipe.json | 7 +++++++ vanilla_first_setup/defaults/applications.py | 13 ++++++++++++- vanilla_first_setup/utils/processor.py | 3 ++- vanilla_first_setup/window.py | 12 +++++++++++- 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/recipe.json b/recipe.json index c10cb9f..c486e5b 100644 --- a/recipe.json +++ b/recipe.json @@ -81,6 +81,13 @@ "title": "AppImage", "subtitle": "Install necessary dependencies to run AppImages.", "default": true + }, + { + "id": "-", + "title": "-", + "subtitle": "-", + "disabled": true, + "default": true } ], "final": [ diff --git a/vanilla_first_setup/defaults/applications.py b/vanilla_first_setup/defaults/applications.py index b9b20ba..3572ebd 100644 --- a/vanilla_first_setup/defaults/applications.py +++ b/vanilla_first_setup/defaults/applications.py @@ -38,6 +38,7 @@ class VanillaLayoutApplications(Adw.Bin): # signals self.btn_next.connect("clicked", self.__next_step) + self.__window.connect("page-changed", self.__on_page_changed) @property def step_id(self): @@ -152,8 +153,18 @@ class VanillaLayoutApplications(Adw.Bin): self.__register_widgets.append((item["id"], _switcher, _index)) _index += 1 + + def __on_page_changed(self, widget, page): + if page == self.__key: + if True not in [ + self.__window.builder.get_temp_finals("packages")["vars"]["flatpak"], + self.__window.builder.get_temp_finals("packages")["vars"]["snap"] + ]: + self.bundles_list.set_sensitive(False) + else: + self.bundles_list.set_sensitive(True) - def __next_step(self, widget): + def __next_step(self, *args): self.__window.next() def get_finals(self): diff --git a/vanilla_first_setup/utils/processor.py b/vanilla_first_setup/utils/processor.py index 78a804a..702d35a 100644 --- a/vanilla_first_setup/utils/processor.py +++ b/vanilla_first_setup/utils/processor.py @@ -111,7 +111,8 @@ class Processor: # fake the process if VANILLA_FAKE is set if "VANILLA_FAKE" in os.environ: - return True, "" + logger.info("VANILLA_FAKE is set, skipping the commands") + return True, "" cmd = ["pkexec", "sh", f.name] if abroot_bin := shutil.which("abroot"): diff --git a/vanilla_first_setup/window.py b/vanilla_first_setup/window.py index 9e181dd..672489e 100644 --- a/vanilla_first_setup/window.py +++ b/vanilla_first_setup/window.py @@ -15,7 +15,8 @@ # along with this program. If not, see . import time -from gi.repository import Gtk, Adw +import contextlib +from gi.repository import Gtk, GObject, Adw from vanilla_first_setup.utils.builder import Builder from vanilla_first_setup.utils.parser import Parser @@ -30,6 +31,9 @@ from vanilla_first_setup.views.post_script import VanillaPostScript @Gtk.Template(resource_path='/io/github/vanilla-os/FirstSetup/gtk/window.ui') class VanillaWindow(Adw.ApplicationWindow): __gtype_name__ = 'VanillaWindow' + __gsignals__ = { + "page-changed": (GObject.SignalFlags.RUN_FIRST, None, (str,)), + } carousel = Gtk.Template.Child() carousel_indicator_dots = Gtk.Template.Child() @@ -108,6 +112,7 @@ class VanillaWindow(Adw.ApplicationWindow): self.carousel.append(self.__view_done) def __on_page_changed(self, *args): + def process(): # this parses the finals to compatible commands, by replacing the # placeholders with the actual values and generating shell commands @@ -132,6 +137,11 @@ class VanillaWindow(Adw.ApplicationWindow): cur_index = self.carousel.get_position() page = self.carousel.get_nth_page(cur_index) + with contextlib.suppress(AttributeError): + self.emit("page-changed", page.step_id) + + print("Page changed to", cur_index, page) + if page not in pages_check: self.btn_back.set_visible(cur_index != 0.0) self.carousel_indicator_dots.set_visible(cur_index != 0.0) From d3d01a1e6ee7cd7b8a94100204a6c2fb7aed871d Mon Sep 17 00:00:00 2001 From: mirkobrombin Date: Thu, 5 Jan 2023 16:31:11 +0100 Subject: [PATCH 2/2] 1.6.0 --- VERSION | 2 +- debian/changelog | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index 66e6750..ce6a70b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.9 \ No newline at end of file +1.6.0 \ No newline at end of file diff --git a/debian/changelog b/debian/changelog index 7115b68..1f5260c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,12 @@ -vanilla-first-setup (1.5.9) kinetic; urgency=critical +vanilla-first-setup (1.6.0) kinetic; urgency=critical - * Fix reboot button not being hidden - * Add open-vm-tools-desktop to recipe.json + * Skip applications view with no pkg manager selected - -- Mirko Brombin Thu, 29 Dec 2022 14:35:00 +0000 + -- Mirko Brombin Thu, 29 Dec 2022 16:29:00 +0000 + + vanilla-first-setup (1.5.9) kinetic; urgency=critical + + * Fix reboot button not being hidden + * Add open-vm-tools-desktop to recipe.json + + -- Mirko Brombin Thu, 29 Dec 2022 14:35:00 +0000