added background for extra names in fav list

This commit is contained in:
DYefremov
2018-12-16 22:44:45 +03:00
parent 9bf7a10bf1
commit 9d9626d065
3 changed files with 67 additions and 18 deletions

View File

@@ -19,7 +19,8 @@ from app.tools.media import Player
from .download_dialog import DownloadDialog
from .iptv import IptvDialog, SearchUnavailableDialog, IptvListConfigurationDialog
from .search import SearchProvider
from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, LOCKED_ICON, HIDE_ICON, IPTV_ICON, MOVE_KEYS, KeyboardKey, NEW_COLOR
from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, LOCKED_ICON, HIDE_ICON, IPTV_ICON, MOVE_KEYS, KeyboardKey, \
NEW_COLOR, EXTRA_COLOR, Column
from .dialogs import show_dialog, DialogType, get_chooser_dialog, WaitDialog, get_message
from .main_helper import insert_marker, move_items, rename, ViewTarget, set_flags, locate_in_services, \
scroll_to, get_base_model, update_picons_data, copy_picon_reference, assign_picon, remove_picon, \
@@ -238,6 +239,7 @@ class Application(Gtk.Application):
def do_activate(self):
self._main_window.set_application(self)
self._main_window.set_wmclass("DemonEditor", "DemonEditor")
self._main_window.present()
def do_shutdown(self):
@@ -311,7 +313,11 @@ class Application(Gtk.Application):
model, paths = view.get_selection().get_selected_rows()
if target is ViewTarget.FAV:
self._rows_buffer.extend((0, *model.get(model.get_iter(path), 2, 3, 4, 5, 7, 16, 18, 8)) for path in paths)
self._rows_buffer.extend((0, *model.get(model.get_iter(path), Column.SRV_CODED.value,
Column.SRV_SERVICE.value, Column.SRV_LOCKED.value,
Column.SRV_HIDE.value, Column.SRV_TYPE.value,
Column.SRV_POS.value, Column.SRV_FAV_ID.value,
Column.SRV_PICON.value), None, None) for path in paths)
elif target is ViewTarget.SERVICES:
self._rows_buffer.extend(model[path][:] for path in paths)
elif target is ViewTarget.BOUQUET:
@@ -647,17 +653,17 @@ class Application(Gtk.Application):
dest_index -= 1
for ext_row in ext_rows:
dest_index += 1
fav_id = ext_row[18]
fav_id = ext_row[Column.SRV_FAV_ID]
ch = self._services[fav_id]
model.insert(dest_index, (0, ch.coded, ch.service, ch.locked, ch.hide,
ch.service_type, ch.pos, ch.fav_id, self._picons.get(ch.picon_id, None)))
model.insert(dest_index, (0, ch.coded, ch.service, ch.locked, ch.hide, ch.service_type, ch.pos,
ch.fav_id, self._picons.get(ch.picon_id, None), None, None))
fav_bouquet.insert(dest_index, ch.fav_id)
elif source == self._FAV_LIST_NAME:
in_itrs = [model.get_iter_from_string(itr) for itr in itrs]
in_rows = [model[in_itr][:] for in_itr in in_itrs]
for row in in_rows:
model.insert(dest_index, row)
fav_bouquet.insert(dest_index, row[7])
fav_bouquet.insert(dest_index, row[Column.FAV_ID])
for in_itr in in_itrs:
del fav_bouquet[int(model.get_path(in_itr)[0])]
model.remove(in_itr)
@@ -859,7 +865,7 @@ class Application(Gtk.Application):
write_bouquets(path, bouquets, profile)
# Getting services
services_model = get_base_model(self._services_view.get_model())
services = [Service(*row[:]) for row in services_model]
services = [Service(*row[: Column.SRV_TOOLTIP]) for row in services_model]
write_services(path, services, profile, self.get_format_version() if profile is Profile.ENIGMA_2 else 0)
# removing bouquet files
if profile is Profile.ENIGMA_2:
@@ -932,9 +938,10 @@ class Application(Gtk.Application):
if ex_services:
ex_srv_name = ex_services.get(srv_id)
if srv:
tooltip, background = None, EXTRA_COLOR if ex_srv_name else None
self._fav_model.append((num + 1, srv.coded, ex_srv_name if ex_srv_name else srv.service, srv.locked,
srv.hide, srv.service_type, srv.pos, srv.fav_id,
self._picons.get(srv.picon_id, None)))
self._picons.get(srv.picon_id, None), tooltip, background))
yield True
def check_bouquet_selection(self):
@@ -1619,7 +1626,8 @@ class Application(Gtk.Application):
else:
self._extra_bouquets[self._bq_selected] = {fav_id: response}
model.set_value(model.get_iter(paths), 2, response)
model.set(model.get_iter(paths), {Column.FAV_SERVICE.value: response, Column.FAV_TOOLTIP.value: None,
Column.FAV_BACKGROUND.value: EXTRA_COLOR})
def on_set_default_name_for_bouquet(self, item):
selection = get_selection(self._fav_view, self._main_window)
@@ -1627,7 +1635,7 @@ class Application(Gtk.Application):
return
model, paths = selection
fav_id = model[paths][7]
fav_id = model[paths][Column.FAV_ID.value]
srv = self._services.get(fav_id, None)
ex_bq = self._extra_bouquets.get(self._bq_selected, None)
@@ -1641,7 +1649,8 @@ class Application(Gtk.Application):
if not ex_bq:
self._extra_bouquets.pop(self._bq_selected, None)
model.set_value(model.get_iter(paths), 2, srv.service)
model.set(model.get_iter(paths), {Column.FAV_SERVICE.value: srv.service, Column.FAV_TOOLTIP.value: None,
Column.FAV_BACKGROUND.value: None})
def on_locate_in_services(self, view):
locate_in_services(view, self._services_view, self._main_window)

View File

@@ -206,6 +206,10 @@ Author: Dmitriy Yefremov
<column type="gchararray"/>
<!-- column-name picon -->
<column type="GdkPixbuf"/>
<!-- column-name tooltip -->
<column type="gchararray"/>
<!-- column-name background -->
<column type="gchararray"/>
</columns>
<signal name="row-deleted" handler="on_model_changed" swapped="no"/>
<signal name="row-inserted" handler="on_model_changed" swapped="no"/>
@@ -1919,7 +1923,7 @@ Author: Dmitriy Yefremov
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="extra">
<object class="GtkTreeViewColumn" id="extra_column">
<property name="visible">False</property>
<property name="title" translatable="yes">extra</property>
<child>
@@ -2162,6 +2166,7 @@ Author: Dmitriy Yefremov
<property name="max_width_chars">5</property>
</object>
<attributes>
<attribute name="background">10</attribute>
<attribute name="text">0</attribute>
</attributes>
</child>
@@ -2170,19 +2175,24 @@ Author: Dmitriy Yefremov
<child>
<object class="GtkTreeViewColumn" id="fav_service_column">
<property name="resizable">True</property>
<property name="spacing">2</property>
<property name="min_width">50</property>
<property name="title" translatable="yes">Service</property>
<property name="expand">True</property>
<child>
<object class="GtkCellRendererPixbuf" id="fav_picon_cellrendererpixbuf"/>
<object class="GtkCellRendererPixbuf" id="fav_picon_cellrendererpixbuf">
<property name="xpad">2</property>
</object>
<attributes>
<attribute name="cell-background">10</attribute>
<attribute name="pixbuf">8</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererPixbuf" id="fav_coded_cellrendererpixbuf"/>
<object class="GtkCellRendererPixbuf" id="fav_coded_cellrendererpixbuf">
<property name="xpad">2</property>
</object>
<attributes>
<attribute name="cell-background">10</attribute>
<attribute name="pixbuf">1</attribute>
</attributes>
</child>
@@ -2192,18 +2202,25 @@ Author: Dmitriy Yefremov
<property name="width_chars">25</property>
</object>
<attributes>
<attribute name="background">10</attribute>
<attribute name="text">2</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererPixbuf" id="fav_locked_cellrendererpixbuf"/>
<object class="GtkCellRendererPixbuf" id="fav_locked_cellrendererpixbuf">
<property name="xpad">2</property>
</object>
<attributes>
<attribute name="cell-background">10</attribute>
<attribute name="pixbuf">3</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererPixbuf" id="fav_hide_cellrendererpixbuf"/>
<object class="GtkCellRendererPixbuf" id="fav_hide_cellrendererpixbuf">
<property name="xpad">2</property>
</object>
<attributes>
<attribute name="cell-background">10</attribute>
<attribute name="pixbuf">4</attribute>
</attributes>
</child>
@@ -2220,6 +2237,7 @@ Author: Dmitriy Yefremov
<property name="xalign">0.50999999046325684</property>
</object>
<attributes>
<attribute name="background">10</attribute>
<attribute name="text">5</attribute>
</attributes>
</child>
@@ -2235,6 +2253,7 @@ Author: Dmitriy Yefremov
<property name="xalign">0.50999999046325684</property>
</object>
<attributes>
<attribute name="background">10</attribute>
<attribute name="text">6</attribute>
</attributes>
</child>
@@ -2247,11 +2266,30 @@ Author: Dmitriy Yefremov
<child>
<object class="GtkCellRendererText" id="fav_id_cellrenderertext4"/>
<attributes>
<attribute name="background">10</attribute>
<attribute name="text">7</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="fav_extra_column">
<property name="visible">False</property>
<property name="title" translatable="yes">extra</property>
<child>
<object class="GtkCellRendererText" id="fav_tooltip_cellrenderertext"/>
<attributes>
<attribute name="text">9</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText" id="fav_background_cellrenderertext"/>
<attributes>
<attribute name="text">10</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>

View File

@@ -28,7 +28,7 @@ IPTV_ICON = theme.load_icon("emblem-shared", 16, 0) if theme.load_icon("emblem-s
# Colors
NEW_COLOR = "#ffe6cc" # Color for new services in the main list
EXTRA_COLOR = "#33a8ff" # Color for services with a extra name for the bouquet
EXTRA_COLOR = "#b3e6cc" # Color for services with a extra name for the bouquet
class KeyboardKey(Enum):
@@ -127,6 +127,8 @@ class Column(Enum):
FAV_POS = 6
FAV_ID = 7
FAV_PICON = 8
FAV_TOOLTIP = 9
FAV_BACKGROUND = 10
def __index__(self):
""" Overridden to get the index in slices directly """