diff --git a/vanilla_installer/assets/CREDITS b/vanilla_installer/assets/CREDITS index 21a8bbe0..84cd8bbe 100644 --- a/vanilla_installer/assets/CREDITS +++ b/vanilla_installer/assets/CREDITS @@ -1,2 +1,4 @@ Computer illustration from GNOME Initial Setup by Tobias Bernard licensed under the GNU General Public License Version 2. App icons from various GNOME projects. + +Unsupported.svg is extracted from Toggle's mockup and is provided by the illustrator(Brage: https://bragefuglseth.dev/) such that it can be re-used in vanilla-installer diff --git a/vanilla_installer/assets/unsupported.svg b/vanilla_installer/assets/unsupported.svg new file mode 100644 index 00000000..45d4f399 --- /dev/null +++ b/vanilla_installer/assets/unsupported.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/vanilla_installer/gtk/window-unsupported.ui b/vanilla_installer/gtk/window-unsupported.ui new file mode 100644 index 00000000..8bcf56f5 --- /dev/null +++ b/vanilla_installer/gtk/window-unsupported.ui @@ -0,0 +1,69 @@ + + + + + + diff --git a/vanilla_installer/main.py b/vanilla_installer/main.py index ea83e183..d90fb626 100644 --- a/vanilla_installer/main.py +++ b/vanilla_installer/main.py @@ -31,12 +31,14 @@ from gi.repository import Adw, Gio from vanilla_installer.windows.main_window import VanillaWindow +from vanilla_installer.windows.window_unsupported import VanillaUnsupportedWindow +from vanilla_installer.core.system import Systeminfo logging.basicConfig(level=logging.INFO) -class FirstSetupApplication(Adw.Application): +class VanillaInstaller(Adw.Application): """The main application singleton class.""" def __init__(self): @@ -57,7 +59,10 @@ def do_activate(self): win = self.props.active_window if not win: - win = VanillaWindow(application=self) + if Systeminfo.is_uefi(): + win = VanillaWindow(application=self) + else: + win = VanillaUnsupportedWindow(application=self) win.present() def create_action(self, name, callback, shortcuts=None): @@ -82,5 +87,5 @@ def close(self, *args): def main(version): """The application's entry point.""" - app = FirstSetupApplication() + app = VanillaInstaller() return app.run(sys.argv) diff --git a/vanilla_installer/vanilla-installer.gresource.xml b/vanilla_installer/vanilla-installer.gresource.xml index 4ccf2ce7..2cc007b2 100644 --- a/vanilla_installer/vanilla-installer.gresource.xml +++ b/vanilla_installer/vanilla-installer.gresource.xml @@ -2,6 +2,7 @@ gtk/window.ui + gtk/window-unsupported.ui gtk/confirm.ui gtk/done.ui gtk/progress.ui @@ -44,6 +45,7 @@ assets/complete.svg assets/control-center.svg assets/containerized.svg + assets/unsupported.svg ../data/icons/hicolor/symbolic/actions/background-app-ghost-symbolic.svg diff --git a/vanilla_installer/windows/meson.build b/vanilla_installer/windows/meson.build index 0828161d..9336889a 100644 --- a/vanilla_installer/windows/meson.build +++ b/vanilla_installer/windows/meson.build @@ -8,6 +8,7 @@ sources = [ 'dialog_output.py', 'dialog_recovery.py', 'dialog_poweroff.py', + 'window_unsupported.py', ] install_data(sources, install_dir: windowsdir) diff --git a/vanilla_installer/windows/window_unsupported.py b/vanilla_installer/windows/window_unsupported.py new file mode 100644 index 00000000..54804748 --- /dev/null +++ b/vanilla_installer/windows/window_unsupported.py @@ -0,0 +1,39 @@ +# window_unsupported.py +# +# Copyright 2023 muqtadir +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundationat version 3 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from gettext import gettext as _ +import subprocess +from gi.repository import Adw, Gtk +from vanilla_installer.utils.recipe import RecipeLoader + + +@Gtk.Template(resource_path="/org/vanillaos/Installer/gtk/window-unsupported.ui") +class VanillaUnsupportedWindow(Adw.Window): + __gtype_name__ = "VanillaUnsupportedWindow" + + btn_poweroff = Gtk.Template.Child() + description_label = Gtk.Template.Child() + + def __init__(self, **kwargs): + super().__init__(**kwargs) + + self.description_label.set_label(f"{RecipeLoader().raw['distro_name']} requires UEFI to install") + self.btn_poweroff.connect("clicked", self.__on_poweroff) + + def __on_poweroff(self, btn): + subprocess.call(["systemctl", "poweroff"]) + +