From 0a06b36f60ac25df15f978bad242b4f7726da281 Mon Sep 17 00:00:00 2001 From: DYefremov Date: Sun, 23 Dec 2018 16:15:48 +0300 Subject: [PATCH] setting background color for the services --- app/properties.py | 3 +- app/ui/main_app_window.py | 65 ++- app/ui/main_window.glade | 38 +- app/ui/service_details_dialog.py | 7 +- app/ui/settings_dialog.glade | 733 ++++++++++++++++--------------- app/ui/settings_dialog.py | 63 ++- app/ui/uicommons.py | 4 +- 7 files changed, 514 insertions(+), 399 deletions(-) diff --git a/app/properties.py b/app/properties.py index 6acb786f..cebda5fb 100644 --- a/app/properties.py +++ b/app/properties.py @@ -45,7 +45,8 @@ def get_default_settings(): "services_path": "/etc/enigma2/", "user_bouquet_path": "/etc/enigma2/", "satellites_xml_path": "/etc/tuxbox/", "data_dir_path": DATA_PATH + "enigma2/", "picons_path": "/usr/share/enigma2/picon", "picons_dir_path": DATA_PATH + "enigma2/picons/", - "v5_support": False, "http_api_support": False}, + "v5_support": False, "http_api_support": False, + "use_colors": True, "new_color": "rgb(255,230,204)", "extra_color": "rgb(179,230,204)"}, Profile.NEUTRINO_MP.value: { "host": "127.0.0.1", "port": "21", "user": "root", "password": "root", "http_user": "", "http_password": "", "http_port": "80", "http_timeout": 2, diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py index 3e1bfa41..cb5abeff 100644 --- a/app/ui/main_app_window.py +++ b/app/ui/main_app_window.py @@ -21,8 +21,8 @@ from app.ui.backup import BackupDialog 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, EXTRA_COLOR, Column +from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, LOCKED_ICON, HIDE_ICON, IPTV_ICON, MOVE_KEYS, KeyboardKey, Column, \ + EXTRA_COLOR, 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, \ @@ -166,6 +166,10 @@ class Application(Gtk.Application): # http api self._http_api = None self._monitor_signal = False + # Colors + self._use_colors = False + self._NEW_COLOR = None # Color for new services in the main list + self._EXTRA_COLOR = None # Color for services with a extra name for the bouquet builder = Gtk.Builder() builder.set_translation_domain("demon-editor") @@ -199,7 +203,6 @@ class Application(Gtk.Application): # Status bar self._ip_label = builder.get_object("ip_label") self._ip_label.set_text(self._options.get(self._profile).get("host")) - self.update_profile_label() self._receiver_info_box = builder.get_object("receiver_info_box") self._receiver_info_label = builder.get_object("receiver_info_label") self._signal_box = builder.get_object("signal_box") @@ -213,7 +216,6 @@ class Application(Gtk.Application): self._tv_count_label = builder.get_object("tv_count_label") self._radio_count_label = builder.get_object("radio_count_label") self._data_count_label = builder.get_object("data_count_label") - self.init_drag_and_drop() # drag and drop # Force ctrl press event for view. Multiple selections in lists only with Space key(as in file managers)!!! self._services_view.connect("key-press-event", self.force_ctrl) self._fav_view.connect("key-press-event", self.force_ctrl) @@ -239,6 +241,9 @@ class Application(Gtk.Application): def do_startup(self): Gtk.Application.do_startup(self) + self.update_profile_label() + self.init_drag_and_drop() + self.init_colors() self.init_http_api() def do_activate(self): @@ -275,6 +280,44 @@ class Application(Gtk.Application): self._bouquets_view.drag_dest_add_text_targets() self._bouquets_view.drag_source_add_text_targets() + def init_colors(self, update=False): + """ Initialisation of background colors for the services. + + If update=False - first call on program start, else - after options changes! + """ + profile = Profile(self._profile) + if profile is Profile.ENIGMA_2: + opts = self._options.get(self._profile) + self._use_colors = opts.get("use_colors", False) + if self._use_colors: + new_rgb = Gdk.RGBA() + extra_rgb = Gdk.RGBA() + new_rgb = new_rgb if new_rgb.parse(opts.get("new_color", NEW_COLOR)) else None + extra_rgb = extra_rgb if extra_rgb.parse(opts.get("extra_color", EXTRA_COLOR)) else None + if update: + gen = self.update_background_colors(new_rgb, extra_rgb) + GLib.idle_add(lambda: next(gen, False), priority=GLib.PRIORITY_LOW) + else: + self._NEW_COLOR = new_rgb + self._EXTRA_COLOR = extra_rgb + + def update_background_colors(self, new_color, extra_color): + if extra_color != self._EXTRA_COLOR: + for row in self._fav_model: + if row[Column.FAV_BACKGROUND]: + row[Column.FAV_BACKGROUND] = extra_color + yield True + + if new_color != self._NEW_COLOR: + for row in self._services_model: + if row[Column.SRV_BACKGROUND]: + row[Column.SRV_BACKGROUND] = new_color + yield True + + self._NEW_COLOR = new_color + self._EXTRA_COLOR = extra_color + yield True + def force_ctrl(self, view, event): """ Function for force ctrl press event for view """ event.state |= Gdk.ModifierType.CONTROL_MASK @@ -799,15 +842,14 @@ class Application(Gtk.Application): GLib.idle_add(lambda: next(gen, False), priority=GLib.PRIORITY_LOW) def append_services_data(self, services): - profile = Profile(self._profile) for srv in services: tooltip, background = None, None - if profile is Profile.ENIGMA_2: + if self._use_colors: flags = srv.flags_cas 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:])): - background = NEW_COLOR + background = self._NEW_COLOR s = srv + (tooltip, background) itr = self._services_model.append(s) @@ -945,7 +987,7 @@ 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 + tooltip, background = None, self._EXTRA_COLOR if self._use_colors and 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), tooltip, background)) @@ -995,6 +1037,7 @@ class Application(Gtk.Application): self.update_services_counts() self.update_profile_label() + self.init_colors(True) self.init_http_api() def on_tree_view_key_press(self, view, event): @@ -1568,6 +1611,7 @@ class Application(Gtk.Application): self._services, self._bouquets.get(self._bq_selected, None), Profile(self._profile), + self._NEW_COLOR, Action.EDIT).show() self.on_locate_in_services(view) @@ -1576,7 +1620,8 @@ class Application(Gtk.Application): self._services_view, self._fav_view, self._services, - self._bouquets) + self._bouquets, + self._NEW_COLOR) dialog.show() def on_services_add_new(self, item): @@ -1648,7 +1693,7 @@ class Application(Gtk.Application): self._extra_bouquets[self._bq_selected] = {fav_id: response} model.set(model.get_iter(paths), {Column.FAV_SERVICE: response, Column.FAV_TOOLTIP: None, - Column.FAV_BACKGROUND: EXTRA_COLOR}) + Column.FAV_BACKGROUND: self._EXTRA_COLOR}) def on_set_default_name_for_bouquet(self, item): selection = get_selection(self._fav_view, self._main_window) diff --git a/app/ui/main_window.glade b/app/ui/main_window.glade index c7e1576c..68f8fb81 100644 --- a/app/ui/main_window.glade +++ b/app/ui/main_window.glade @@ -209,7 +209,7 @@ Author: Dmitriy Yefremov - + @@ -919,7 +919,7 @@ Author: Dmitriy Yefremov - + @@ -1741,6 +1741,7 @@ Author: Dmitriy Yefremov 2 + 21 2 @@ -1750,7 +1751,7 @@ Author: Dmitriy Yefremov 25 - 21 + 21 3 @@ -1759,6 +1760,7 @@ Author: Dmitriy Yefremov 2 + 21 4 @@ -1767,6 +1769,7 @@ Author: Dmitriy Yefremov 2 + 21 5 @@ -1786,6 +1789,7 @@ Author: Dmitriy Yefremov 15 + 21 6 @@ -1804,6 +1808,7 @@ Author: Dmitriy Yefremov 0.51999998092651367 + 21 7 @@ -1817,6 +1822,7 @@ Author: Dmitriy Yefremov + 21 8 @@ -1848,6 +1854,7 @@ Author: Dmitriy Yefremov 0.50999999046325684 + 21 10 @@ -1866,6 +1873,7 @@ Author: Dmitriy Yefremov 0.50999999046325684 + 21 11 @@ -1884,6 +1892,7 @@ Author: Dmitriy Yefremov 0.50999999046325684 + 21 12 @@ -1902,6 +1911,7 @@ Author: Dmitriy Yefremov 0.50999999046325684 + 21 13 @@ -1920,6 +1930,7 @@ Author: Dmitriy Yefremov 0.50999999046325684 + 21 14 @@ -1938,6 +1949,7 @@ Author: Dmitriy Yefremov 0.50999999046325684 + 21 15 @@ -1955,6 +1967,7 @@ Author: Dmitriy Yefremov 0.50999999046325684 + 21 16 @@ -2007,10 +2020,7 @@ Author: Dmitriy Yefremov - - - 21 - + @@ -2240,6 +2250,7 @@ Author: Dmitriy Yefremov 5 + 10 0 @@ -2256,6 +2267,7 @@ Author: Dmitriy Yefremov 2 + 10 8 @@ -2264,6 +2276,7 @@ Author: Dmitriy Yefremov 2 + 10 1 @@ -2273,7 +2286,7 @@ Author: Dmitriy Yefremov 25 - 10 + 10 2 @@ -2282,6 +2295,7 @@ Author: Dmitriy Yefremov 2 + 10 3 @@ -2290,6 +2304,7 @@ Author: Dmitriy Yefremov 2 + 10 4 @@ -2306,6 +2321,7 @@ Author: Dmitriy Yefremov 0.50999999046325684 + 10 5 @@ -2321,6 +2337,7 @@ Author: Dmitriy Yefremov 0.50999999046325684 + 10 6 @@ -2349,10 +2366,7 @@ Author: Dmitriy Yefremov - - - 10 - + diff --git a/app/ui/service_details_dialog.py b/app/ui/service_details_dialog.py index b9c725f9..89392e59 100644 --- a/app/ui/service_details_dialog.py +++ b/app/ui/service_details_dialog.py @@ -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, NEW_COLOR +from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, HIDE_ICON, TEXT_DOMAIN, CODED_ICON, Column from .dialogs import show_dialog, DialogType, Action from .main_helper import get_base_model @@ -31,7 +31,7 @@ class ServiceDetailsDialog: _DIGIT_ENTRY_NAME = "digit-entry" - def __init__(self, transient, options, srv_view, fav_view, services, bouquets, action=Action.EDIT): + def __init__(self, transient, options, srv_view, fav_view, services, bouquets, new_color, action=Action.EDIT): handlers = {"on_system_changed": self.on_system_changed, "on_save": self.on_save, "on_create_new": self.on_create_new, @@ -58,6 +58,7 @@ class ServiceDetailsDialog: self._old_service = None self._services = services self._bouquets = bouquets + self._new_color = new_color self._transponder_services_iters = None self._current_model = None self._current_itr = None @@ -370,7 +371,7 @@ class ServiceDetailsDialog: 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] = NEW_COLOR + extra_data[Column.SRV_BACKGROUND] = self._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)}) diff --git a/app/ui/settings_dialog.glade b/app/ui/settings_dialog.glade index 6ff2554d..5d7ef959 100644 --- a/app/ui/settings_dialog.glade +++ b/app/ui/settings_dialog.glade @@ -33,11 +33,6 @@ Author: Dmitriy Yefremov - - True - False - gtk-revert-to-saved - 1 10 @@ -61,7 +56,7 @@ Author: Dmitriy Yefremov True center - + True False Options @@ -69,35 +64,21 @@ Author: Dmitriy Yefremov 2 True - + + 48 True - False + True + True + Ok + True - - 48 + True - True - True - Ok - True - - - True - False - gtk-apply - - + False + gtk-apply - - False - True - 2 - - - 1 - @@ -119,6 +100,31 @@ Author: Dmitriy Yefremov 2 + + + True + True + True + Reset profile + end + 5 + 5 + 5 + True + + + + True + False + gtk-revert-to-saved + + + + + end + 2 + + @@ -140,7 +146,7 @@ Author: Dmitriy Yefremov False False - 0 + 2 @@ -169,8 +175,8 @@ Author: Dmitriy Yefremov True False - 10 - 10 + 6 + 5 5 vertical @@ -225,88 +231,6 @@ Author: Dmitriy Yefremov 0 - - - True - False - - - True - False - center - settings_stack - - - False - True - 0 - - - - - True - False - - - - - - True - True - 1 - - - - - True - False - - - False - True - 2 - - - - - Test - 110 - True - True - True - Test connection - test_button_image - True - - - - False - True - end - 3 - - - - - True - False - - - - - - True - True - 4 - - - - - False - True - 1 - - True @@ -403,6 +327,98 @@ Author: Dmitriy Yefremov FTP + + + True + False + 2 + 5 + 2 + 2 + + + True + False + Login: + + + 0 + 0 + + + + + True + False + Password: + + + 1 + 0 + + + + + True + True + True + avatar-default-symbolic + + + 0 + 1 + + + + + True + False + Port: + + + 2 + 0 + + + + + True + True + 5 + 6 + 6 + 80 + network-workgroup-symbolic + + + 2 + 1 + + + + + True + True + True + False + + root + emblem-readonly + False + password + + + 1 + 1 + + + + + http + HTTP + 1 + + True @@ -519,99 +535,89 @@ Author: Dmitriy Yefremov telnet Telnet + 2 + + + + + False + True + 1 + + + + + True + False + + + True + False + center + settings_stack + + + False + True + 0 + + + + + True + False + + + + + + True + True 1 - + + True + False + + + False + True + 2 + + + + + Test + 110 + True + True + True + Test connection + test_button_image + True + + + + False + True + end + 3 + + + + True False - 2 - 5 - 2 - 2 - - True - False - Login: - - - 0 - 0 - - - - - True - False - Password: - - - 1 - 0 - - - - - True - True - True - avatar-default-symbolic - - - 0 - 1 - - - - - True - False - Port: - - - 2 - 0 - - - - - True - True - 5 - 6 - 6 - 80 - network-workgroup-symbolic - - - 2 - 1 - - - - - True - True - True - False - - root - emblem-readonly - False - password - - - 1 - 1 - + - http - HTTP - 2 + True + True + 4 @@ -701,8 +707,8 @@ Author: Dmitriy Yefremov True False - 10 - 10 + 5 + 5 5 vertical @@ -837,7 +843,6 @@ Author: Dmitriy Yefremov True False - 5 0.019999999552965164 in @@ -929,7 +934,7 @@ Author: Dmitriy Yefremov - + True False vertical @@ -937,9 +942,9 @@ Author: Dmitriy Yefremov True False - 10 - 10 - 5 + 5 + 5 + 5 0.019999999552965164 in @@ -958,7 +963,6 @@ Author: Dmitriy Yefremov True False center - 5 True neutrino_radio_button @@ -971,13 +975,11 @@ Author: Dmitriy Yefremov - Neutrino-MP -(experimental) + Neutrino-MP(experimental) True True False center - 5 True enigma_radio_button @@ -1004,29 +1006,167 @@ Author: Dmitriy Yefremov - + True + False False - 10 - 10 - 10 - 0.019999999552965164 - in + 5 + vertical - + True False - vertical + 5 + 5 + 5 + 0 + in - + True False + 5 + 5 + 5 + vertical + + + True + False + 10 + 5 + + + True + False + Set background color for the services + 1 + + + True + True + 1 + + + + + True + True + + + + False + True + end + 2 + + + + + False + False + 0 + + + + + True + False + False + 5 + 5 + 5 + 5 + + + True + False + Marked as new: + 1 + + + 0 + 0 + + + + + True + True + True + True + + + 1 + 0 + + + + + True + False + With an extra name in the bouquet: + 1 + + + 0 + 1 + + + + + True + True + True + True + + + 1 + 1 + + + + + False + True + 1 + + + + + + + + + + + + + True + True + 0 + + + + + True + False + 5 + 5 + 0.019999999552965164 + in + + + True + False + center + start 10 10 - 5 - 5 + 10 5 - 10 + 50 + True Ver. 5 support @@ -1056,147 +1196,23 @@ Author: Dmitriy Yefremov - - False - True - 0 - - - + + True False - 10 - 10 - 10 - 5 - - - True - False - Set text color for the services - 1 - - - True - True - 1 - - - - - True - True - - - False - True - end - 2 - - + Extra: - - False - False - 1 - - - - - True - False - False - 5 - 5 - 5 - 5 - 5 - 5 - - - True - False - Marked as new: - 1 - - - 0 - 0 - - - - - True - True - True - True - - - 1 - 0 - - - - - True - False - With an extra name in the bouquet: - 1 - - - 0 - 1 - - - - - True - True - True - True - - - 1 - 1 - - - - - False - True - 3 - - - - - Reset profile - True - True - True - end - 5 - 5 - 5 - reset_image - True - - - - False - True - end - 3 - + + True + True + 1 + - - - True - False - Extra: - + + @@ -1207,8 +1223,8 @@ Author: Dmitriy Yefremov - profile - Profile + program + Program 2 @@ -1223,9 +1239,12 @@ Author: Dmitriy Yefremov False True - 1 + 0 + + + diff --git a/app/ui/settings_dialog.py b/app/ui/settings_dialog.py index 5c5a59b5..97322e6c 100644 --- a/app/ui/settings_dialog.py +++ b/app/ui/settings_dialog.py @@ -1,9 +1,12 @@ from enum import Enum +from gi.repository import Gdk + from app.commons import run_task, run_idle from app.connections import test_telnet, test_ftp, TestException, test_http from app.properties import write_config, Profile, get_default_settings -from .uicommons import Gtk, UI_RESOURCES_PATH, TEXT_DOMAIN +from app.ui.dialogs import get_message +from .uicommons import Gtk, UI_RESOURCES_PATH, TEXT_DOMAIN, NEW_COLOR, EXTRA_COLOR from .main_helper import update_entry_data @@ -26,7 +29,8 @@ class SettingsDialog: "on_reset": self.on_reset, "apply_settings": self.apply_settings, "on_connection_test": self.on_connection_test, - "on_info_bar_close": self.on_info_bar_close} + "on_info_bar_close": self.on_info_bar_close, + "on_set_color_switch_state": self.on_set_color_switch_state} builder = Gtk.Builder() builder.set_translation_domain(TEXT_DOMAIN) @@ -35,6 +39,8 @@ class SettingsDialog: self._dialog = builder.get_object("settings_dialog") self._dialog.set_transient_for(transient) + self._header_bar = builder.get_object("header_bar") + # Network self._host_field = builder.get_object("host_field") self._port_field = builder.get_object("port_field") self._login_field = builder.get_object("login_field") @@ -46,28 +52,41 @@ class SettingsDialog: self._telnet_password_field = builder.get_object("telnet_password_field") self._telnet_port_field = builder.get_object("telnet_port_field") self._telnet_timeout_spin_button = builder.get_object("telnet_timeout_spin_button") + self._settings_stack = builder.get_object("settings_stack") + # Paths self._services_field = builder.get_object("services_field") self._user_bouquet_field = builder.get_object("user_bouquet_field") self._satellites_xml_field = builder.get_object("satellites_xml_field") self._data_dir_field = builder.get_object("data_dir_field") self._picons_field = builder.get_object("picons_field") self._picons_dir_field = builder.get_object("picons_dir_field") + # Info bar + self._info_bar = builder.get_object("info_bar") + self._message_label = builder.get_object("info_bar_message_label") + self._test_spinner = builder.get_object("test_spinner") + # Profile self._enigma_radio_button = builder.get_object("enigma_radio_button") self._neutrino_radio_button = builder.get_object("neutrino_radio_button") self._support_ver5_check_button = builder.get_object("support_ver5_check_button") self._support_http_api_check_button = builder.get_object("support_http_api_check_button") - self._settings_stack = builder.get_object("settings_stack") - self._info_bar = builder.get_object("info_bar") - self._message_label = builder.get_object("info_bar_message_label") - self._test_spinner = builder.get_object("test_spinner") + # Program + self._program_box = builder.get_object("program_box") + self._colors_grid = builder.get_object("colors_grid") + self._set_color_switch = builder.get_object("set_color_switch") + self._new_color_button = builder.get_object("new_color_button") + self._extra_color_button = builder.get_object("extra_color_button") + # Options self._options = options self._active_profile = options.get("profile") self.set_settings() - profile = Profile(self._active_profile) + self.init_ui_elements(Profile(self._active_profile)) + + def init_ui_elements(self, profile): + is_enigma_profile = profile is Profile.ENIGMA_2 self._neutrino_radio_button.set_active(profile is Profile.NEUTRINO_MP) - self._support_ver5_check_button.set_sensitive(profile is not Profile.NEUTRINO_MP) - self._support_http_api_check_button.set_sensitive(profile is not Profile.NEUTRINO_MP) - self._settings_stack.get_child_by_name(Property.HTTP.value).set_visible(profile is not Profile.NEUTRINO_MP) + self._settings_stack.get_child_by_name(Property.HTTP.value).set_visible(is_enigma_profile) + self._program_box.set_sensitive(is_enigma_profile) + self.update_subtitle(profile) def show(self): response = self._dialog.run() @@ -85,10 +104,13 @@ class SettingsDialog: def on_profile_changed(self, item): profile = Profile.ENIGMA_2 if self._enigma_radio_button.get_active() else Profile.NEUTRINO_MP - self._settings_stack.get_child_by_name(Property.HTTP.value).set_visible(profile is not Profile.NEUTRINO_MP) - self.set_profile(profile) - self._support_ver5_check_button.set_sensitive(profile is Profile.ENIGMA_2) - self._support_http_api_check_button.set_sensitive(profile is Profile.ENIGMA_2) + self._active_profile = profile.value + self.set_settings() + self.init_ui_elements(profile) + + def update_subtitle(self, profile): + sub = "{} Enigma2" if profile is Profile.ENIGMA_2 else "{} Neutrino-MP" + self._header_bar.set_subtitle(sub.format(get_message("Profile:"))) def set_profile(self, profile): self._active_profile = profile.value @@ -127,6 +149,13 @@ class SettingsDialog: if Profile(self._active_profile) is Profile.ENIGMA_2: self._support_ver5_check_button.set_active(options.get("v5_support", False)) self._support_http_api_check_button.set_active(options.get("http_api_support", False)) + self._set_color_switch.set_active(options.get("use_colors", False)) + new_rgb = Gdk.RGBA() + new_rgb.parse(options.get("new_color", NEW_COLOR)) + extra_rgb = Gdk.RGBA() + extra_rgb.parse(options.get("extra_color", EXTRA_COLOR)) + self._new_color_button.set_rgba(new_rgb) + self._extra_color_button.set_rgba(extra_rgb) def apply_settings(self, item=None): profile = Profile.ENIGMA_2 if self._enigma_radio_button.get_active() else Profile.NEUTRINO_MP @@ -153,6 +182,9 @@ class SettingsDialog: if profile is Profile.ENIGMA_2: options["v5_support"] = self._support_ver5_check_button.get_active() options["http_api_support"] = self._support_http_api_check_button.get_active() + options["use_colors"] = self._set_color_switch.get_active() + options["new_color"] = self._new_color_button.get_rgba().to_string() + options["extra_color"] = self._extra_color_button.get_rgba().to_string() write_config(self._options) @@ -214,6 +246,9 @@ class SettingsDialog: def on_info_bar_close(self, bar=None, resp=None): self._info_bar.set_visible(False) + def on_set_color_switch_state(self, switch, state): + self._colors_grid.set_sensitive(state) + if __name__ == "__main__": pass diff --git a/app/ui/uicommons.py b/app/ui/uicommons.py index c40e7330..2698762d 100644 --- a/app/ui/uicommons.py +++ b/app/ui/uicommons.py @@ -27,8 +27,8 @@ TV_ICON = theme.load_icon("tv-symbolic", 16, 0) if theme.lookup_icon("tv-symboli IPTV_ICON = theme.load_icon("emblem-shared", 16, 0) if theme.load_icon("emblem-shared", 16, 0) else None # Colors -NEW_COLOR = "#ff5c33" # Color for new services in the main list -EXTRA_COLOR = "#33adff" # Color for services with a extra name for the bouquet +NEW_COLOR = "rgb(255,230,204)" # Color for new services in the main list +EXTRA_COLOR = "rgb(179,230,204)" # Color for services with a extra name for the bouquet class KeyboardKey(Enum):