From 5f669f4480861a05a606e5fbf7bfcf9d82d3d36f Mon Sep 17 00:00:00 2001 From: DYefremov Date: Fri, 12 Mar 2021 11:47:51 +0300 Subject: [PATCH] added new appearance options [list font, picons size] --- app/settings.py | 83 +- app/ui/main_app_window.py | 42 +- app/ui/main_helper.py | 4 +- app/ui/settings_dialog.glade | 2630 ++++++++++++++++++---------------- app/ui/settings_dialog.py | 61 +- app/ui/uicommons.py | 2 + 6 files changed, 1556 insertions(+), 1266 deletions(-) diff --git a/app/settings.py b/app/settings.py index a1c51809..890672ea 100644 --- a/app/settings.py +++ b/app/settings.py @@ -30,8 +30,11 @@ class Defaults(Enum): USE_COLORS = True NEW_COLOR = "rgb(255,230,204)" EXTRA_COLOR = "rgb(179,230,204)" + TOOLTIP_LOGO_SIZE = 96 + LIST_PICON_SIZE = 32 FAV_CLICK_MODE = 0 PLAY_STREAMS_MODE = 0 + STREAM_LIB = "gst" PROFILE_FOLDER_DEFAULT = False RECORDS_PATH = DATA_PATH + "records/" ACTIVATE_TRANSCODING = False @@ -436,6 +439,14 @@ class Settings: def play_streams_mode(self, value): self._settings["play_streams_mode"] = value + @property + def stream_lib(self): + return self._settings.get("stream_lib", Defaults.STREAM_LIB.value) + + @stream_lib.setter + def stream_lib(self, value): + self._settings["stream_lib"] = value + # *********** EPG ************ # @property @@ -513,30 +524,6 @@ class Settings: def enable_send_to(self, value): self._settings["enable_send_to"] = value - @property - def use_colors(self): - return self._settings.get("use_colors", Defaults.USE_COLORS.value) - - @use_colors.setter - def use_colors(self, value): - self._settings["use_colors"] = value - - @property - def new_color(self): - return self._settings.get("new_color", Defaults.NEW_COLOR.value) - - @new_color.setter - def new_color(self, value): - self._settings["new_color"] = value - - @property - def extra_color(self): - return self._settings.get("extra_color", Defaults.EXTRA_COLOR.value) - - @extra_color.setter - def extra_color(self, value): - self._settings["extra_color"] = value - @property def fav_click_mode(self): return self._settings.get("fav_click_mode", Defaults.FAV_CLICK_MODE.value) @@ -581,6 +568,54 @@ class Settings: # *********** Appearance *********** # + @property + def list_font(self): + return self._settings.get("list_font", "") + + @list_font.setter + def list_font(self, value): + self._settings["list_font"] = value + + @property + def list_picon_size(self): + return self._settings.get("list_picon_size", Defaults.LIST_PICON_SIZE.value) + + @list_picon_size.setter + def list_picon_size(self, value): + self._settings["list_picon_size"] = value + + @property + def tooltip_logo_size(self): + return self._settings.get("tooltip_logo_size", Defaults.TOOLTIP_LOGO_SIZE.value) + + @tooltip_logo_size.setter + def tooltip_logo_size(self, value): + self._settings["tooltip_logo_size"] = value + + @property + def use_colors(self): + return self._settings.get("use_colors", Defaults.USE_COLORS.value) + + @use_colors.setter + def use_colors(self, value): + self._settings["use_colors"] = value + + @property + def new_color(self): + return self._settings.get("new_color", Defaults.NEW_COLOR.value) + + @new_color.setter + def new_color(self, value): + self._settings["new_color"] = value + + @property + def extra_color(self): + return self._settings.get("extra_color", Defaults.EXTRA_COLOR.value) + + @extra_color.setter + def extra_color(self, value): + self._settings["extra_color"] = value + @property def dark_mode(self): return self._settings.get("dark_mode", False) diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py index b40ec0d6..8d728bb3 100644 --- a/app/ui/main_app_window.py +++ b/app/ui/main_app_window.py @@ -36,7 +36,7 @@ from .search import SearchProvider from .service_details_dialog import ServiceDetailsDialog, Action from .settings_dialog import show_settings_dialog from .uicommons import (Gtk, Gdk, UI_RESOURCES_PATH, LOCKED_ICON, HIDE_ICON, IPTV_ICON, MOVE_KEYS, KeyboardKey, Column, - FavClickMode, MOD_MASK) + FavClickMode, MOD_MASK, APP_FONT) class Application(Gtk.Application): @@ -206,7 +206,9 @@ class Application(Gtk.Application): self._links_transmitter = None self._control_box = None self._ftp_client = None - # Colors + # Appearance + self._current_font = APP_FONT + self._picons_size = self._settings.list_picon_size 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 @@ -399,7 +401,7 @@ class Application(Gtk.Application): self.update_profile_label() self.init_drag_and_drop() - self.init_colors() + self.init_appearance() if self._settings.load_last_config: config = self._settings.get("last_config") or {} @@ -601,11 +603,21 @@ class Application(Gtk.Application): self._fav_view.get_selection().set_select_function(lambda *args: self._select_enabled) self._bouquets_view.get_selection().set_select_function(lambda *args: self._select_enabled) - def init_colors(self, update=False): - """ Initialisation of background colors for the services. + def init_appearance(self, update=False): + """ Appearance initialisation. If update=False - first call on program start, else - after options changes! """ + if self._current_font != self._settings.list_font: + from gi.repository import Pango + + font_desc = Pango.FontDescription.from_string(self._settings.list_font) + list(map(lambda v: v.modify_font(font_desc), (self._services_view, self._fav_view, self._bouquets_view))) + self._current_font = self._settings.list_font + + if self._picons_size != self._settings.list_picon_size: + self.update_picons_size() + if self._s_type is SettingsType.ENIGMA_2: self._use_colors = self._settings.use_colors @@ -621,6 +633,15 @@ class Application(Gtk.Application): self._NEW_COLOR = new_rgb self._EXTRA_COLOR = extra_rgb + @run_idle + def update_picons_size(self): + self._picons_size = self._settings.list_picon_size + update_picons_data(self._settings.picons_local_path, self._picons, self._picons_size) + self._fav_model.foreach(lambda m, p, itr: m.set_value(itr, Column.FAV_PICON, self._picons.get( + self._services.get(m.get_value(itr, Column.FAV_ID)).picon_id, None))) + self._services_model.foreach(lambda m, p, itr: m.set_value(itr, Column.SRV_PICON, self._picons.get( + m.get_value(itr, Column.SRV_PICON_ID), None))) + def update_background_colors(self, new_color, extra_color): if extra_color != self._EXTRA_COLOR: for row in self._fav_model: @@ -1093,7 +1114,8 @@ class Application(Gtk.Application): target_column = Column.FAV_ID if target is ViewTarget.FAV else Column.SRV_FAV_ID srv = self._services.get(model[path][target_column], None) if srv and srv.picon_id: - tooltip.set_icon(get_picon_pixbuf(self._settings.picons_local_path + srv.picon_id, size=96)) + tooltip.set_icon(get_picon_pixbuf(self._settings.picons_local_path + srv.picon_id, + size=self._settings.tooltip_logo_size)) tooltip.set_text( self.get_hint_for_bq_list(srv) if target is ViewTarget.FAV else self.get_hint_for_srv_list(srv)) view.set_tooltip_row(tooltip, path) @@ -1576,7 +1598,7 @@ class Application(Gtk.Application): yield True services = get_services(data_path, prf, self.get_format_version() if prf is SettingsType.ENIGMA_2 else 0) yield True - update_picons_data(self._settings.picons_local_path, self._picons) + update_picons_data(self._settings.picons_local_path, self._picons, self._picons_size) yield True except FileNotFoundError as e: msg = get_message("Please, download files from receiver or setup your path for read data!") @@ -2002,7 +2024,7 @@ class Application(Gtk.Application): c_gen = self.clear_current_data() yield from c_gen - self.init_colors(True) + self.init_appearance(True) self.init_profiles() yield True gen = self.init_http_api() @@ -2569,7 +2591,7 @@ class Application(Gtk.Application): def on_player_box_realize(self, widget): if not self._player: try: - self._player = Player.make(name="gst", + self._player = Player.make(name=self._settings.stream_lib, mode=self._settings.play_streams_mode, widget=widget, buf_cb=self.on_player_duration_changed, @@ -3190,7 +3212,7 @@ class Application(Gtk.Application): @run_task def update_picons(self): - update_picons_data(self._settings.picons_local_path, self._picons) + update_picons_data(self._settings.picons_local_path, self._picons, self._picons_size) append_picons(self._picons, self._services_model) def on_assign_picon(self, view, src_path=None, dst_path=None): diff --git a/app/ui/main_helper.py b/app/ui/main_helper.py index 0badf19a..14a5a245 100644 --- a/app/ui/main_helper.py +++ b/app/ui/main_helper.py @@ -353,12 +353,12 @@ def scroll_to(index, view, paths=None): # ***************** Picons *********************# -def update_picons_data(path, picons): +def update_picons_data(path, picons, size=32): if not os.path.exists(path): return for file in os.listdir(path): - pf = get_picon_pixbuf(path + file) + pf = get_picon_pixbuf(path + file, size) if pf: picons[file] = pf diff --git a/app/ui/settings_dialog.glade b/app/ui/settings_dialog.glade index 7e31285a..6caae62e 100644 --- a/app/ui/settings_dialog.glade +++ b/app/ui/settings_dialog.glade @@ -28,11 +28,18 @@ Author: Dmitriy Yefremov --> + - + + + 8 + 100 + 1 + 10 + @@ -43,6 +50,87 @@ Author: Dmitriy Yefremov + + True + False + document-revert + + + True + False + emblem-default + + + True + False + + + gtk-add + True + False + True + True + + + + + + + gtk-edit + True + False + True + True + + + + + + + True + False + + + + + Set default + True + False + set_default_image + False + + + + + + + True + False + + + + + gtk-remove + True + False + True + True + + + + + + + 1 + 10 + 1 + 10 + + + True + False + gtk-connect + 680 False @@ -650,6 +738,7 @@ Author: Dmitriy Yefremov start center True + 3 @@ -1370,135 +1459,38 @@ Author: Dmitriy Yefremov - True - False - vertical - 5 - - True False - 5 + 5 + 5 5 - 0.019999999552965164 - in + vertical + 5 - + True False - 5 - vertical - 5 + 0.019999999552965164 + in - + True False 5 5 - 5 - 5 - 5 - - - True - False - 5 - Activate transcoding - - - False - True - 0 - - - - - True - True - - - False - True - end - 1 - - - - - True - True - 0 - - - - - True - False - False - 5 - 5 - 5 5 vertical 5 - + True False - 5 - 5 - 5 - 5 5 - + True False - start - Presets: - - - True - True - 0 - - - - - True - False - 720p TV/device - - 720p TV/device - 1080p TV/device - - - - - True - True - 1 - - - - - False - True - 0 - - - - - True - False - Edit - end - 5 - - - True - False - document-edit-symbolic + Activate transcoding False @@ -1507,7 +1499,7 @@ Author: Dmitriy Yefremov - + True True @@ -1522,138 +1514,445 @@ Author: Dmitriy Yefremov True True + 0 + + + + + True + False + False + vertical + 5 + + + True + False + 5 + + + True + False + start + Presets: + + + True + True + 0 + + + + + True + False + 720p TV/device + + 720p TV/device + 1080p TV/device + + + + + True + True + 1 + + + + + False + True + 0 + + + + + True + False + Edit + end + 5 + + + True + False + gtk-edit + + + False + True + 0 + + + + + True + True + + + False + True + end + 1 + + + + + True + True + 1 + + + + + True + False + False + 0.5 + in + + + True + False + center + 5 + 5 + 5 + 5 + 2 + 5 + + + True + True + number + + + + 0 + 1 + + + + + True + False + Bitrate (kb/s): + + + 0 + 0 + + + + + True + True + + + number + + + + 1 + 1 + + + + + True + False + Width (px): + + + 1 + 0 + + + + + True + False + Codec: + + + 3 + 0 + + + + + h264 + True + True + False + center + True + True + + + 3 + 1 + + + + + True + True + number + + + + 2 + 1 + + + + + True + False + Height (px): + + + 2 + 0 + + + + + + + True + False + Video options: + + + + + False + True + 2 + + + + + True + False + False + 0.5 + in + + + True + False + center + 5 + 5 + 5 + 5 + 2 + 5 + + + True + True + number + + + + 0 + 1 + + + + + True + False + Bitrate (kb/s): + + + 0 + 0 + + + + + True + False + Channels: + + + 1 + 0 + + + + + True + False + Codec: + + + 3 + 0 + + + + + True + False + Sample rate (Hz): + + + 2 + 0 + + + + + 75 + True + False + 2 + + 1 + 2 + + + + 1 + 1 + + + + + True + False + 44100 + + 8000 + 11025 + 22050 + 44100 + 48000 + + + + 2 + 1 + + + + + True + False + mp3 + + mp3 + AC3 + + + + 3 + 1 + + + + + + + True + False + Audio options: + + + + + False + True + 3 + + + + + True + True + 1 + + + + + + + True + False + Record to disk: + + + + + False + True + 0 + + + + + True + False + 0.019999999552965164 + in + + + True + False + center + 5 + 5 + 5 + 5 + + + Built-in player + True + True + False + True + True + get_m3u_radio_button + + + + False + True + 0 + + + + + In a separate window + True + True + False + True + True + get_m3u_radio_button + + + False + True 1 - + + Only get m3u file True - False - False - 5 - 5 - 5 - 5 - 0.5 - in - - - True - False - center - 5 - 5 - 2 - 5 - - - True - True - document-edit-symbolic - number - - - - 0 - 1 - - - - - True - False - Bitrate (kb/s): - - - 0 - 0 - - - - - True - True - - - document-edit-symbolic - number - - - - 1 - 1 - - - - - True - False - Width (px): - - - 1 - 0 - - - - - True - False - Codec: - - - 3 - 0 - - - - - h264 - True - True - False - center - True - True - - - 3 - 1 - - - - - True - True - document-edit-symbolic - number - - - - 2 - 1 - - - - - True - False - Height (px): - - - 2 - 0 - - - - - - - True - False - Video options: - - + True + False + True + True False @@ -1661,249 +1960,82 @@ Author: Dmitriy Yefremov 2 + + + + + True + False + Play streams mode: + + + + + False + True + 1 + + + + + True + False + 0.019999999552965164 + in + + + True + False + center + 5 + 5 - + + GStreamer True - False - False - 5 - 5 - 5 - 5 - 0.5 - in - - - True - False - center - 5 - 5 - 2 - 5 - - - True - True - document-edit-symbolic - number - - - - 0 - 1 - - - - - True - False - Bitrate (kb/s): - - - 0 - 0 - - - - - True - False - Channels: - - - 1 - 0 - - - - - True - False - Codec: - - - 3 - 0 - - - - - True - False - mp3 - - mp3 - AC3 - - - - 3 - 1 - - - - - True - False - Sample rate (Hz): - - - 2 - 0 - - - - - 75 - True - False - 2 - - 1 - 2 - - - - 1 - 1 - - - - - True - False - 44100 - - 8000 - 11025 - 22050 - 44100 - 48000 - - - - 2 - 1 - - - - - - - True - False - Audio options: - - + True + False + True + vlc_lib_button False True - 3 + 0 + + + + + VLC Player + True + True + False + True + gst_lib_button + + + False + True + 1 - - True - True - 1 - + + + + True + False + Use to play streams: + - - - - True - False - Record to disk: - + + False + True + 2 + - - False - True - 0 - - - - - True - False - 0.019999999552965164 - in - - - True - False - center - 5 - 5 - 5 - 5 - - - Built-in player - True - True - False - True - get_m3u_radio_button - - - - False - True - 0 - - - - - In a separate window - True - True - False - True - get_m3u_radio_button - - - False - True - 1 - - - - - Only get m3u file - True - True - False - True - True - - - False - True - 2 - - - - - - - True - False - Play streams mode: - - - - - False - True - 1 - - - streaming Streaming @@ -1912,426 +2044,290 @@ Author: Dmitriy Yefremov - True - False - vertical - - True False + 5 + 5 5 5 - 0 - in + vertical + 5 - + True False - 5 - 5 - 5 - 5 + 0 + in - + True False - Language: - - - False - True - 0 - - - - - 150 - True - False - False - 0 - - English - Deutsch - Español - Nederlands - Polski - Português - Türkçe - Беларуская - Русский - - - - - False - True - end - 1 - - - - - - - - - - False - True - 0 - - - - - True - False - 5 - 5 - 0 - in - - - True - False - 5 - 5 - 5 - 5 - - - True - False - start + 5 + 5 5 5 - Load the last open configuration at program startup - - - True - True - 0 - - - - - True - True - center - - - False - True - end - 1 - - - - - - - - - - False - True - 1 - - - - - True - False - 5 - 5 - 0 - in - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - - - True - False - start - True - Show detailed info as hints in the bouquet list - - - 0 - 1 - - - - - True - True - end - center - - - 1 - 1 - - - - - True - False - start - True - Show short info as hints in the main services list - - - 0 - 0 - - - - - True - True - - - 1 - 0 - - - - - - - - - - False - True - 2 - - - - - True - False - 5 - 5 - 0 - in - - - True - False - 5 - 5 - 5 - 5 - vertical - - - True - False - 5 - 5 - + True False - Set background color for the services - 0 + Language: - True + False True - 1 + 0 - + + 150 True - True - + False + False + 0 + + English + Deutsch + Español + Nederlands + Polski + Português + Türkçe + Беларуская + Русский + + False True end - 2 + 1 - - False - False - 0 - - - - True - False - False - 5 - 5 - 20 - - - True - False - Marked as new: - 0 - - - 0 - 0 - - - - - 250 - True - True - True - end - True - - - 1 - 0 - - - - - True - False - With an extra name in the bouquet: - 0 - - - 0 - 1 - - - - - 250 - True - True - True - end - True - - - 1 - 1 - - - - - False - True - 1 - + + + + False + True + 0 + - - - - - - False - True - 3 - - - - - True - False - 5 - 0.019999999552965164 - in - + True False - 5 - 5 - 5 - 5 - 5 + 0 + in - - True - True - end - - - 1 - 0 - - - - - True - True - end - - - 1 - 1 - - - - + True False - 1 - True - Before saving - 0 + 5 + 5 + 5 + 5 + + + True + False + start + 5 + 5 + Load the last open configuration at program startup + + + True + True + 0 + + + + + True + True + center + + + False + True + end + 1 + + - - 0 - 0 - - - - True - False - Before downloading from the receiver - 0 - - - 0 - 1 - + + + + False + True + 1 + - - + + True False - Backup: + 0 + in + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + + + True + False + start + True + Show detailed info as hints in the bouquet list + + + 0 + 1 + + + + + True + True + end + center + + + 1 + 1 + + + + + True + False + start + True + Show short info as hints in the main services list + + + 0 + 0 + + + + + True + True + end + + + 1 + 0 + + + + + + + + + False + True + 2 + + + + + True + False + 0.019999999552965164 + in + + + True + False + 5 + 5 + 5 + 5 + 5 + + + True + True + end + + + 1 + 0 + + + + + True + True + end + + + 1 + 1 + + + + + True + False + 1 + True + Before saving + 0 + + + 0 + 0 + + + + + True + False + Before downloading from the receiver + 0 + + + 0 + 1 + + + + + + + True + False + Backup: + + + + + False + True + 3 + - - False - True - 4 - - - program Program @@ -2340,21 +2336,326 @@ Author: Dmitriy Yefremov - False - 5 - 5 - 5 - 5 - vertical - 5 - - True False - 0 - in + 5 + 5 + 5 + 5 + vertical + 5 - + + True + False + 0.019999999552965164 + in + + + True + False + 5 + 5 + 5 + 5 + vertical + 5 + + + True + False + + + True + False + start + True + Font in the lists: + + + False + True + 0 + + + + + True + False + + + True + True + True + Reset + set_default_font_image + True + + + + True + True + 0 + + + + + True + True + False + Sans 12 + + True + False + + + True + True + end + 1 + + + + + + False + True + 1 + + + + + False + True + 0 + + + + + True + False + 5 + 5 + + + True + False + start + True + Picons size in the lists: + + + 0 + 0 + + + + + True + False + start + Logo size in tooltips: + + + 0 + 1 + + + + + True + False + 0 + + 96 + 128 + 220 + + + + 1 + 1 + + + + + 85 + True + False + 0 + + 32 + 48 + 64 + 72 + 96 + + + + 1 + 0 + + + + + False + True + 1 + + + + + + + + + + False + True + 0 + + + + + True + False + 0 + in + + + True + False + 5 + 5 + 5 + 5 + vertical + + + True + False + 5 + + + True + False + Set background color for the services + 0 + + + True + True + 1 + + + + + True + True + + + + False + True + end + 2 + + + + + False + False + 0 + + + + + True + False + False + 5 + 5 + 20 + + + True + False + Marked as new: + 0 + + + 0 + 0 + + + + + 250 + True + True + True + end + True + + + 1 + 0 + + + + + True + False + With an extra name in the bouquet: + 0 + + + 0 + 1 + + + + + 250 + True + True + True + end + True + + + 1 + 1 + + + + + False + True + 1 + + + + + + + + + + False + True + 1 + + + + + False + 0 + in + + True False 5 @@ -2437,99 +2738,24 @@ Author: Dmitriy Yefremov - - - - - - - False - True - 0 - - - - - True - False - 0 - in - - - True - False - 5 - 5 - 5 - 5 - - - True - False - Enable Themes support - - - False - True - 0 - - - - True - False - EXPERIMENTAL! - - - False - True - 2 - - - - - True - True - - - - False - True - end - 1 - + + + + False + True + 2 + - - - - - - False - True - 1 - - - - - True - False - False - 0 - in - - True + False - 5 - 5 - 5 - 5 - vertical - 5 + 0 + in - + True False 5 @@ -2537,10 +2763,10 @@ Author: Dmitriy Yefremov 5 5 - + True False - Gtk3 Theme: + Enable Themes support False @@ -2548,11 +2774,23 @@ Author: Dmitriy Yefremov 0 - - + + True False - + EXPERIMENTAL! + + + False + True + 2 + + + + + True + True + False @@ -2561,240 +2799,282 @@ Author: Dmitriy Yefremov 1 + + + + + + + + False + True + 3 + + + + + False + False + 0 + in + + + True + False + 5 + 5 + 5 + 5 + vertical + 5 - + True - True - True - Add - + False + 5 + 5 - + True False - gtk-add + Gtk3 Theme: + + False + True + 0 + + + + + True + False + + + + False + True + end + 1 + + + + + True + True + True + Add + + + + True + False + gtk-add + + + + + False + True + end + 2 + + + + + True + True + True + Remove + + + + True + False + gtk-remove + + + + + False + True + end + 3 + + + + + False + True + 1 + + + + + True + False + center + center + 0 + in + + + 120 + 32 + True + False + Preview + center + 2 + 2 + 0 + + + + False True - end 2 - + True - True - True - Remove - + False + 5 + 5 - + True False - gtk-remove + Icon Theme: + + False + True + 0 + + + + + True + False + + + + False + True + end + 1 + + + + + True + True + True + Add + + + + True + False + gtk-add + + + + + False + True + end + 2 + + + + + True + True + True + Remove + + + + True + False + gtk-remove + + + + + False + True + end + 3 + + + + + False + True + 3 + + + + + True + False + center + + + True + False + Gtk3 Themes and Icons: + + + False + True + 0 + + + + + www.gnome-look.org + True + True + True + none + https://www.gnome-look.org/ + + + False + True + 1 + False True end - 3 + 4 - - False - True - 0 - - - - True - False - center - center - 0 - in - - - 120 - 32 - True - False - Preview - center - 2 - 2 - 2 - 2 - 0 - - - - - - - - False - True - end - 1 - + + - - - - - - - False - True - 2 - - - - - True - False - center - - - True - False - Gtk3 Themes and Icons: - - False + True True - 0 - - - - - www.gnome-look.org - True - True - True - none - https://www.gnome-look.org/ - - - False - True - 1 + 4 - - False - True - end - 3 - - - - - True - False - False - 0 - in - - - True - False - 5 - 5 - 5 - 5 - - - True - False - Icon Theme: - - - False - True - 0 - - - - - True - False - - - - False - True - end - 1 - - - - - True - True - True - Add - - - - True - False - gtk-add - - - - - False - True - end - 2 - - - - - True - True - True - Remove - - - - True - False - gtk-remove - - - - - False - True - end - 3 - - - - - - - - - - False - True - 4 - - - appearance Appearance @@ -3424,80 +3704,4 @@ Author: Dmitriy Yefremov ok_button - - True - False - emblem-default - - - True - False - - - gtk-add - True - False - True - True - - - - - - - gtk-edit - True - False - True - True - - - - - - - True - False - - - - - Set default - True - False - set_default_image - False - - - - - - - True - False - - - - - gtk-remove - True - False - True - True - - - - - - - 1 - 10 - 1 - 10 - - - True - False - gtk-connect - diff --git a/app/ui/settings_dialog.py b/app/ui/settings_dialog.py index 3bf5965c..9563da67 100644 --- a/app/ui/settings_dialog.py +++ b/app/ui/settings_dialog.py @@ -6,7 +6,7 @@ from app.connections import test_telnet, test_ftp, TestException, test_http, Htt from app.settings import SettingsType, Settings, PlayStreamsMode from app.ui.dialogs import show_dialog, DialogType, get_message, get_chooser_dialog from .main_helper import update_entry_data, scroll_to, get_picon_pixbuf -from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, FavClickMode, DEFAULT_ICON +from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, FavClickMode, DEFAULT_ICON, APP_FONT def show_settings_dialog(transient, options): @@ -50,6 +50,7 @@ class SettingsDialog: "on_apply_presets": self.on_apply_presets, "on_digit_entry_changed": self.on_digit_entry_changed, "on_view_popup_menu": self.on_view_popup_menu, + "on_list_font_reset": self.on_list_font_reset, "on_theme_changed": self.on_theme_changed, "on_theme_add": self.on_theme_add, "on_theme_remove": self.on_theme_remove, @@ -122,18 +123,23 @@ class SettingsDialog: self._play_in_built_radio_button = builder.get_object("play_in_built_radio_button") self._play_in_window_radio_button = builder.get_object("play_in_window_radio_button") self._get_m3u_radio_button = builder.get_object("get_m3u_radio_button") + self._gst_lib_button = builder.get_object("gst_lib_button") + self._vlc_lib_button = builder.get_object("vlc_lib_button") # Program self._before_save_switch = builder.get_object("before_save_switch") self._before_downloading_switch = builder.get_object("before_downloading_switch") - self._enable_experimental_box = builder.get_object("enable_experimental_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") self._load_on_startup_switch = builder.get_object("load_on_startup_switch") self._bouquet_hints_switch = builder.get_object("bouquet_hints_switch") self._services_hints_switch = builder.get_object("services_hints_switch") self._lang_combo_box = builder.get_object("lang_combo_box") + # Appearance + self._list_font_button = builder.get_object("list_font_button") + self._picons_size_button = builder.get_object("picons_size_button") + self._tooltip_logo_size_button = builder.get_object("tooltip_logo_size_button") + 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") # Extra self._support_http_api_switch = builder.get_object("support_http_api_switch") self._enable_yt_dl_switch = builder.get_object("enable_yt_dl_switch") @@ -176,18 +182,20 @@ class SettingsDialog: self.init_profiles() if self._settings.is_darwin: - # Appearance - self._appearance_box = builder.get_object("appearance_box") - self._appearance_box.set_visible(True) + # Themes + builder.get_object("style_frame").set_visible(True) + builder.get_object("themes_support_frame").set_visible(True) + self._layout_switch = builder.get_object("layout_switch") + self._layout_switch.set_active(self._ext_settings.alternate_layout) + self._theme_frame = builder.get_object("theme_frame") + self._theme_frame.set_visible(True) self._theme_thumbnail_image = builder.get_object("theme_thumbnail_image") self._theme_combo_box = builder.get_object("theme_combo_box") self._icon_theme_combo_box = builder.get_object("icon_theme_combo_box") self._dark_mode_switch = builder.get_object("dark_mode_switch") - self._layout_switch = builder.get_object("layout_switch") self._themes_support_switch = builder.get_object("themes_support_switch") - self._themes_support_switch.bind_property("active", builder.get_object("gtk_theme_frame"), "sensitive") - self._themes_support_switch.bind_property("active", builder.get_object("icon_theme_frame"), "sensitive") - self.init_appearance() + self._themes_support_switch.bind_property("active", self._theme_frame, "sensitive") + self.init_themes() @run_idle def init_ui_elements(self, s_type): @@ -266,6 +274,7 @@ class SettingsDialog: self._before_downloading_switch.set_active(self._settings.backup_before_downloading) self.set_fav_click_mode(self._settings.fav_click_mode) self.set_play_stream_mode(self._settings.play_streams_mode) + self.set_stream_lib(self._settings.stream_lib) self._load_on_startup_switch.set_active(self._settings.load_last_config) self._bouquet_hints_switch.set_active(self._settings.show_bq_hints) self._services_hints_switch.set_active(self._settings.show_srv_hints) @@ -273,6 +282,9 @@ class SettingsDialog: self._transcoding_switch.set_active(self._settings.activate_transcoding) self._presets_combo_box.set_active_id(self._settings.active_preset) self.on_transcoding_preset_changed(self._presets_combo_box) + self._picons_size_button.set_active_id(str(self._settings.list_picon_size)) + self._tooltip_logo_size_button.set_active_id(str(self._settings.tooltip_logo_size)) + self._list_font_button.set_font(self._settings.list_font) if self._s_type is SettingsType.ENIGMA_2: self._enable_exp_switch.set_active(self._settings.is_enable_experimental) @@ -328,6 +340,7 @@ class SettingsDialog: self._ext_settings.backup_before_downloading = self._before_downloading_switch.get_active() self._ext_settings.fav_click_mode = self.get_fav_click_mode() self._ext_settings.play_streams_mode = self.get_play_stream_mode() + self._ext_settings.stream_lib = self.get_stream_lib() self._ext_settings.language = self._lang_combo_box.get_active_id() self._ext_settings.load_last_config = self._load_on_startup_switch.get_active() self._ext_settings.show_bq_hints = self._bouquet_hints_switch.get_active() @@ -337,6 +350,9 @@ class SettingsDialog: self._ext_settings.records_path = self._record_data_dir_field.get_text() self._ext_settings.activate_transcoding = self._transcoding_switch.get_active() self._ext_settings.active_preset = self._presets_combo_box.get_active_id() + self._ext_settings.list_picon_size = int(self._picons_size_button.get_active_id()) + self._ext_settings.tooltip_logo_size = int(self._tooltip_logo_size_button.get_active_id()) + self._ext_settings.list_font = self._list_font_button.get_font() if self._ext_settings.is_darwin: self._ext_settings.dark_mode = self._dark_mode_switch.get_active() @@ -616,6 +632,13 @@ class SettingsDialog: return self._settings.play_streams_mode + def set_stream_lib(self, mode): + self._vlc_lib_button.set_active(mode == "vlc") + self._gst_lib_button.set_active(mode == "gst") + + def get_stream_lib(self): + return "gst" if self._gst_lib_button.get_active() else "vlc" + def on_transcoding_preset_changed(self, button): presets = self._settings.transcoding_presets prs = presets.get(button.get_active_id()) @@ -660,6 +683,11 @@ class SettingsDialog: if event.get_event_type() == Gdk.EventType.BUTTON_PRESS and event.button == Gdk.BUTTON_SECONDARY: menu.popup(None, None, None, None, event.button, event.time) + def on_list_font_reset(self, button): + self._list_font_button.set_font(APP_FONT) + + # ******************* Themes *********************** # + def on_theme_changed(self, button): if self._main_stack.get_visible_child_name() != "appearance": return @@ -698,7 +726,7 @@ class SettingsDialog: response = get_chooser_dialog(self._dialog, self._settings, "Themes Archive [*.xz, *.zip]", ("*.xz", "*.zip")) if response in (Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT): return - self._appearance_box.set_sensitive(False) + self._theme_frame.set_sensitive(False) self.unpack_theme(response, path, button) @run_task @@ -715,7 +743,6 @@ class SettingsDialog: log("Unpacking end.") finally: self.update_theme_button(button, dst) - self._appearance_box.set_sensitive(True) @run_idle def update_theme_button(self, button, dst): @@ -728,6 +755,7 @@ class SettingsDialog: button.append(theme, theme) button.set_active_id(theme) self.show_info_message("Done!", Gtk.MessageType.INFO) + self._theme_frame.set_sensitive(True) @run_idle def remove_theme(self, button, path): @@ -751,9 +779,8 @@ class SettingsDialog: button.set_active(0) @run_idle - def init_appearance(self): + def init_themes(self): self._dark_mode_switch.set_active(self._ext_settings.dark_mode) - self._layout_switch.set_active(self._ext_settings.alternate_layout) t_support = self._ext_settings.is_themes_support self._themes_support_switch.set_active(t_support) if t_support: diff --git a/app/ui/uicommons.py b/app/ui/uicommons.py index 0ee3f6ca..5e7d22d1 100644 --- a/app/ui/uicommons.py +++ b/app/ui/uicommons.py @@ -19,6 +19,7 @@ NOTIFY_IS_INIT = False IS_GNOME_SESSION = int(bool(os.environ.get("GNOME_DESKTOP_SESSION_ID"))) # Translation. TEXT_DOMAIN = "demon-editor" +APP_FONT = None try: settings = Settings.get_instance() @@ -27,6 +28,7 @@ except SettingsException: else: os.environ["LANGUAGE"] = settings.language st = Gtk.Settings().get_default() + APP_FONT = st.get_property("gtk-font-name") st.set_property("gtk-application-prefer-dark-theme", settings.dark_mode) if settings.is_themes_support: