diff --git a/debian/ubuntu-smoother/DEBIAN/control b/debian/ubuntu-smoother/DEBIAN/control deleted file mode 100644 index 890159b..0000000 --- a/debian/ubuntu-smoother/DEBIAN/control +++ /dev/null @@ -1,10 +0,0 @@ -Package: vanilla-first-setup -Version: 0.0.1 -Architecture: amd64 -Maintainer: Mirko Brombin -Installed-Size: 65 -Depends: dconf-gsettings-backend | gsettings-backend, python3, python3-gi, libadwaita-1, gir1.2-gtk-4.0, gir1.2-adw-1 -Section: utils -Priority: optional -Homepage: https://github.com/mirkobrombin/vanilla-first-setup/ -Description: This utility is meant to be used in Ubuntu Vanilla GNOME as a first-setup wizard. diff --git a/debian/ubuntu-smoother/DEBIAN/md5sums b/debian/ubuntu-smoother/DEBIAN/md5sums deleted file mode 100644 index fac8170..0000000 --- a/debian/ubuntu-smoother/DEBIAN/md5sums +++ /dev/null @@ -1,24 +0,0 @@ -3f84a85bd8dcb22475ca07a2d69063ac usr/bin/vanilla-first-setup -e53214a91cfee2c537138e64d0d2357e usr/bin/vanilla-first-setup-processor -f62ae2de8dd39b794fa94951db288612 usr/share/appdata/io.github.vanilla-os.FirstSetup.appdata.xml -572c7ac7342d5e999af8cf5fc99fc7ba usr/share/applications/io.github.vanilla-os.FirstSetup.desktop -632c1335ca45192e9b887308023c156c usr/share/doc/vanilla-first-setup/changelog.gz -62ed186d7529beecf72bcf7c48b53a76 usr/share/doc/vanilla-first-setup/copyright -3ff815595db45e9dcd137d06f9d8718c usr/share/glib-2.0/schemas/io.github.vanilla-os.FirstSetup.gschema.xml -a3cd0585c74138a988a7225dd57fc171 usr/share/icons/hicolor/scalable/apps/io.github.vanilla-os.FirstSetup.svg -a3cd0585c74138a988a7225dd57fc171 usr/share/icons/hicolor/symbolic/apps/io.github.vanilla-os.FirstSetup-symbolic.svg -75fdbd9173045311c140056e34292035 usr/share/io.github.vanilla-os.FirstSetup/vanilla-first-setup.gresource -d41d8cd98f00b204e9800998ecf8427e usr/share/io.github.vanilla-os.FirstSetup/vanilla_first_setup/__init__.py -cacabd792fe13148f625e90b1d63e343 usr/share/io.github.vanilla-os.FirstSetup/vanilla_first_setup/main.py -d41d8cd98f00b204e9800998ecf8427e usr/share/io.github.vanilla-os.FirstSetup/vanilla_first_setup/models/__init__.py -655cc3575fd9547bcc28605a40adecb4 usr/share/io.github.vanilla-os.FirstSetup/vanilla_first_setup/models/config.py -19a9c8ef77a0b94b9bd9da204bf619be usr/share/io.github.vanilla-os.FirstSetup/vanilla_first_setup/models/preset.py -d41d8cd98f00b204e9800998ecf8427e usr/share/io.github.vanilla-os.FirstSetup/vanilla_first_setup/utils/__init__.py -24bb5bd4e6d6262c1b454b3656ab24e0 usr/share/io.github.vanilla-os.FirstSetup/vanilla_first_setup/utils/apt.py -4d805e042731d213eb5139530d8aa638 usr/share/io.github.vanilla-os.FirstSetup/vanilla_first_setup/utils/checks.py -7823cbc7898533c975d6a44bc5805480 usr/share/io.github.vanilla-os.FirstSetup/vanilla_first_setup/utils/configurator.py -d757da1b73916417336840cc67295681 usr/share/io.github.vanilla-os.FirstSetup/vanilla_first_setup/utils/flatpak.py -f2595187532f527875795277675234a5 usr/share/io.github.vanilla-os.FirstSetup/vanilla_first_setup/utils/processor.py -0ebff648510796f3d38e84739469f97e usr/share/io.github.vanilla-os.FirstSetup/vanilla_first_setup/utils/run_async.py -ebbd22d7a8847f604900387b8c9d86a2 usr/share/io.github.vanilla-os.FirstSetup/vanilla_first_setup/utils/snap.py -f07c8b3e157f197d2cefd0a89862b3c1 usr/share/io.github.vanilla-os.FirstSetup/vanilla_first_setup/window.py diff --git a/debian/ubuntu-smoother/usr/bin/ubuntu-smoother b/debian/ubuntu-smoother/usr/bin/ubuntu-smoother deleted file mode 100755 index 62795fa..0000000 --- a/debian/ubuntu-smoother/usr/bin/ubuntu-smoother +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/python3 - -# vanilla-first-setup.in -# -# Copyright 2022 mirkobrombin -# -# 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 . - -import os -import sys -import signal -import locale -import gettext - -VERSION = '0.0.1' -pkgdatadir = '/usr/share/io.github.vanilla-os.FirstSetup' -localedir = '/usr/share/locale' - -sys.path.insert(1, pkgdatadir) -signal.signal(signal.SIGINT, signal.SIG_DFL) -locale.bindtextdomain('vanilla_first_setup', localedir) -locale.textdomain('vanilla_first_setup') -gettext.install('vanilla_first_setup', localedir) - -if __name__ == '__main__': - import gi - - from gi.repository import Gio - resource = Gio.Resource.load(os.path.join(pkgdatadir, 'vanilla-first-setup.gresource')) - resource._register() - - from vanilla_first_setup import main - sys.exit(main.main(VERSION)) \ No newline at end of file diff --git a/debian/ubuntu-smoother/usr/bin/ubuntu-smoother-processor b/debian/ubuntu-smoother/usr/bin/ubuntu-smoother-processor deleted file mode 100755 index 0031bd6..0000000 --- a/debian/ubuntu-smoother/usr/bin/ubuntu-smoother-processor +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/python3 - -# vanilla-first-setup-processor.in -# -# Copyright 2022 mirkobrombin -# -# 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 . - -import os -import sys -import signal -import locale -import gettext -import argparse - -VERSION = '0.0.1' -pkgdatadir = '/usr/share/io.github.vanilla-os.FirstSetup' -localedir = '/usr/share/locale' - -sys.path.insert(1, pkgdatadir) -signal.signal(signal.SIGINT, signal.SIG_DFL) -locale.bindtextdomain('vanilla_first_setup', localedir) -locale.textdomain('vanilla_first_setup') -gettext.install('vanilla_first_setup', localedir) - -if __name__ == '__main__': - from vanilla_first_setup.utils.configurator import Configurator - from vanilla_first_setup.models.config import Config - - parser = argparse.ArgumentParser() - parser.add_argument('config', help='The configuration string (e.g. snap::True|flatpak::False|apport::True)') - args = parser.parse_args() - - config = Config.from_str(args.config) - Configurator(config).apply() diff --git a/debian/ubuntu-smoother/usr/share/appdata/pm.mirko.UbuntuSmoother.appdata.xml b/debian/ubuntu-smoother/usr/share/appdata/pm.mirko.UbuntuSmoother.appdata.xml deleted file mode 100644 index b2ef653..0000000 --- a/debian/ubuntu-smoother/usr/share/appdata/pm.mirko.UbuntuSmoother.appdata.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - io.github.vanilla-os.FirstSetup.desktop - CC0-1.0 - GPL-3.0-only - Vanilla OS First Setup - Tweak your Ubuntu Vanilla GNOME installation. - Mirko Brombin - -

