diff --git a/app/settings.py b/app/settings.py index fb5f85ff..74819bdf 100644 --- a/app/settings.py +++ b/app/settings.py @@ -578,6 +578,15 @@ class Settings: def load_last_config(self, value): self._settings["load_last_config"] = value + @property + def show_srv_hints(self): + """ Show short info as hints in the main services list. """ + return self._settings.get("show_srv_hints", True) + + @show_srv_hints.setter + def show_srv_hints(self, value): + self._settings["show_srv_hints"] = value + @property def show_bq_hints(self): """ Show detailed info as hints in the bouquet list. """ diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py index 06a1972f..fb23d1c5 100644 --- a/app/ui/main_app_window.py +++ b/app/ui/main_app_window.py @@ -64,7 +64,6 @@ class Application(Gtk.Application): _FAV_IPTV_ELEMENTS = ("fav_iptv_popup_item",) - # _LOCK_HIDE_ELEMENTS = ("locked_tool_button", "hide_tool_button") _LOCK_HIDE_ELEMENTS = () def __init__(self, **kwargs): @@ -102,6 +101,7 @@ class Application(Gtk.Application): "on_to_fav_copy": self.on_to_fav_copy, "on_to_fav_end_copy": self.on_to_fav_end_copy, "on_fav_view_query_tooltip": self.on_fav_view_query_tooltip, + "on_services_view_query_tooltip": self.on_services_view_query_tooltip, "on_view_drag_begin": self.on_view_drag_begin, "on_view_drag_data_get": self.on_view_drag_data_get, "on_services_view_drag_drop": self.on_services_view_drag_drop, @@ -814,27 +814,39 @@ class Application(Gtk.Application): # ********************* Hints *************************# - def on_fav_view_query_tooltip(self, view, x, y, keyboard_mode, tooltip: Gtk.Tooltip): - """ Sets detailed info about service in the tooltip. """ + def on_fav_view_query_tooltip(self, view, x, y, keyboard_mode, tooltip): + """ Sets detailed info about service in the tooltip [fav view]. """ result = view.get_dest_row_at_pos(x, y) if not result or not self._settings.show_bq_hints: return False - path, pos = result + return self.get_tooltip(view, result, tooltip) + + def on_services_view_query_tooltip(self, view, x, y, keyboard_mode, tooltip): + """ Sets short info about service in the tooltip [main services view]. """ + result = view.get_dest_row_at_pos(x, y) + if not result or not self._settings.show_srv_hints: + return False + + return self.get_tooltip(view, result, tooltip, target=ViewTarget.SERVICES) + + def get_tooltip(self, view, dest_row, tooltip, target=ViewTarget.FAV): + path, pos = dest_row model = view.get_model() - srv = self._services.get(model[path][Column.FAV_ID], None) + 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_text(self.get_hint_for_bq_list(srv)) + 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) return True return False - def get_hint_for_bq_list(self, srv: Service): + def get_hint_for_bq_list(self, srv): """ Returns detailed info about service as formatted string for using as hint. """ - header = "{}: {}\n{}: {}\n".format(get_message("Name"), srv.service, get_message("Type"), srv.service_type) - ref = "{}: {}".format(get_message("Service reference"), srv.picon_id.rstrip(".png")) + header, ref = self.get_hint_header_info(srv) if srv.service_type == "IPTV": return "{}{}".format(header, ref) @@ -849,6 +861,15 @@ class Application(Gtk.Application): get_message("Rate"), srv.rate, pol, fec, "SID", srv.ssid, ref) + def get_hint_for_srv_list(self, srv): + """ Returns short info about service as formatted string for using as hint. """ + return "{}{}".format(*self.get_hint_header_info(srv)) + + def get_hint_header_info(self, srv): + header = "{}: {}\n{}: {}\n".format(get_message("Name"), srv.service, get_message("Type"), srv.service_type) + ref = "{}: {}".format(get_message("Service reference"), srv.picon_id.rstrip(".png")) + return header, ref + # ***************** Drag-and-drop *********************# def on_view_drag_begin(self, view, context): @@ -2452,7 +2473,7 @@ class Application(Gtk.Application): data = r[Column.SRV_PICON_ID].split("_") ids["{}:{}:{}".format(data[3], data[5], data[6])] = r[Column.SRV_PICON_ID] - PiconsDialog(self._main_window, self._settings, ids, self._sat_positions, self.update_picons).show() + PiconsDialog(self._main_window, self._settings, ids, self._sat_positions, self).show() @run_task def update_picons(self): diff --git a/app/ui/main_window.glade b/app/ui/main_window.glade index f47faf3b..9d8b23e9 100644 --- a/app/ui/main_window.glade +++ b/app/ui/main_window.glade @@ -1424,6 +1424,7 @@ Author: Dmitriy Yefremov + diff --git a/app/ui/settings_dialog.glade b/app/ui/settings_dialog.glade index 4401c1d1..f3f1cd9a 100644 --- a/app/ui/settings_dialog.glade +++ b/app/ui/settings_dialog.glade @@ -2157,38 +2157,61 @@ Author: Dmitriy Yefremov 0 in - + True False 5 5 5 5 + 5 + 5 True False - 5 - 5 + start + True Show detailed info as hints in the bouquet list - False - True - 0 + 0 + 1 True True + end center - False - True - end - 1 + 1 + 1 + + + + + True + False + start + True + Show short info as hints in the main services list + + + 0 + 0 + + + + + True + True + + + 1 + 0 diff --git a/app/ui/settings_dialog.py b/app/ui/settings_dialog.py index 0f2651e2..c5a446ea 100644 --- a/app/ui/settings_dialog.py +++ b/app/ui/settings_dialog.py @@ -143,6 +143,7 @@ class SettingsDialog: 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") # HTTP API self._support_http_api_switch = builder.get_object("support_http_api_switch") @@ -274,6 +275,7 @@ class SettingsDialog: self.set_play_stream_mode(self._settings.play_streams_mode) 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) self._default_data_paths_switch.set_active(self._settings.profile_folder_is_default) self._transcoding_switch.set_active(self._settings.activate_transcoding) self._presets_combo_box.set_active_id(self._settings.active_preset) @@ -337,6 +339,7 @@ class SettingsDialog: 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() + self._ext_settings.show_srv_hints = self._services_hints_switch.get_active() self._ext_settings.profile_folder_is_default = self._default_data_paths_switch.get_active() self._ext_settings.default_data_path = self._default_data_dir_field.get_text() self._ext_settings.records_path = self._record_data_dir_field.get_text()