Display picons in the fav list

This commit is contained in:
DYefremov
2018-01-29 14:46:34 +03:00
parent 25c9189e1a
commit a141c34ee7
3 changed files with 18 additions and 6 deletions

View File

@@ -103,6 +103,7 @@ class MainAppWindow:
self.__rows_buffer = []
self.__services = {}
self.__bouquets = {}
self.__picons = {}
self.__blacklist = set()
builder = Gtk.Builder()
@@ -619,7 +620,8 @@ class MainAppWindow:
channel = self.__services.get(ch_id, None)
if channel:
self.__fav_model.append((num + 1, channel.coded, channel.service, channel.locked,
channel.hide, channel.service_type, channel.pos, channel.fav_id))
channel.hide, channel.service_type, channel.pos, channel.fav_id,
self.__picons.get(channel.picon_id, None)))
def is_bouquet_selected(self):
""" Checks whether the bouquet is selected
@@ -852,10 +854,12 @@ class MainAppWindow:
if not os.path.exists(path):
return
picons = {file: GdkPixbuf.Pixbuf.new_from_file_at_scale(
filename=path + file, width=32, height=24, preserve_aspect_ratio=True) for file in os.listdir(path)}
for row in self.__services_model:
self.__services_model.set_value(self.__services_model.get_iter(row.path), 8, picons.get(row[9], None))
for file in os.listdir(path):
self.__picons[file] = GdkPixbuf.Pixbuf.new_from_file_at_scale(
filename=path + file, width=32, height=24, preserve_aspect_ratio=True)
for r in self.__services_model:
self.__services_model.set_value(self.__services_model.get_iter(r.path), 8, self.__picons.get(r[9], None))
def start_app():

View File

@@ -34,7 +34,7 @@ def insert_marker(view, bouquets, selected_bouquet, channels, parent_window):
fav_id = "1:64:{}:0:0:0:0:0:0:0::{}\n#DESCRIPTION {}\n".format(max_num, response, response)
s_type = BqServiceType.MARKER.name
model, paths = view.get_selection().get_selected_rows()
itr = model.insert_before(model.get_iter(paths[0]), (None, None, response, None, None, s_type, None, fav_id))
itr = model.insert_before(model.get_iter(paths[0]), (None, None, response, None, None, s_type, None, fav_id, None))
channels[fav_id] = Service(None, None, None, response, None, None, None, s_type, *[None] * 9, max_num, fav_id, None)
bouquets[selected_bouquet].insert(model.get_path(itr)[0], fav_id)

View File

@@ -71,6 +71,8 @@
<column type="gchararray"/>
<!-- column-name fav_id -->
<column type="gchararray"/>
<!-- column-name picon -->
<column type="GdkPixbuf"/>
</columns>
<signal name="row-deleted" handler="on_model_changed" swapped="no"/>
<signal name="row-inserted" handler="on_model_changed" swapped="no"/>
@@ -1499,6 +1501,12 @@
<property name="sizing">autosize</property>
<property name="title" translatable="yes">Service</property>
<property name="expand">True</property>
<child>
<object class="GtkCellRendererPixbuf" id="fav_picon_cellrendererpixbuf"/>
<attributes>
<attribute name="pixbuf">8</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererPixbuf" id="fav_coded_cellrendererpixbuf"/>
<attributes>