diff --git a/ubuntu_smoother/main.py b/ubuntu_smoother/main.py index 469d16b..6f23522 100644 --- a/ubuntu_smoother/main.py +++ b/ubuntu_smoother/main.py @@ -14,6 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from ubuntu_smoother.window import UbuntuSmootherWindow +from gi.repository import Gtk, Gio, Adw import sys import gi import logging @@ -21,10 +23,6 @@ import logging gi.require_version('Gtk', '4.0') gi.require_version('Adw', '1') -from gi.repository import Gtk, Gio, Adw - -from ubuntu_smoother.window import UbuntuSmootherWindow - logging.basicConfig(level=logging.INFO) @@ -62,7 +60,7 @@ class UbuntuSmootherApplication(Adw.Application): self.add_action(action) if shortcuts: self.set_accels_for_action(f"app.{name}", shortcuts) - + def close(self, *args): """Close the application.""" self.quit() @@ -71,4 +69,4 @@ class UbuntuSmootherApplication(Adw.Application): def main(version): """The application's entry point.""" app = UbuntuSmootherApplication() - return app.run(sys.argv) \ No newline at end of file + return app.run(sys.argv) diff --git a/ubuntu_smoother/models/config.py b/ubuntu_smoother/models/config.py index ca8c1e0..cae9f63 100644 --- a/ubuntu_smoother/models/config.py +++ b/ubuntu_smoother/models/config.py @@ -4,4 +4,3 @@ class Config: self.snap = snap self.flatpak = flatpak self.apport = apport - \ No newline at end of file diff --git a/ubuntu_smoother/models/preset.py b/ubuntu_smoother/models/preset.py index 8fc22fe..9fb1d42 100644 --- a/ubuntu_smoother/models/preset.py +++ b/ubuntu_smoother/models/preset.py @@ -3,4 +3,3 @@ class Preset: snap: bool = True flatpak: bool = True apport: bool = True - \ No newline at end of file diff --git a/ubuntu_smoother/utils/checks.py b/ubuntu_smoother/utils/checks.py index fafb79b..d3c8425 100644 --- a/ubuntu_smoother/utils/checks.py +++ b/ubuntu_smoother/utils/checks.py @@ -1,10 +1,13 @@ 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/ubuntu_smoother/utils/configurator.py b/ubuntu_smoother/utils/configurator.py index 0b6e845..cb98ad0 100644 --- a/ubuntu_smoother/utils/configurator.py +++ b/ubuntu_smoother/utils/configurator.py @@ -8,6 +8,7 @@ from ubuntu_smoother.utils.snap import Snap logger = logging.getLogger("UbuntuSmoother::Configurator") + class Configurator: def __init__(self, config: 'Config', fake: bool = False): @@ -18,7 +19,7 @@ class Configurator: 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 __enable_snap(self): if self.fake: logger.info("Fake: Snap enabled") @@ -32,7 +33,7 @@ class Configurator: if not self.config.flatpak: Snap.install(['snap-store']) - + def __disable_snap(self): if self.fake: logger.info("Fake: Snap disabled") @@ -40,7 +41,7 @@ class Configurator: if checks.is_snap_installed(): Apt.purge(['snapd']) - + def __enable_flatpak(self): if self.fake: logger.info("Fake: Flatpak enabled") diff --git a/ubuntu_smoother/window.py b/ubuntu_smoother/window.py index 965e144..bb45462 100644 --- a/ubuntu_smoother/window.py +++ b/ubuntu_smoother/window.py @@ -51,8 +51,10 @@ class UbuntuSmootherWindow(Adw.ApplicationWindow): self.btn_start.connect('clicked', self.__on_btn_start_clicked) self.btn_save.connect('clicked', self.on_btn_save_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) + 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 __on_btn_start_clicked(self, widget): index = int(self.carousel.get_position())