From f0a1a4934694cd203eecff71dcb6812d4373d59a Mon Sep 17 00:00:00 2001 From: DYefremov Date: Fri, 1 Dec 2017 22:58:01 +0300 Subject: [PATCH] added icons for fav list --- app/ui/__init__.py | 2 +- app/ui/main_app_window.py | 17 +++++++++--- app/ui/main_window.glade | 56 ++++++++++++++++++++++++++++----------- 3 files changed, 55 insertions(+), 20 deletions(-) diff --git a/app/ui/__init__.py b/app/ui/__init__.py index 1092480d..749cd9b3 100644 --- a/app/ui/__init__.py +++ b/app/ui/__init__.py @@ -3,7 +3,7 @@ import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, Gdk -CODED_ICON = Gtk.IconTheme.get_default().load_icon("emblem-readonly", 16, 0) +CODED_ICON = Gtk.IconTheme.get_default().load_icon("gtk-dialog-authentication-panel", 16, 0) LOCKED_ICON = Gtk.IconTheme.get_default().load_icon("system-lock-screen", 16, 0) HIDE_ICON = Gtk.IconTheme.get_default().load_icon("go-jump", 16, 0) TV_ICON = Gtk.IconTheme.get_default().load_icon("tv-symbolic", 16, 0) diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py index 61b6836c..60ee5d04 100644 --- a/app/ui/main_app_window.py +++ b/app/ui/main_app_window.py @@ -532,7 +532,8 @@ class MainAppWindow: for num, ch_id in enumerate(services): channel = self.__channels.get(ch_id, None) if channel: - self.__fav_model.append((num + 1, channel.service, channel.service_type, channel.pos, channel.fav_id)) + self.__fav_model.append((num + 1, channel.coded, channel.service, channel.locked, + channel.hide, channel.service_type, channel.pos, channel.fav_id)) def is_bouquet_selected(self): """ Checks whether the bouquet is selected @@ -622,7 +623,7 @@ class MainAppWindow: for elem in self._BOUQUET_ELEMENTS: self.__tool_elements[elem].set_sensitive(False) for elem in self._LOCK_HIDE_ELEMENTS: - self.__tool_elements[elem].set_sensitive(not_empty) + self.__tool_elements[elem].set_sensitive(not_empty and is_service) for elem in self._REMOVE_ELEMENTS: self.__tool_elements[elem].set_sensitive(not_empty) @@ -647,16 +648,26 @@ class MainAppWindow: flags = {*model.get_value(itr, 0).split(",")} flags.discard(FLAG.HIDE.value) if hide else flags.add(FLAG.HIDE.value) model.set_value(itr, 0, (",".join(reversed(sorted(flags))))) + fav_id = model.get_value(itr, 16) + channel = self.__channels.get(fav_id, None) + if channel: + self.__channels[fav_id] = Channel(*channel[:5], None if hide else HIDE_ICON, *channel[6:]) elif flag is FLAG.LOCK: col_num = 4 locked = self.has_locked_hide(model, paths, col_num) for path in paths: itr = model.get_iter(path) - channel = self.__channels.get(model.get_value(itr, 16), None) + fav_id = model.get_value(itr, 16) + channel = self.__channels.get(fav_id, None) if channel: bq_id = to_bouquet_id(channel) self.__blacklist.discard(bq_id) if locked else self.__blacklist.add(bq_id) model.set_value(itr, col_num, None) if locked else model.set_value(itr, col_num, LOCKED_ICON) + self.__channels[fav_id] = Channel(*channel[:4], None if locked else LOCKED_ICON, *channel[5:]) + bq_selected = self.is_bouquet_selected() + if bq_selected: + self.__fav_model.clear() + self.update_bouquet_channels(self.__fav_model, None, bq_selected) def has_locked_hide(self, model, paths, col_num): for path in paths: diff --git a/app/ui/main_window.glade b/app/ui/main_window.glade index a2cc2882..4978d646 100644 --- a/app/ui/main_window.glade +++ b/app/ui/main_window.glade @@ -53,8 +53,14 @@ + + + + + + @@ -764,7 +770,7 @@ True True services_list_store - 2 + 3 True both True @@ -972,7 +978,7 @@ - + True Pos True @@ -1000,7 +1006,7 @@ - + False fav_id @@ -1040,12 +1046,11 @@ queue 2 - + True False 5 - 2 - dialog-password-symbolic + gtk-dialog-authentication-panel False @@ -1202,7 +1207,7 @@ True True fav_list_store - 1 + 2 True both True @@ -1232,20 +1237,39 @@ - + True + 2 Service True - + - 1 + 1 + + + + + + 2 + + + + + + 3 + + + + + + 4 - + Type True @@ -1253,13 +1277,13 @@ 0.50999999046325684 - 2 + 5 - + Pos True @@ -1267,19 +1291,19 @@ 0.50999999046325684 - 3 + 6 - + False fav_id - 4 + 7