From a507f9d401e66aaeb3ff41bb4e1ce47fbf5b3b2f Mon Sep 17 00:00:00 2001 From: DYefremov Date: Thu, 20 Sep 2018 18:37:47 +0300 Subject: [PATCH] Updatating bouquets type in the model and dict --- app/ui/main_app_window.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py index efce94f1..5dc20aeb 100644 --- a/app/ui/main_app_window.py +++ b/app/ui/main_app_window.py @@ -373,6 +373,7 @@ class MainAppWindow: for index, row in enumerate(self._bouquets_buffer): model.insert(p_iter, dest_index + index, row) self._bouquets_buffer.clear() + self.update_bouquets_type() # ***************** Deletion *********************# @@ -565,6 +566,7 @@ class MainAppWindow: view.expand_all() list(map(model.remove, to_del)) + self.update_bouquets_type() def get_selection(self, view): """ Creates a string from the iterators of the selected rows """ @@ -767,7 +769,6 @@ class MainAppWindow: shutil.move(os.path.join(path, file), backup_path + file) bouquets = [] - services_model = get_base_model(self._services_view.get_model()) def parse_bouquets(model, b_path, itr): bqs = None @@ -793,6 +794,7 @@ class MainAppWindow: self._bouquets_view.get_model().foreach(parse_bouquets) write_bouquets(path, bouquets, profile) # Getting services + services_model = get_base_model(self._services_view.get_model()) services = [Service(*row[:]) for row in services_model] write_services(path, services, profile, self.get_format_version() if profile is Profile.ENIGMA_2 else 0) # removing bouquet files @@ -879,6 +881,20 @@ class MainAppWindow: return "{}:{}".format(name, ch_row[3]) return False + @run_idle + def update_bouquets_type(self): + """ Update bouquets type in the model and dict """ + for row in get_base_model(self._bouquets_view.get_model()): + bqs_rows = row.iterchildren() + if bqs_rows: + bq_type = row[-1] + for b_row in bqs_rows: + bq_id = "{}:{}".format(b_row[0], b_row[-1]) + bq = self._bouquets.get(bq_id, None) + if bq: + b_row[-1] = bq_type + self._bouquets["{}:{}".format(b_row[0], b_row[-1])] = bq + def delete_selection(self, view, *args): """ Used for clear selection on given view(s) """ for v in [view, *args]: