diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py index ee4b6b1b..cd2b08c1 100644 --- a/app/ui/main_app_window.py +++ b/app/ui/main_app_window.py @@ -4,7 +4,7 @@ from functools import lru_cache import shutil -from app.commons import run_idle, log, run_task +from app.commons import run_idle, log from app.eparser import get_blacklist, write_blacklist, parse_m3u from app.eparser import get_services, get_bouquets, write_bouquets, write_services, Bouquets, Bouquet, Service from app.eparser.ecommons import CAS, Flag @@ -121,7 +121,9 @@ class MainAppWindow: "on_create_bouquet_for_current_satellite": self.on_create_bouquet_for_current_satellite, "on_create_bouquet_for_each_satellite": self.on_create_bouquet_for_each_satellite, "on_create_bouquet_for_current_package": self.on_create_bouquet_for_current_package, - "on_create_bouquet_for_each_package": self.on_create_bouquet_for_each_package} + "on_create_bouquet_for_each_package": self.on_create_bouquet_for_each_package, + "on_create_bouquet_for_current_type": self.on_create_bouquet_for_current_type, + "on_create_bouquet_for_each_type": self.on_create_bouquet_for_each_type} self._options = get_config() self._profile = self._options.get("profile") @@ -1021,7 +1023,12 @@ class MainAppWindow: def on_create_bouquet_for_each_package(self, item): self.create_bouquets(BqGenType.EACH_PACKAGE) - @run_task + def on_create_bouquet_for_current_type(self, item): + self.create_bouquets(BqGenType.TYPE) + + def on_create_bouquet_for_each_type(self, item): + self.create_bouquets(BqGenType.EACH_TYPE) + def create_bouquets(self, g_type): gen_bouquets(self._services_view, self._bouquets_view, self._main_window, g_type, self._TV_TYPES, Profile(self._profile), self.append_bouquet) diff --git a/app/ui/main_helper.py b/app/ui/main_helper.py index 57b3b613..a6d3f00c 100644 --- a/app/ui/main_helper.py +++ b/app/ui/main_helper.py @@ -4,6 +4,7 @@ import shutil from enum import Enum from gi.repository import GdkPixbuf +from app.commons import run_idle, run_task from app.eparser import Service from app.eparser.ecommons import Flag, BouquetService, Bouquet, BqType from app.eparser.enigma.bouquets import BqServiceType, to_bouquet_id @@ -25,6 +26,8 @@ class BqGenType(Enum): EACH_SAT = 1 PACKAGE = 2 EACH_PACKAGE = 3 + TYPE = 4 + EACH_TYPE = 5 # ***************** Markers *******************# @@ -423,24 +426,25 @@ def get_picon_pixbuf(path): def gen_bouquets(view, bq_view, transient, gen_type, tv_types, profile, callback): """ Auto-generate and append list of bouquets """ fav_id_index = 18 - index = 6 if gen_type in (BqGenType.PACKAGE, BqGenType.EACH_PACKAGE) else 16 + index = 6 if gen_type in (BqGenType.PACKAGE, BqGenType.EACH_PACKAGE) else 16 if gen_type in ( + BqGenType.SAT, BqGenType.EACH_SAT) else 7 model, paths = view.get_selection().get_selected_rows() model = get_base_model(model) bq_type = BqType.BOUQUET.value if profile is Profile.NEUTRINO_MP else BqType.TV.value - if gen_type is BqGenType.SAT or gen_type is BqGenType.PACKAGE: + if gen_type in (BqGenType.SAT, BqGenType.PACKAGE, BqGenType.TYPE): if not is_only_one_item_selected(paths, transient): return service = Service(*model[paths][:]) if service.service_type not in tv_types: bq_type = BqType.RADIO.value append_bouquets(bq_type, bq_view, callback, fav_id_index, index, model, - [service.package if gen_type is BqGenType.PACKAGE else service.pos]) - if gen_type is BqGenType.EACH_PACKAGE: - append_bouquets(bq_type, bq_view, callback, fav_id_index, index, model, {row[index] for row in model}) - elif gen_type is BqGenType.EACH_SAT: + [service.package if gen_type is BqGenType.PACKAGE else + service.pos if gen_type is BqGenType.SAT else service.service_type]) + else: append_bouquets(bq_type, bq_view, callback, fav_id_index, index, model, {row[index] for row in model}) +@run_task def append_bouquets(bq_type, bq_view, callback, fav_id_index, index, model, names): bq_view.expand_row(Gtk.TreePath(0), 0) bqs_model = bq_view.get_model() diff --git a/app/ui/main_window.glade b/app/ui/main_window.glade index bef4d90d..4071cb3a 100644 --- a/app/ui/main_window.glade +++ b/app/ui/main_window.glade @@ -120,7 +120,7 @@ True False - gtk-save + gtk-save-as True @@ -135,7 +135,7 @@ True False - gtk-save + gtk-save-as True @@ -145,7 +145,7 @@ True False - gtk-save + gtk-save-as True @@ -215,13 +215,23 @@ - - For each satellite + + For current package True False - image4 + image6 False - + + + + + + For current type + True + False + image8 + False + @@ -231,13 +241,13 @@ - - For current package + + For each satellite True False - image6 + image4 False - + @@ -250,21 +260,6 @@ - - - True - False - - - - - For current type - True - False - image8 - False - - For each type @@ -272,6 +267,7 @@ False image9 False +