diff --git a/app/ui/imports.glade b/app/ui/imports.glade index 4996806f..186a8bf4 100644 --- a/app/ui/imports.glade +++ b/app/ui/imports.glade @@ -55,6 +55,99 @@ Author: Dmitriy Yefremov document-revert-symbolic-rtl 1 + + False + + + True + False + 10 + 10 + 5 + 5 + vertical + 5 + + + True + True + False + Enables overwriting existing main list services. + 5 + + + True + False + Replace existing + + + False + True + 0 + + + + + True + True + center + + + False + True + end + 1 + + + + + False + True + 0 + + + + + True + False + Enables skipping services import from lamedb. + 5 + + + True + False + Bouquets data only + + + False + True + 0 + + + + + True + True + center + + + + False + True + end + 1 + + + + + False + True + 1 + + + + + True False @@ -233,30 +326,6 @@ Author: Dmitriy Yefremov True False 5 - - - True - False - Replace existing - - - False - True - 0 - - - - - True - True - center - - - False - True - 1 - - True @@ -275,6 +344,53 @@ Author: Dmitriy Yefremov 2 + + + True + True + True + none + options_popover + + + True + False + 2 + + + True + False + Options + applications-system-symbolic + 1 + + + False + True + 0 + + + + + True + False + Options + + + False + True + 1 + + + + + + + False + True + 3 + + False diff --git a/app/ui/imports.py b/app/ui/imports.py index 179bc182..4c367f8b 100644 --- a/app/ui/imports.py +++ b/app/ui/imports.py @@ -121,6 +121,7 @@ class ImportDialog: "on_resize": self.on_resize, "on_main_paned_realize": self.on_main_paned_realize, "on_visible_page": self.on_visible_page, + "on_bouquets_only_switch": self.on_bouquets_only_switch, "on_key_press": self.on_key_press} builder = get_builder(f"{UI_RESOURCES_PATH}imports.glade", handlers) @@ -144,7 +145,10 @@ class ImportDialog: self._dialog_window.set_transient_for(app.app_window) self._info_bar = builder.get_object("info_bar") self._message_label = builder.get_object("message_label") + # Options. self._replace_existing_switch = builder.get_object("replace_existing_switch") + self._bouquets_only_switch = builder.get_object("bouquets_only_switch") + self._bouquets_settings_box = builder.get_object("bouquets_settings_box") # Bouquets page. self._bq_model = builder.get_object("bq_list_store") self._bq_view = builder.get_object("bq_view") @@ -260,7 +264,12 @@ class ImportDialog: with suppress(ValueError): bq.remove(b) - self._append(self._bouquets, list(filter(lambda s: s.fav_id not in self._ids, services))) + if self._bouquets_only_switch.get_active(): + services = () + else: + services = list(filter(lambda s: s.fav_id not in self._ids, services)) + + self._append(self._bouquets, services) if self._replace_existing_switch.get_active(): self._app.emit("services_update", {s.fav_id: s for s in filter(lambda s: s.fav_id in self._ids, services)}) @@ -408,6 +417,11 @@ class ImportDialog: def on_visible_page(self, stack, param): self._page = Page(stack.get_visible_child_name()) + self._bouquets_settings_box.set_sensitive(self._page is Page.SERVICES) + + def on_bouquets_only_switch(self, switch, state): + if state: + self._replace_existing_switch.set_active(False) def on_key_press(self, view, event): """ Handling keystrokes """