From e3c3f20da7ca64cd47a963a11c4756de4e23cddf Mon Sep 17 00:00:00 2001 From: DYefremov Date: Mon, 12 Nov 2018 13:43:05 +0300 Subject: [PATCH] little refactoring --- app/ui/iptv.glade | 45 +++++++++++++-------------------------------- app/ui/iptv.py | 9 ++++++--- 2 files changed, 19 insertions(+), 35 deletions(-) diff --git a/app/ui/iptv.glade b/app/ui/iptv.glade index 570ad684..d8e0be3f 100644 --- a/app/ui/iptv.glade +++ b/app/ui/iptv.glade @@ -46,7 +46,17 @@ Author: Dmitriy Yefremov True True center - + + + + gtk-cancel + True + True + True + True + True + + @@ -55,41 +65,12 @@ Author: Dmitriy Yefremov False vertical 1 - - - False - end - - - gtk-cancel - True - True - True - True - - - - True - True - 0 - - - - - - - - False - False - 3 - - True False - 2 - 2 + 5 + 5 5 5 0 diff --git a/app/ui/iptv.py b/app/ui/iptv.py index 6a9439fd..b0d78a1c 100644 --- a/app/ui/iptv.py +++ b/app/ui/iptv.py @@ -197,7 +197,7 @@ class IptvDialog: class SearchUnavailableDialog: def __init__(self, transient, model, fav_bouquet, iptv_rows, profile): - handlers = {"on_search_unavailable_close": self.on_close} + handlers = {"on_response": self.on_response} builder = Gtk.Builder() builder.set_translation_domain(TEXT_DOMAIN) @@ -263,12 +263,15 @@ class SearchUnavailableDialog: def show(self): response = self._dialog.run() - self._dialog.destroy() return self._to_delete if response not in (Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT) else False + def on_response(self, dialog, response): + if response == Gtk.ResponseType.CANCEL: + self.on_close() + @run_idle - def on_close(self, item=None, event=None): + def on_close(self): if self._download_task and show_dialog(DialogType.QUESTION, self._dialog) == Gtk.ResponseType.CANCEL: return self._download_task = False