diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py index d7691393..12df65eb 100644 --- a/app/ui/main_app_window.py +++ b/app/ui/main_app_window.py @@ -42,21 +42,21 @@ 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_edit_sub_menu_popup_item", "fav_edit_popup_item", "fav_picon_popup_item", "fav_copy_popup_item") - _BOUQUET_ELEMENTS = ("edit_tool_button", "new_tool_button", "bouquets_new_popup_item", "bouquets_edit_popup_item", + _BOUQUET_ELEMENTS = ("bouquets_new_popup_item", "bouquets_edit_popup_item", "bouquets_cut_popup_item", "bouquets_copy_popup_item", "bouquets_paste_popup_item") - _COMMONS_ELEMENTS = ("edit_tool_button", "bouquets_remove_popup_item", "fav_remove_popup_item") + _COMMONS_ELEMENTS = ("bouquets_remove_popup_item", "fav_remove_popup_item") _FAV_ENIGMA_ELEMENTS = ("fav_insert_marker_popup_item",) _FAV_IPTV_ELEMENTS = ("fav_iptv_popup_item",) _LOCK_HIDE_ELEMENTS = ("locked_tool_button", "hide_tool_button") - _DYNAMIC_ELEMENTS = ("services_popup_menu", "new_tool_button", "edit_tool_button", "locked_tool_button", - "fav_cut_popup_item", "fav_paste_popup_item", "bouquets_new_popup_item", "hide_tool_button", - "bouquets_remove_popup_item", "fav_remove_popup_item", "bouquets_edit_popup_item", - "fav_insert_marker_popup_item", "fav_edit_popup_item", "fav_edit_sub_menu_popup_item", - "fav_locate_popup_item", "fav_picon_popup_item", "fav_iptv_popup_item", "fav_copy_popup_item", + _DYNAMIC_ELEMENTS = ("services_popup_menu", "locked_tool_button", "fav_cut_popup_item", "fav_paste_popup_item", + "bouquets_new_popup_item", "hide_tool_button", "bouquets_remove_popup_item", + "fav_remove_popup_item", "bouquets_edit_popup_item", "fav_insert_marker_popup_item", + "fav_edit_popup_item", "fav_edit_sub_menu_popup_item", "fav_locate_popup_item", + "fav_picon_popup_item", "fav_iptv_popup_item", "fav_copy_popup_item", "bouquets_cut_popup_item", "bouquets_copy_popup_item", "bouquets_paste_popup_item") # Colors - _NEW_COLOR = "#ff5733" # Color for new services in the main list + _NEW_COLOR = "#ffe6cc" # Color for new services in the main list _EXTRA_COLOR = "#33a8ff" # Color for services with a extra name for the bouquet def __init__(self, **kwargs): @@ -216,11 +216,6 @@ class Application(Gtk.Application): # 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) - # Renders - self._service_render = builder.get_object("service_cellrenderertext") - self._fav_service_render = builder.get_object("fav_service_cellrenderertext") - self._service_column = builder.get_object("service_column") - self._fav_service_column = builder.get_object("fav_service_column") # Clipboard self._clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) # Wait dialog @@ -243,7 +238,6 @@ class Application(Gtk.Application): def do_startup(self): Gtk.Application.do_startup(self) - self.init_service_renders() self.init_http_api() def do_activate(self): @@ -283,29 +277,6 @@ class Application(Gtk.Application): """ Function for force ctrl press event for view """ event.state |= Gdk.ModifierType.CONTROL_MASK - def init_service_renders(self): - profile = Profile(self._profile) - func = self.service_data_function if profile is Profile.ENIGMA_2 else None - fav_func = self.fav_service_data_function if profile is Profile.ENIGMA_2 else None - self._service_column.set_cell_data_func(self._service_render, func, None) - self._fav_service_column.set_cell_data_func(self._fav_service_render, fav_func, None) - - def service_data_function(self, column, render: Gtk.CellRendererText, model, itr, data): - """ Data function for the service column of main list """ - render.set_property("foreground-set", None) - cas_flags = model.get_value(itr, 0) - if cas_flags: - f_flags = list(filter(lambda x: x.startswith("f:"), cas_flags.split(","))) - if f_flags and Flag.is_new(int(f_flags[0][2:])): - render.set_property("foreground", self._NEW_COLOR) - - def fav_service_data_function(self, column, render, model, itr, data): - """ Data function for the service column of FAV list """ - fav_id = model.get_value(itr, 7) - bq = self._extra_bouquets.get(self._bq_selected, None) - has_id = bq.get(fav_id, None) if bq else bq - render.set_property("foreground", self._EXTRA_COLOR) if has_id else render.set_property("foreground-set", None) - @run_idle def on_close_app(self, *args): self.quit() @@ -825,7 +796,16 @@ class Application(Gtk.Application): def append_services_data(self, services): for srv in services: - itr = self._services_model.append(srv) + flags = srv.flags_cas + tooltip, background = None, None + 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:])): + tooltip = "Marked as new" + background = self._NEW_COLOR + + s = srv + (tooltip, background) + itr = self._services_model.append(s) self._services_model.set_value(itr, 8, self._picons.get(srv.picon_id, None)) yield True self._wait_dialog.hide() @@ -1006,7 +986,6 @@ class Application(Gtk.Application): self.update_services_counts() self.update_profile_label() - self.init_service_renders() self.init_http_api() def on_tree_view_key_press(self, view, event): diff --git a/app/ui/main_window.glade b/app/ui/main_window.glade index 145d0c86..73b58220 100644 --- a/app/ui/main_window.glade +++ b/app/ui/main_window.glade @@ -282,7 +282,6 @@ Author: Dmitriy Yefremov False - True @@ -294,21 +293,17 @@ Author: Dmitriy Yefremov vertical 2 - - gtk-new + True - False + True True - New empty configuration - none - True - True + New empty configuration False True - 0 + 6 @@ -319,41 +314,35 @@ Author: Dmitriy Yefremov False True - 1 + 7 - - gtk-open + True - False + True True - none - True - True + Open False True - 2 + 8 - - gtk-save + True - False + True True - none - True - True + Save False True - 3 + 9 @@ -365,24 +354,46 @@ Author: Dmitriy Yefremov False True 2 - 4 + 10 - - gtk-quit + + True + True + True + FTP-transfer + + + + False + True + 11 + + + + True False + + + False + True + 12 + + + + + True + True True - none - True - True + Exit False True - 5 + 13 @@ -709,7 +720,6 @@ Author: Dmitriy Yefremov False - True @@ -721,15 +731,12 @@ Author: Dmitriy Yefremov vertical 2 - - gtk-preferences + True - False + True True - none - True - True - + Satellites editor + False @@ -737,6 +744,59 @@ Author: Dmitriy Yefremov 0 + + + True + True + True + Picons downloader + + + + False + True + 1 + + + + + True + True + True + Import m3u file + + + + False + True + 2 + + + + + True + False + + + False + True + 4 + + + + + True + True + True + Settings + + + + True + True + 5 + + True @@ -747,24 +807,21 @@ Author: Dmitriy Yefremov False True - 1 + 6 - - gtk-about + True - False + True True - none - True - True + About - False + True True - 4 + 7 @@ -841,6 +898,10 @@ Author: Dmitriy Yefremov + + + + @@ -1062,62 +1123,6 @@ Author: Dmitriy Yefremov True False - - - True - False - False - True - New bouquet - - - - True - False - gtk-new - - - - - False - True - 0 - - - - - True - False - False - True - Edit - - - - True - False - gtk-edit - - - - - False - True - 1 - - - - - True - False - - - False - True - 2 - 4 - - True @@ -1590,6 +1595,7 @@ Author: Dmitriy Yefremov 3 True both + 20 True @@ -1611,6 +1617,7 @@ Author: Dmitriy Yefremov + 21 0 @@ -1623,6 +1630,7 @@ Author: Dmitriy Yefremov + 21 1 @@ -1631,15 +1639,17 @@ Author: Dmitriy Yefremov True - 2 50 Service True True 3 - + + 2 + + 21 2 @@ -1649,18 +1659,26 @@ Author: Dmitriy Yefremov 25 + 21 + 21 3 - + + 2 + + 21 4 - + + 2 + + 21 5 @@ -1680,6 +1698,7 @@ Author: Dmitriy Yefremov 15 + 21 6 @@ -1698,6 +1717,7 @@ Author: Dmitriy Yefremov 0.51999998092651367 + 21 7 @@ -1711,6 +1731,7 @@ Author: Dmitriy Yefremov + 21 8 @@ -1742,6 +1763,7 @@ Author: Dmitriy Yefremov 0.50999999046325684 + 21 10 @@ -1760,6 +1782,7 @@ Author: Dmitriy Yefremov 0.50999999046325684 + 21 11 @@ -1778,6 +1801,7 @@ Author: Dmitriy Yefremov 0.50999999046325684 + 21 12 @@ -1796,6 +1820,7 @@ Author: Dmitriy Yefremov 0.50999999046325684 + 21 13 @@ -1814,6 +1839,7 @@ Author: Dmitriy Yefremov 0.50999999046325684 + 21 14 @@ -1832,6 +1858,7 @@ Author: Dmitriy Yefremov 0.50999999046325684 + 21 15 @@ -1849,6 +1876,7 @@ Author: Dmitriy Yefremov 0.50999999046325684 + 21 16 @@ -1890,6 +1918,24 @@ Author: Dmitriy Yefremov + + + False + extra + + + + 20 + + + + + + 21 + + + + diff --git a/app/ui/service_details_dialog.py b/app/ui/service_details_dialog.py index 35632b91..cca48afe 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 +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 @@ -183,7 +183,7 @@ class ServiceDetailsDialog: if not itr: return - srv = Service(*self._current_model[itr][:]) + srv = Service(*self._current_model[itr][: Column.SRV_TOOLTIP]) self._old_service = srv self._current_itr = itr # Service @@ -197,7 +197,7 @@ class ServiceDetailsDialog: self.select_active_text(self._pol_combo_box, srv.pol) self.select_active_text(self._fec_combo_box, srv.fec) self.select_active_text(self._sys_combo_box, srv.system) - if tr_type in "tc" and self._profile is Profile.ENIGMA_2: + if tr_type and tr_type in "tc" and self._profile is Profile.ENIGMA_2: self.update_ui_for_terrestrial() else: self.set_sat_positions(srv.pos) diff --git a/app/ui/uicommons.py b/app/ui/uicommons.py index e0918034..c6bb2728 100644 --- a/app/ui/uicommons.py +++ b/app/ui/uicommons.py @@ -88,5 +88,46 @@ class BqGenType(Enum): EACH_TYPE = 5 +class Column(Enum): + """ Column nums in the views """ + # main view + SRV_CAS_FLAGS = 0 + SRV_STANDARD = 1 + SRV_CODED = 2 + SRV_SERVICE = 3 + SRV_LOCKED = 4 + SRV_HIDE = 5 + SRV_PACKAGE = 6 + SRV_TYPE = 7 + SRV_PICON = 8 + SRV_PICON_ID = 9 + SRV_SSID = 10 + SRV_FREQ = 11 + SRV_RATE = 12 + SRV_POL = 13 + SRV_FEC = 14 + SRV_SYSTEM = 15 + SRV_POS = 16 + SRV_DATA_ID = 17 + SRV_FAV_ID = 18 + SRV_TRANSPONDER = 19 + SRV_TOOLTIP = 20 + SRV_BACKGROUND = 21 + # fav view + FAV_NUM = 0 + FAV_CODED = 1 + FAV_SERVICE = 2 + FAV_LOCKED = 3 + FAV_HIDE = 4 + FAV_TYPE = 5 + FAV_POS = 6 + FAV_ID = 7 + FAV_PICON = 8 + + def __index__(self): + """ Overridden to get the index in slices directly """ + return self.value + + if __name__ == "__main__": pass