misc: Do not process finals for applications if no pkg manager

main
mirkobrombin 2 years ago
parent 7b37cc6b99
commit ac0934cba5

@ -81,6 +81,13 @@
"title": "AppImage",
"subtitle": "Install necessary dependencies to run AppImages.",
"default": true
},
{
"id": "-",
"title": "-",
"subtitle": "-",
"disabled": true,
"default": true
}
],
"final": [

@ -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):

@ -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"):

@ -15,7 +15,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
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)

Loading…
Cancel
Save