added mark for duplicates in fav list

This commit is contained in:
DYefremov
2021-04-19 13:15:36 +03:00
parent 3e9776e8e0
commit 06887d9440
2 changed files with 30 additions and 2 deletions

View File

@@ -58,8 +58,8 @@ class Application(Gtk.Application):
_FAV_ELEMENTS = ("fav_cut_popup_item", "fav_paste_popup_item", "fav_locate_popup_item", "fav_iptv_popup_item",
"fav_insert_marker_popup_item", "fav_insert_space_popup_item", "fav_edit_sub_menu_popup_item",
"fav_edit_popup_item", "fav_picon_popup_item", "fav_copy_popup_item",
"fav_epg_configuration_popup_item", "fav_add_alt_popup_item")
"fav_edit_popup_item", "fav_picon_popup_item", "fav_copy_popup_item", "fav_add_alt_popup_item",
"fav_epg_configuration_popup_item", "fav_mark_dup_popup_item")
_BOUQUET_ELEMENTS = ("bouquets_new_popup_item", "bouquets_edit_popup_item", "bouquets_cut_popup_item",
"bouquets_copy_popup_item", "bouquets_paste_popup_item", "new_header_button",
@@ -134,6 +134,7 @@ class Application(Gtk.Application):
"on_insert_space": self.on_insert_space,
"on_fav_press": self.on_fav_press,
"on_locate_in_services": self.on_locate_in_services,
"on_mark_duplicates": self.on_mark_duplicates,
"on_picons_manager_show": self.on_picons_manager_show,
"on_filter_changed": self.on_filter_changed,
"on_filter_type_toggled": self.on_filter_type_toggled,
@@ -3094,6 +3095,17 @@ class Application(Gtk.Application):
def on_locate_in_services(self, view):
locate_in_services(view, self._services_view, self._main_window)
def on_mark_duplicates(self, item):
""" Marks services with duplicate [names] in the fav list. """
from collections import Counter
dup = Counter(r[Column.FAV_SERVICE] for r in self._fav_model if r[Column.FAV_TYPE] not in self._marker_types)
dup = {k for k, v in dup.items() if v > 1}
for r in self._fav_model:
if r[Column.FAV_SERVICE] in dup:
r[Column.FAV_BACKGROUND] = self._NEW_COLOR
# ***************** Picons *********************#
def on_picons_manager_show(self, action, value=None):

View File

@@ -781,6 +781,11 @@ Author: Dmitriy Yefremov
</packing>
</child>
</object>
<object class="GtkImage" id="mark_duplicates_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-find-and-replace</property>
</object>
<object class="GtkImage" id="network_transmit_receive_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -3600,6 +3605,17 @@ Author: Dmitriy Yefremov
<signal name="activate" handler="on_locate_in_services" object="fav_tree_view" swapped="no"/>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="fav_mark_dup_popup_item">
<property name="label" translatable="yes">Mark duplicates</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="image">mark_duplicates_image</property>
<property name="use_stock">False</property>
<signal name="activate" handler="on_mark_duplicates" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="fav_pupup_separator_3">
<property name="visible">True</property>