From 99ecb0f22ed7a8ae6f8f3af9cd34c47f9d4eda0e Mon Sep 17 00:00:00 2001 From: DYefremov Date: Mon, 9 Jul 2018 11:38:36 +0300 Subject: [PATCH] updating dynamic elements before popup menu --- app/ui/dialogs.glade | 7 +++++-- app/ui/iptv.py | 5 +++-- app/ui/main_app_window.py | 13 ++++++++++++- app/ui/main_window.glade | 30 +++++++++++++++--------------- 4 files changed, 35 insertions(+), 20 deletions(-) diff --git a/app/ui/dialogs.glade b/app/ui/dialogs.glade index 365ef2ac..a27da077 100644 --- a/app/ui/dialogs.glade +++ b/app/ui/dialogs.glade @@ -170,6 +170,8 @@ Author: Dmitriy Yefremov True False + 2 + 2 vertical 2 @@ -180,6 +182,7 @@ Author: Dmitriy Yefremov 2 2 2 + True True @@ -237,7 +240,7 @@ Author: Dmitriy Yefremov - False + True True 0 @@ -429,7 +432,7 @@ Author: Dmitriy Yefremov - False + True True 1 diff --git a/app/ui/iptv.py b/app/ui/iptv.py index f5889798..a9ef5ee1 100644 --- a/app/ui/iptv.py +++ b/app/ui/iptv.py @@ -223,7 +223,7 @@ class SearchUnavailableDialog: return future.result() self._download_task = False - self._dialog.destroy() + self.on_close() def get_unavailable(self, row): if not self._download_task: @@ -252,7 +252,8 @@ class SearchUnavailableDialog: return self._to_delete if response not in (Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT) else False - def on_close(self, item, event=None): + @run_idle + def on_close(self, item=None, event=None): if self._download_task and show_dialog(DialogType.QUESTION, self._dialog) == Gtk.ResponseType.CANCEL: return self._download_task = False diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py index eee1813d..6235a127 100644 --- a/app/ui/main_app_window.py +++ b/app/ui/main_app_window.py @@ -522,6 +522,17 @@ class MainAppWindow: def on_view_popup_menu(self, menu, event): """ Shows popup menu for any view """ if event.get_event_type() == Gdk.EventType.BUTTON_PRESS and event.button == Gdk.BUTTON_SECONDARY: + name = Gtk.Buildable.get_name(menu) + if name == "services_popup_menu": + self.delete_selection(self._fav_view, self._bouquets_view) + self.on_view_focus(self._services_view, None) + elif name == "fav_popup_menu": + self.delete_selection(self._services_view, self._bouquets_view) + self.on_view_focus(self._fav_view, None) + elif name == "bouquets_popup_menu": + self.delete_selection(self._services_view, self._fav_view) + self.on_view_focus(self._bouquets_view, None) + menu.popup(None, None, None, None, event.button, event.time) @run_idle @@ -590,7 +601,7 @@ class MainAppWindow: except Exception as e: print(e) log("Append services error: " + str(e)) - show_dialog(DialogType.ERROR, self._main_window, "Reading data error!\n" + e) + show_dialog(DialogType.ERROR, self._main_window, "Reading data error!\n" + str(e)) else: if services: for srv in services: diff --git a/app/ui/main_window.glade b/app/ui/main_window.glade index 369167af..16e19c99 100644 --- a/app/ui/main_window.glade +++ b/app/ui/main_window.glade @@ -662,7 +662,7 @@ Author: Dmitriy Yefremov - + True False 1 @@ -672,13 +672,13 @@ Author: Dmitriy Yefremov True False - + True False True left_header_popover_menu - + True False find-location-symbolic @@ -692,7 +692,7 @@ Author: Dmitriy Yefremov - + True False @@ -704,14 +704,14 @@ Author: Dmitriy Yefremov - + True False True FTP-transfer - + True False network-transmit-receive @@ -725,14 +725,14 @@ Author: Dmitriy Yefremov - + True False True Save - + True False gtk-save @@ -746,7 +746,7 @@ Author: Dmitriy Yefremov - + True False @@ -758,13 +758,13 @@ Author: Dmitriy Yefremov - + True False True - + True False gtk-spell-check @@ -778,13 +778,13 @@ Author: Dmitriy Yefremov - + True False True - + True False gtk-find @@ -798,7 +798,7 @@ Author: Dmitriy Yefremov - + True False @@ -818,7 +818,7 @@ Author: Dmitriy Yefremov Parent lock On/Off Ctrl + L - + True False changes-prevent-symbolic