From 0aa108db43fed8fdf8a54893d21face9b9bf5007 Mon Sep 17 00:00:00 2001 From: Piotr Miller Date: Tue, 8 Jun 2021 11:55:20 +0200 Subject: [PATCH] clear src tag on window.Hide() --- nwg_panel/modules/controls.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/nwg_panel/modules/controls.py b/nwg_panel/modules/controls.py index e7d344b..3d02345 100644 --- a/nwg_panel/modules/controls.py +++ b/nwg_panel/modules/controls.py @@ -531,16 +531,17 @@ class PopupWindow(Gtk.Window): def on_window_exit(self, w, e): if self.get_visible(): - self.src_tag = GLib.timeout_add_seconds(1, self.hide) + self.src_tag = GLib.timeout_add_seconds(1, self.hide_and_clear_tag) return True - + + def hide_and_clear_tag(self): + self.hide() + self.src_tag = 0 + def on_window_enter(self, *args): if self.src_tag > 0: - try: - GLib.Source.remove(self.src_tag) - self.src_tag = 0 - except: - pass + GLib.Source.remove(self.src_tag) + self.src_tag = 0 return True def on_window_show(self, *args):