From 4dcfde8b53110f59a575217de2aed4a54ea69b97 Mon Sep 17 00:00:00 2001 From: DYefremov Date: Wed, 12 Feb 2020 21:16:47 +0300 Subject: [PATCH] revert of get yt icon --- app/ui/iptv.py | 10 +++++++--- app/ui/uicommons.py | 5 +++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/ui/iptv.py b/app/ui/iptv.py index 5923fa41..d290be52 100644 --- a/app/ui/iptv.py +++ b/app/ui/iptv.py @@ -197,14 +197,14 @@ class IptvDialog: yt_id = YouTube.get_yt_id(url_str) if yt_id: - entry.set_icon_from_stock(Gtk.EntryIconPosition.SECONDARY, Gtk.STOCK_INFO) + entry.set_icon_from_pixbuf(Gtk.EntryIconPosition.SECONDARY, get_yt_icon("youtube", 32)) text = "Found a link to the YouTube resource!\nTry to get a direct link to the video?" if show_dialog(DialogType.QUESTION, self._dialog, text=text) == Gtk.ResponseType.OK: entry.set_sensitive(False) gen = self.set_yt_url(entry, yt_id) GLib.idle_add(lambda: next(gen, False), priority=GLib.PRIORITY_LOW) elif YouTube.is_yt_video_link(url_str): - entry.set_icon_from_stock(Gtk.EntryIconPosition.SECONDARY, Gtk.STOCK_INFO) + entry.set_icon_from_pixbuf(Gtk.EntryIconPosition.SECONDARY, get_yt_icon("youtube", 32)) else: entry.set_icon_from_stock(Gtk.EntryIconPosition.SECONDARY, None) self._yt_quality_box.set_visible(False) @@ -694,7 +694,11 @@ class YtListImportDialog: self._receive_button.set_sensitive(bool(yt_id)) self._import_button.set_sensitive(bool(yt_id)) self._yt_list_id = yt_id - entry.set_icon_from_stock(Gtk.EntryIconPosition.SECONDARY, Gtk.STOCK_INFO if yt_id else None) + + if yt_id: + entry.set_icon_from_pixbuf(Gtk.EntryIconPosition.SECONDARY, get_yt_icon("youtube", 32)) + else: + entry.set_icon_from_stock(Gtk.EntryIconPosition.SECONDARY, None) @run_idle def on_info_bar_close(self, bar=None, resp=None): diff --git a/app/ui/uicommons.py b/app/ui/uicommons.py index 5ace90fc..160c6b9c 100644 --- a/app/ui/uicommons.py +++ b/app/ui/uicommons.py @@ -59,7 +59,7 @@ DEFAULT_ICON = theme.load_icon("emblem-default", 16, 0) if theme.lookup_icon("em @lru_cache(maxsize=1) def get_yt_icon(icon_name, size=24): - """ Getting YouTube icon. If the icon is not found in the icon themes, the "Info" icon is returned by default! """ + """ Getting YouTube icon. If the icon is not found in the icon themes, the "APPLY" icon is returned by default! """ default_theme = Gtk.IconTheme.get_default() if default_theme.has_icon(icon_name): return default_theme.load_icon(icon_name, size, 0) @@ -72,7 +72,8 @@ def get_yt_icon(icon_name, size=24): if n_theme.has_icon(icon_name): return n_theme.load_icon(icon_name, size, 0) - return default_theme.load_icon("info", size, 0) + if default_theme.lookup_icon(Gtk.STOCK_APPLY, size, 0): + return default_theme.load_icon(Gtk.STOCK_APPLY, size, 0) class KeyboardKey(Enum):