From d9b73b4008d5a47f990d0f236ac0a8c44838e90e Mon Sep 17 00:00:00 2001 From: Eshan Roy Date: Tue, 26 Nov 2024 10:26:52 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20refactor(=5F!applicable):=20empt?= =?UTF-8?q?y=20construction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/functions.py | 2 +- snigdhaos-kernel-switcher.css | 0 snigdhaos-kernel-switcher.py | 34 ++++++++++++++++++++++++++++++++-- 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 snigdhaos-kernel-switcher.css diff --git a/libs/functions.py b/libs/functions.py index ec072d7..efd99b6 100644 --- a/libs/functions.py +++ b/libs/functions.py @@ -24,7 +24,7 @@ from libs.Kernel import Kernel, InstalledKernel, CommunityKernel from ui.MessageWindow import MessageWindow from queue import Queue import gi -gi.require_version("Gtk", "3.0") +gi.require_version("Gtk", "4.0") from gi.repository import GLib diff --git a/snigdhaos-kernel-switcher.css b/snigdhaos-kernel-switcher.css new file mode 100644 index 0000000..e69de29 diff --git a/snigdhaos-kernel-switcher.py b/snigdhaos-kernel-switcher.py index c28ff2d..59ceb7a 100644 --- a/snigdhaos-kernel-switcher.py +++ b/snigdhaos-kernel-switcher.py @@ -1,6 +1,7 @@ -#!/usr/bin/python +#!/bin/python import os import libs.functions as fn +from ui.ManagerGUI import ManagerGUI import gi gi.require_version("Gtk", "4.0") from gi.repository import Gtk, Gio, GLib, Gdk @@ -20,4 +21,33 @@ class Main(Gtk.Application): super().__init__(application_id=app_id, flags=Gio.ApplicationFlags.FLAGS_NONE) def do_activate(self): - default_context = GLib. \ No newline at end of file + default_context = GLib.MainContext.default() + win = self.props.active_window + if not win: + win = ManagerGUI(application=self, app_name=app_name, default_context=default_context,app_version=app_version) + display = Gtk.Widget.get_display(win) + win.set_icon_name("snigdhaos-kernel-switcher-tux") + provider = Gtk.CssProvider.new() + css_file = Gio.file_new_for_path(css_file) + Gtk.StyleContext.add_provider_for_display(display, provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) + win.present() + + def do_startup(self): + Gtk.Application.do_startup(self) + + def do_shutdown(self): + Gtk.Application.do_shutdown(self) + if os.path.exists(lock_file): + os.remove(lock_file) + if os.path.exists(pid_file): + os.remove(pid_file) + if os.path.exists(progress_lock_file): + os.remove(progress_lock_file) + + def snigdhal_handler(sig, frame): + Gtk.main_quit(0) + + # if __name__ == "__main__": + # try: + # except Exception as e: + # return False \ No newline at end of file