diff --git a/app/settings.py b/app/settings.py
index 1ceefeba..55a4e136 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 = 1 if IS_DARWIN else 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 eb5b3c72..5af5806a 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
@@ -340,7 +342,7 @@ class Application(Gtk.Application):
self.set_accels()
self.init_drag_and_drop()
- self.init_colors()
+ self.init_appearance()
if self._settings.load_last_config:
config = self._settings.get("last_config") or {}
@@ -497,11 +499,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
@@ -517,6 +529,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:
@@ -977,7 +998,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)
@@ -1439,7 +1461,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!")
@@ -1868,7 +1890,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()
@@ -2429,7 +2451,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,
@@ -3050,7 +3072,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 68eb576c..52a6dddf 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 fa69bdfd..71bf7357 100644
--- a/app/ui/settings_dialog.glade
+++ b/app/ui/settings_dialog.glade
@@ -3,7 +3,7 @@
The MIT License (MIT)
-Copyright (c) 2018-2020 Dmitriy Yefremov
+Copyright (c) 2018-2021 Dmitriy Yefremov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -32,8 +32,14 @@ Author: Dmitriy Yefremov
-
+
+
+