updating service background after edit

This commit is contained in:
DYefremov
2018-12-16 17:47:55 +03:00
parent 90bd9e0211
commit f39ddd4315
3 changed files with 15 additions and 8 deletions

View File

@@ -19,7 +19,7 @@ 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
from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, LOCKED_ICON, HIDE_ICON, IPTV_ICON, MOVE_KEYS, KeyboardKey, NEW_COLOR
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, \
@@ -55,10 +55,6 @@ class Application(Gtk.Application):
"fav_picon_popup_item", "fav_iptv_popup_item", "fav_copy_popup_item",
"bouquets_cut_popup_item", "bouquets_copy_popup_item", "bouquets_paste_popup_item")
# 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
def __init__(self, **kwargs):
super().__init__(**kwargs)
@@ -801,8 +797,7 @@ class Application(Gtk.Application):
if flags:
f_flags = list(filter(lambda x: x.startswith("f:"), flags.split(",")))
if f_flags and Flag.is_new(int(f_flags[0][2:])):
tooltip = "Marked as new"
background = self._NEW_COLOR
background = NEW_COLOR
s = srv + (tooltip, background)
itr = self._services_model.append(s)

View File

@@ -6,7 +6,7 @@ from app.eparser import Service
from app.eparser.ecommons import MODULATION, Inversion, ROLL_OFF, Pilot, Flag, Pids, POLARIZATION, \
get_key_by_value, get_value_by_name, FEC_DEFAULT, PLS_MODE, SERVICE_TYPE
from app.properties import Profile
from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, HIDE_ICON, TEXT_DOMAIN, CODED_ICON, Column
from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, HIDE_ICON, TEXT_DOMAIN, CODED_ICON, Column, NEW_COLOR
from .dialogs import show_dialog, DialogType, Action
from .main_helper import get_base_model
@@ -365,6 +365,14 @@ class ServiceDetailsDialog:
if self._old_service.picon_id != service.picon_id:
self.update_picon_name(self._old_service.picon_id, service.picon_id)
flags = service.flags_cas
extra_data = {Column.SRV_TOOLTIP.value: None, Column.SRV_BACKGROUND.value: None}
if flags:
f_flags = list(filter(lambda x: x.startswith("f:"), flags.split(",")))
if f_flags and Flag.is_new(int(f_flags[0][2:])):
extra_data[Column.SRV_BACKGROUND.value] = NEW_COLOR
self._current_model.set(self._current_itr, extra_data)
self._current_model.set(self._current_itr, {i: v for i, v in enumerate(service)})
self.update_fav_view(self._old_service, service)
self._old_service = service

View File

@@ -26,6 +26,10 @@ HIDE_ICON = theme.load_icon("go-jump", 16, 0) if theme.lookup_icon("go-jump", 16
TV_ICON = theme.load_icon("tv-symbolic", 16, 0) if theme.lookup_icon("tv-symbolic", 16, 0) else _IMAGE_MISSING
IPTV_ICON = theme.load_icon("emblem-shared", 16, 0) if theme.load_icon("emblem-shared", 16, 0) else None
# 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
class KeyboardKey(Enum):
""" The raw(hardware) codes of the keyboard keys """