No description

-
- - io.github.vanilla-os.FirstSetup - - - pointing - keyboard - touch - - - 768 - - - - -

First release

-
-
-
-
diff --git a/debian/ubuntu-smoother/usr/share/applications/pm.mirko.UbuntuSmoother.desktop b/debian/ubuntu-smoother/usr/share/applications/pm.mirko.UbuntuSmoother.desktop deleted file mode 100644 index 50adc38..0000000 --- a/debian/ubuntu-smoother/usr/share/applications/pm.mirko.UbuntuSmoother.desktop +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Name=Vanilla OS First Setup -Exec=vanilla-first-setup -Icon=io.github.vanilla-os.FirstSetup -Terminal=false -Type=Application -Categories=GTK; -StartupNotify=true diff --git a/debian/ubuntu-smoother/usr/share/doc/ubuntu-smoother/changelog.gz b/debian/ubuntu-smoother/usr/share/doc/ubuntu-smoother/changelog.gz deleted file mode 100644 index b65f44a..0000000 Binary files a/debian/ubuntu-smoother/usr/share/doc/ubuntu-smoother/changelog.gz and /dev/null differ diff --git a/debian/ubuntu-smoother/usr/share/doc/ubuntu-smoother/copyright b/debian/ubuntu-smoother/usr/share/doc/ubuntu-smoother/copyright deleted file mode 100644 index 76eec4b..0000000 --- a/debian/ubuntu-smoother/usr/share/doc/ubuntu-smoother/copyright +++ /dev/null @@ -1,23 +0,0 @@ -Format: http://dep.debian.net/deps/dep5 -Upstream-Name: Vanilla OS First Setup -Source: https://github.com/mirko-brombin/vanilla-first-setup - -Files: * -Copyright: 2022 Mirko Brombin -License: GPL-3.0 - -License: GPL-3.0 - 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 Foundation, either version 3 of the License. - . - This package 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 . - . - On Debian systems, the complete text of the GNU General - Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". \ No newline at end of file diff --git a/debian/ubuntu-smoother/usr/share/glib-2.0/schemas/pm.mirko.UbuntuSmoother.gschema.xml b/debian/ubuntu-smoother/usr/share/glib-2.0/schemas/pm.mirko.UbuntuSmoother.gschema.xml deleted file mode 100644 index 8490b34..0000000 --- a/debian/ubuntu-smoother/usr/share/glib-2.0/schemas/pm.mirko.UbuntuSmoother.gschema.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/debian/ubuntu-smoother/usr/share/icons/hicolor/scalable/apps/pm.mirko.UbuntuSmoother.svg b/debian/ubuntu-smoother/usr/share/icons/hicolor/scalable/apps/pm.mirko.UbuntuSmoother.svg deleted file mode 100644 index 76381fb..0000000 --- a/debian/ubuntu-smoother/usr/share/icons/hicolor/scalable/apps/pm.mirko.UbuntuSmoother.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/debian/ubuntu-smoother/usr/share/icons/hicolor/symbolic/apps/pm.mirko.UbuntuSmoother-symbolic.svg b/debian/ubuntu-smoother/usr/share/icons/hicolor/symbolic/apps/pm.mirko.UbuntuSmoother-symbolic.svg deleted file mode 100644 index 76381fb..0000000 --- a/debian/ubuntu-smoother/usr/share/icons/hicolor/symbolic/apps/pm.mirko.UbuntuSmoother-symbolic.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu-smoother.gresource b/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu-smoother.gresource deleted file mode 100644 index c8f322b..0000000 Binary files a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu-smoother.gresource and /dev/null differ diff --git a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/__init__.py b/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/main.py b/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/main.py deleted file mode 100644 index aeab27c..0000000 --- a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/main.py +++ /dev/null @@ -1,72 +0,0 @@ -# main.py -# -# Copyright 2022 mirkobrombin -# -# 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 vanilla_first_setup.window import FirstSetupWindow -from gi.repository import Gtk, Gio, Adw -import sys -import gi -import logging - -gi.require_version('Gtk', '4.0') -gi.require_version('Adw', '1') - - -logging.basicConfig(level=logging.INFO) - - -class FirstSetupApplication(Adw.Application): - """The main application singleton class.""" - - def __init__(self): - super().__init__(application_id='io.github.vanilla-os.FirstSetup', - flags=Gio.ApplicationFlags.FLAGS_NONE) - self.create_action('quit', self.close, ['q']) - - def do_activate(self): - """Called when the application is activated. - - We raise the application's main window, creating it if - necessary. - """ - win = self.props.active_window - if not win: - win = FirstSetupWindow(application=self) - win.present() - - def create_action(self, name, callback, shortcuts=None): - """Add an application action. - - Args: - name: the name of the action - callback: the function to be called when the action is - activated - shortcuts: an optional list of accelerators - """ - action = Gio.SimpleAction.new(name, None) - action.connect("activate", callback) - self.add_action(action) - if shortcuts: - self.set_accels_for_action(f"app.{name}", shortcuts) - - def close(self, *args): - """Close the application.""" - self.quit() - - -def main(version): - """The application's entry point.""" - app = FirstSetupApplication() - return app.run(sys.argv) diff --git a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/models/__init__.py b/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/models/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/models/config.py b/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/models/config.py deleted file mode 100644 index 40ae2f0..0000000 --- a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/models/config.py +++ /dev/null @@ -1,25 +0,0 @@ -class Config: - - def __init__(self, snap: bool, flatpak: bool, apport: bool): - self.snap = snap - self.flatpak = flatpak - self.apport = apport - - def get_str(self) -> str: - return "snap::{0}|flatpak::{1}|apport::{2}".format( - self.snap, self.flatpak, self.apport - ) - - @classmethod - def from_str(cls, config_str: str) -> 'Config': - items = config_str.split('|') - - snap = items[0].split('::')[1] - flatpak = items[1].split('::')[1] - apport = items[2].split('::')[1] - - return cls( - snap=bool(snap), - flatpak=bool(flatpak), - apport=bool(apport) - ) diff --git a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/models/preset.py b/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/models/preset.py deleted file mode 100644 index 9fb1d42..0000000 --- a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/models/preset.py +++ /dev/null @@ -1,5 +0,0 @@ -class Preset: - - snap: bool = True - flatpak: bool = True - apport: bool = True diff --git a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/__init__.py b/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/apt.py b/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/apt.py deleted file mode 100644 index 0d9e19c..0000000 --- a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/apt.py +++ /dev/null @@ -1,44 +0,0 @@ -import subprocess - - -class Apt: - - @staticmethod - def install(packages: list): - subprocess.run( - ['sudo', 'apt', 'install'] + packages, - env={'DEBIAN_FRONTEND': 'noninteractive'}, - check=True - ) - - @staticmethod - def remove(packages: list): - subprocess.run( - ['sudo', 'apt', 'remove'] + packages, - env={'DEBIAN_FRONTEND': 'noninteractive'}, - check=True - ) - - @staticmethod - def purge(packages: list): - subprocess.run( - ['sudo', 'apt', 'purge'] + packages, - env={'DEBIAN_FRONTEND': 'noninteractive'}, - check=True - ) - - @staticmethod - def update(): - subprocess.run( - ['sudo', 'apt', 'update'], - env={'DEBIAN_FRONTEND': 'noninteractive'}, - check=True - ) - - @staticmethod - def upgrade(): - subprocess.run( - ['sudo', 'apt', 'upgrade'], - env={'DEBIAN_FRONTEND': 'noninteractive'}, - check=True - ) diff --git a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/checks.py b/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/checks.py deleted file mode 100644 index d3c8425..0000000 --- a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/checks.py +++ /dev/null @@ -1,13 +0,0 @@ -import shutil - - -def is_snap_installed(): - return shutil.which('snap') is not None - - -def is_flatpak_installed(): - return shutil.which('flatpak') is not None - - -def is_apport_installed(): - return shutil.which('apport') is not None diff --git a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/configurator.py b/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/configurator.py deleted file mode 100644 index 1f49f0c..0000000 --- a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/configurator.py +++ /dev/null @@ -1,99 +0,0 @@ -import os -import time -import logging - -from vanilla_first_setup.utils import checks -from vanilla_first_setup.utils.apt import Apt -from vanilla_first_setup.utils.flatpak import Flatpak -from vanilla_first_setup.utils.snap import Snap - - -logger = logging.getLogger("FirstSetup::Configurator") - - -class Configurator: - - def __init__(self, config: 'Config', fake: bool = False): - self.config = config - self.fake = fake - - def apply(self): - self.__enable_snap() if self.config.snap else self.__disable_snap() - self.__enable_flatpak() if self.config.flatpak else self.__disable_flatpak() - self.__enable_apport() if self.config.apport else self.__disable_apport() - - def __fake(self, msg: str): - time.sleep(1) - logger.info(f"Fake: {msg}") - - def __enable_snap(self): - if self.fake: - return self.__fake("Fake: Snap enabled") - - if not checks.is_snap_installed(): - Apt.install(['snapd', 'gnome-software-plugin-snap']) - Apt.update() - - if not self.config.flatpak: - Snap.install(['snap-store']) - - def __disable_snap(self): - if self.fake: - return self.__fake("Fake: Snap disabled") - - if checks.is_snap_installed(): - Apt.purge(['snapd']) - - def __enable_flatpak(self): - if self.fake: - return self.__fake("Fake: Flatpak enabled") - - if not checks.is_flatpak_installed(): - Apt.install(['flatpak']) - Apt.update() - Flatpak.add_repo("https://flathub.org/repo/flathub.flatpakrepo") - - def __disable_flatpak(self): - if self.fake: - return self.__fake("Fake: Flatpak disabled") - - if checks.is_flatpak_installed(): - Apt.purge(['flatpak']) - - def __enable_apport(self): - if self.fake: - return self.__fake("Fake: Apport enabled") - - if not checks.is_apport_installed(): - Apt.install(['apport']) - Apt.update() - - def __disable_apport(self): - if self.fake: - return self.__fake("Fake: Apport disabled") - - if checks.is_apport_installed(): - Apt.purge(['apport']) - - def __disable_on_startup(self): - if self.fake: - return self.__fake("Fake: Disable on startup") - - autostart_file = os.path.expanduser("~/.config/autostart/vanilla-first-setup.desktop") - if os.path.exists(autostart_file): - os.remove(autostart_file) - - def __enable_on_startup(self): - if self.fake: - return self.__fake("Fake: Enable on startup") - - autostart_file = os.path.expanduser("~/.config/autostart/vanilla-first-setup.desktop") - if not os.path.exists(autostart_file): - with open(autostart_file, "w") as f: - f.write("[Desktop Entry]") - f.write("Type=Application") - f.write("Name=Vanilla OS First Setup") - f.write("Exec=vanilla-first-setup") - f.write("Terminal=false") - f.write("X-GNOME-Autostart-enabled=true") - \ No newline at end of file diff --git a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/flatpak.py b/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/flatpak.py deleted file mode 100644 index 7c45833..0000000 --- a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/flatpak.py +++ /dev/null @@ -1,25 +0,0 @@ -import subprocess - - -class Flatpak: - - @staticmethod - def install(packages: list): - subprocess.run( - ['flatpak', 'install', '--user'] + packages, - check=True - ) - - @staticmethod - def remove(packages: list): - subprocess.run( - ['flatpak', 'remove', '--user'] + packages, - check=True - ) - - @staticmethod - def add_repo(repo: str): - subprocess.run( - ['flatpak', 'remote-add', '--user', '--if-not-exists', repo], - check=True - ) diff --git a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/processor.py b/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/processor.py deleted file mode 100644 index 29379c8..0000000 --- a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/processor.py +++ /dev/null @@ -1,18 +0,0 @@ -import subprocess - - -class Processor: - - def __init__(self, config: 'Config'): - self.__config = config - - def run(self): - proc = subprocess.run( - ["pkexec", "vanilla-first-setup-processor", self.__config.get_str()], - check=True - ) - - if proc.returncode != 0: - return False, "Error executing the Vanilla OS First Setup Processor" - - return True \ No newline at end of file diff --git a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/run_async.py b/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/run_async.py deleted file mode 100644 index 211761a..0000000 --- a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/run_async.py +++ /dev/null @@ -1,70 +0,0 @@ -# run_async.py -# -# Copyright 2022 brombinmirko -# -# 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 Foundation, in 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 . -# - -import os -import sys -import threading -import traceback -import logging - -from gi.repository import GLib - -logger = logging.getLogger("FirstSetup::Async") - - -class RunAsync(threading.Thread): - """ - This class is used to execute a function asynchronously. - It takes a function, a callback and a list of arguments as input. - """ - - def __init__(self, task_func, callback=None, *args, **kwargs): - if "DEBUG_MODE" in os.environ: - import faulthandler - faulthandler.enable() - - self.source_id = None - assert threading.current_thread() is threading.main_thread() - - super(RunAsync, self).__init__(target=self.__target, args=args, kwargs=kwargs) - - self.task_func = task_func - - self.callback = callback if callback else lambda r, e: None - self.daemon = kwargs.pop("daemon", True) - - self.start() - - def __target(self, *args, **kwargs): - result = None - error = None - - logger.debug(f"Running async job [{self.task_func}].") - - try: - result = self.task_func(*args, **kwargs) - except Exception as exception: - logger.error("Error while running async job: " - f"{self.task_func}\nException: {exception}") - - error = exception - _ex_type, _ex_value, trace = sys.exc_info() - traceback.print_tb(trace) - traceback_info = '\n'.join(traceback.format_tb(trace)) - - self.source_id = GLib.idle_add(self.callback, result, error) - return self.source_id diff --git a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/snap.py b/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/snap.py deleted file mode 100644 index ae76ae6..0000000 --- a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/utils/snap.py +++ /dev/null @@ -1,18 +0,0 @@ -import subprocess - - -class Snap: - - @staticmethod - def install(packages: list): - subprocess.run( - ['snap', 'install'] + packages, - check=True - ) - - @staticmethod - def remove(packages: list): - subprocess.run( - ['snap', 'remove'] + packages, - check=True - ) diff --git a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/window.py b/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/window.py deleted file mode 100644 index 17f632c..0000000 --- a/debian/ubuntu-smoother/usr/share/pm.mirko.UbuntuSmoother/ubuntu_smoother/window.py +++ /dev/null @@ -1,94 +0,0 @@ -# window.py -# -# Copyright 2022 mirkobrombin -# -# 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 gi.repository import Gtk, Gio, Adw - -from vanilla_first_setup.models.preset import Preset -from vanilla_first_setup.models.config import Config -from vanilla_first_setup.utils.processor import Processor -from vanilla_first_setup.utils.run_async import RunAsync - - -@Gtk.Template(resource_path='/io/github/vanilla-os/FirstSetup/gtk/window.ui') -class FirstSetupWindow(Adw.ApplicationWindow): - __gtype_name__ = 'FirstSetupWindow' - - carousel = Gtk.Template.Child() - btn_start = Gtk.Template.Child() - btn_save = Gtk.Template.Child() - btn_close = Gtk.Template.Child() - switch_snap = Gtk.Template.Child() - switch_flatpak = Gtk.Template.Child() - switch_apport = Gtk.Template.Child() - page_welcome = -1 - page_configuration = 0 - page_progress = 1 - page_done = 2 - spinner = Gtk.Template.Child() - - def __init__(self, **kwargs): - super().__init__(**kwargs) - self.__config = Config( - snap=Preset.snap, - flatpak=Preset.flatpak, - apport=Preset.apport - ) - self.__buiild_ui() - self.__connect_signals() - - def __buiild_ui(self): - self.switch_snap.set_active(Preset.snap) - self.switch_flatpak.set_active(Preset.flatpak) - self.switch_apport.set_active(Preset.apport) - - def __connect_signals(self): - self.btn_start.connect('clicked', self.__on_btn_start_clicked) - self.btn_save.connect('clicked', self.on_btn_save_clicked) - self.btn_close.connect('clicked', self.on_btn_close_clicked) - self.switch_snap.connect('state-set', self.__on_switch_snap_state_set) - self.switch_flatpak.connect( - 'state-set', self.__on_switch_flatpak_state_set) - self.switch_apport.connect( - 'state-set', self.__on_switch_apport_state_set) - - def __show_page(self, page: int): - _page = self.carousel.get_nth_page(page + 1) - self.carousel.scroll_to(_page, True) - - def __on_btn_start_clicked(self, widget): - self.__show_page(self.page_configuration) - - def on_btn_save_clicked(self, widget): - def on_done(result, error=None): - self.spinner.stop() - self.__show_page(self.page_done) - - self.__show_page(self.page_progress) - self.spinner.start() - - RunAsync(Processor(self.__config).run, on_done) - - def __on_switch_snap_state_set(self, widget, state): - self.__config.snap = state - - def __on_switch_flatpak_state_set(self, widget, state): - self.__config.flatpak = state - - def __on_switch_apport_state_set(self, widget, state): - self.__config.apport = state - - def on_btn_close_clicked(self, widget): - self.get_application().quit()