From d9746d85670b8a2b6b6e333cc44c6db9be66d2f8 Mon Sep 17 00:00:00 2001 From: "Abhiraj Roy (iconized)" <157954129+iconized@users.noreply.github.com> Date: Thu, 25 Apr 2024 16:12:30 +0530 Subject: [PATCH] show_in_app_notification(), restart_program() --- blackbox/Functions.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/blackbox/Functions.py b/blackbox/Functions.py index 29614e6..cdb65d3 100644 --- a/blackbox/Functions.py +++ b/blackbox/Functions.py @@ -1911,3 +1911,23 @@ def cache_btn(): logger.debug("Caching applications finished") +def restart_program(): + os.unlink("/tmp/blackbox.lock") + python = sys.executable + os.execl(python, python, *sys.argv) + +def show_in_app_notification(self, message, err): + if self.timeout_id is not None: + GLib.source_remove(self.timeout_id) + self.timeout_id = None + + if err is True: + self.notification_label.set_markup( + '' + message + "" + ) + else: + self.notification_label.set_markup( + '' + message + "" + ) + self.notification_revealer.set_reveal_child(True) + self.timeout_id = GLib.timeout_add(3000, timeout, self)