added icons for fav list

This commit is contained in:
DYefremov
2017-12-01 22:58:01 +03:00
parent 1b007621cd
commit f0a1a49346
3 changed files with 55 additions and 20 deletions

View File

@@ -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)

View File

@@ -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:

View File

@@ -53,8 +53,14 @@
<columns>
<!-- column-name num -->
<column type="gint"/>
<!-- column-name fav_coded -->
<column type="GdkPixbuf"/>
<!-- column-name service -->
<column type="gchararray"/>
<!-- column-name fav_locked -->
<column type="GdkPixbuf"/>
<!-- column-name fav_hide -->
<column type="GdkPixbuf"/>
<!-- column-name type -->
<column type="gchararray"/>
<!-- column-name pos -->
@@ -764,7 +770,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">services_list_store</property>
<property name="search_column">2</property>
<property name="search_column">3</property>
<property name="rubber_banding">True</property>
<property name="enable_grid_lines">both</property>
<property name="activate_on_single_click">True</property>
@@ -972,7 +978,7 @@
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="pos_column1">
<object class="GtkTreeViewColumn" id="pos_column">
<property name="resizable">True</property>
<property name="title" translatable="yes">Pos</property>
<property name="expand">True</property>
@@ -1000,7 +1006,7 @@
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="fav_id_column">
<object class="GtkTreeViewColumn" id="service_fav_id_column">
<property name="visible">False</property>
<property name="title" translatable="yes">fav_id</property>
<child>
@@ -1040,12 +1046,11 @@
<property name="resize_mode">queue</property>
<property name="spacing">2</property>
<child>
<object class="GtkImage" id="image1">
<object class="GtkImage" id="cas_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">2</property>
<property name="icon_name">dialog-password-symbolic</property>
<property name="icon_name">gtk-dialog-authentication-panel</property>
</object>
<packing>
<property name="expand">False</property>
@@ -1202,7 +1207,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">fav_list_store</property>
<property name="search_column">1</property>
<property name="search_column">2</property>
<property name="rubber_banding">True</property>
<property name="enable_grid_lines">both</property>
<property name="activate_on_single_click">True</property>
@@ -1232,20 +1237,39 @@
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="service_column1">
<object class="GtkTreeViewColumn" id="fav_service_column">
<property name="resizable">True</property>
<property name="spacing">2</property>
<property name="title" translatable="yes">Service</property>
<property name="expand">True</property>
<child>
<object class="GtkCellRendererText" id="service_cellrenderertext1"/>
<object class="GtkCellRendererPixbuf" id="fav_coded_cellrendererpixbuf"/>
<attributes>
<attribute name="text">1</attribute>
<attribute name="pixbuf">1</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="fav_service_cellrenderertext"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererPixbuf" id="fav_locked_cellrendererpixbuf"/>
<attributes>
<attribute name="pixbuf">3</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererPixbuf" id="fav_hide_cellrendererpixbuf"/>
<attributes>
<attribute name="pixbuf">4</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="type_column1">
<object class="GtkTreeViewColumn" id="fav_type_column">
<property name="title" translatable="yes">Type</property>
<property name="expand">True</property>
<child>
@@ -1253,13 +1277,13 @@
<property name="xalign">0.50999999046325684</property>
</object>
<attributes>
<attribute name="text">2</attribute>
<attribute name="text">5</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="pos_column">
<object class="GtkTreeViewColumn" id="fav_pos_column">
<property name="title" translatable="yes">Pos</property>
<property name="expand">True</property>
<child>
@@ -1267,19 +1291,19 @@
<property name="xalign">0.50999999046325684</property>
</object>
<attributes>
<attribute name="text">3</attribute>
<attribute name="text">6</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="fav_id_column1">
<object class="GtkTreeViewColumn" id="fav_id_column">
<property name="visible">False</property>
<property name="title" translatable="yes">fav_id</property>
<child>
<object class="GtkCellRendererText" id="fav_id_cellrenderertext4"/>
<attributes>
<attribute name="text">4</attribute>
<attribute name="text">7</attribute>
</attributes>
</child>
</object>