diff --git a/app/ui/download_dialog.py b/app/ui/download_dialog.py
index 8231c1a5..f4b9245b 100644
--- a/app/ui/download_dialog.py
+++ b/app/ui/download_dialog.py
@@ -35,7 +35,7 @@ from app.connections import download_data, DownloadType, upload_data
from app.settings import SettingsType
from app.ui.backup import backup_data, restore_data
from app.ui.main_helper import append_text_to_tview
-from app.ui.settings_dialog import show_settings_dialog
+from app.ui.settings_dialog import SettingsDialog
from .dialogs import show_dialog, DialogType, get_message, get_builder
from .uicommons import Gtk, UI_RESOURCES_PATH
@@ -120,8 +120,9 @@ class DownloadDialog:
self._dialog_window.destroy()
def on_settings(self, item):
- response = show_settings_dialog(self._dialog_window, self._settings)
- if response != Gtk.ResponseType.CANCEL:
+ dialog = SettingsDialog(self._dialog_window, self._settings)
+ dialog.show()
+ if dialog.is_updated():
self._s_type = self._settings.setting_type
self.update_profiles()
gen = self._update_settings_callback()
diff --git a/app/ui/main.py b/app/ui/main.py
index 3e32bb4b..a8140e8d 100644
--- a/app/ui/main.py
+++ b/app/ui/main.py
@@ -60,16 +60,12 @@ from .dialogs import show_dialog, DialogType, get_chooser_dialog, WaitDialog, ge
from .download_dialog import DownloadDialog
from .imports import ImportDialog, import_bouquet
from .iptv import IptvDialog, SearchUnavailableDialog, IptvListConfigurationDialog, YtListImportDialog, M3uImportDialog
-from .main_helper import (insert_marker, move_items, rename, ViewTarget, set_flags, locate_in_services,
- scroll_to, get_base_model, update_picons_data, copy_picon_reference, assign_picons,
- remove_picon, is_only_one_item_selected, gen_bouquets, BqGenType, append_picons,
- get_selection, get_model_data, remove_all_unused_picons, get_picon_pixbuf, get_base_itrs,
- get_iptv_url)
+from .main_helper import *
from .picons import PiconManager
from .satellites import SatellitesTool, ServicesUpdateDialog
from .search import SearchProvider
from .service_details_dialog import ServiceDetailsDialog, Action
-from .settings_dialog import show_settings_dialog
+from .settings_dialog import SettingsDialog
from .uicommons import (Gtk, Gdk, UI_RESOURCES_PATH, LOCKED_ICON, HIDE_ICON, IPTV_ICON, MOVE_KEYS, KeyboardKey, Column,
FavClickMode, MOD_MASK, APP_FONT, Page, IS_GNOME_SESSION)
@@ -2197,13 +2193,14 @@ class Application(Gtk.Application):
self._bouquets["{}:{}".format(b_row[Column.BQ_NAME], b_row[Column.BQ_TYPE])] = bq
def delete_selection(self, view, *args):
- """ Used for clear selection on given view(s) """
+ """ Used for clear selection on given view(s). """
for v in [view, *args]:
v.get_selection().unselect_all()
def on_settings(self, action, value=None):
- response = show_settings_dialog(self._main_window, self._settings)
- if response != Gtk.ResponseType.CANCEL:
+ dialog = SettingsDialog(self._main_window, self._settings)
+ dialog.show()
+ if dialog.is_updated():
gen = self.update_settings()
GLib.idle_add(lambda: next(gen, False), priority=GLib.PRIORITY_LOW)
diff --git a/app/ui/main_helper.py b/app/ui/main_helper.py
index b13b2de2..2d78b357 100644
--- a/app/ui/main_helper.py
+++ b/app/ui/main_helper.py
@@ -26,7 +26,14 @@
#
-""" Helper module for the ui. """
+""" Helper module for the GUI. """
+
+__all__ = ("insert_marker", "move_items", "rename", "ViewTarget", "set_flags", "locate_in_services",
+ "scroll_to", "get_base_model", "update_picons_data", "copy_picon_reference", "assign_picons",
+ "remove_picon", "is_only_one_item_selected", "gen_bouquets", "BqGenType", "append_picons",
+ "get_selection", "get_model_data", "remove_all_unused_picons", "get_picon_pixbuf", "get_base_itrs",
+ "get_iptv_url", "update_entry_data", "append_text_to_tview", "on_popup_menu")
+
import os
import shutil
from collections import defaultdict
diff --git a/app/ui/settings_dialog.glade b/app/ui/settings_dialog.glade
index 4fb814f4..589a37b4 100644
--- a/app/ui/settings_dialog.glade
+++ b/app/ui/settings_dialog.glade
@@ -99,7 +99,7 @@ Author: Dmitriy Yefremov
set_default_image
False
-
+
@@ -194,14 +194,13 @@ Author: Dmitriy Yefremov
-
-
-
- OK
- True
- True
- True
- center
-
-
- False
- False
- 3
- True
-
-
False
@@ -2884,7 +2868,6 @@ Author: Dmitriy Yefremov
- False
False
Enables an alternate layout of the main window elements.
@@ -3713,7 +3696,7 @@ Author: Dmitriy Yefremov
- ok_button
+ save_button
diff --git a/app/ui/settings_dialog.py b/app/ui/settings_dialog.py
index 000196af..ccb37c59 100644
--- a/app/ui/settings_dialog.py
+++ b/app/ui/settings_dialog.py
@@ -50,7 +50,6 @@ class SettingsDialog:
"on_settings_type_changed": self.on_settings_type_changed,
"on_reset": self.on_reset,
"on_response": self.on_response,
- "apply_settings": self.apply_settings,
"on_connection_test": self.on_connection_test,
"on_info_bar_close": self.on_info_bar_close,
"on_set_color_switch": self.on_set_color_switch,
@@ -86,11 +85,12 @@ class SettingsDialog:
"on_icon_theme_add": self.on_icon_theme_add,
"on_icon_theme_remove": self.on_icon_theme_remove}
- # Settings
+ # Settings.
self._ext_settings = settings
self._settings = Settings(settings.settings)
self._profiles = self._settings.profiles
self._s_type = self._settings.setting_type
+ self._updated = False
builder = get_builder(UI_RESOURCES_PATH + "settings_dialog.glade", handlers)
@@ -135,7 +135,7 @@ class SettingsDialog:
self._neutrino_radio_button = builder.get_object("neutrino_radio_button")
self._support_ver5_switch = builder.get_object("support_ver5_switch")
self._force_bq_name_switch = builder.get_object("force_bq_name_switch")
- # Streaming
+ # Streaming.
self._apply_presets_button = builder.get_object("apply_presets_button")
self._transcoding_switch = builder.get_object("transcoding_switch")
self._edit_preset_switch = builder.get_object("edit_preset_switch")
@@ -277,14 +277,15 @@ class SettingsDialog:
self._picons_paths_box.set_active(0)
def show(self):
- self._dialog.run()
+ return self._dialog.run()
+
+ def is_updated(self):
+ return self._updated
def on_response(self, dialog, resp):
- if resp == Gtk.ResponseType.OK and not self.apply_settings():
- return
-
- self._dialog.destroy()
- return resp
+ if resp == Gtk.ResponseType.ACCEPT:
+ self._updated = self.on_save_settings()
+ dialog.destroy()
def on_field_icon_press(self, entry, icon, event_button):
update_entry_data(entry, self._dialog, self._settings)
@@ -376,9 +377,9 @@ class SettingsDialog:
self._settings.satellites_xml_path = self._satellites_xml_field.get_text()
self._settings.picons_path = self._picons_paths_box.get_active_id()
- def apply_settings(self, item=None):
+ def on_save_settings(self, item=None):
if show_dialog(DialogType.QUESTION, self._dialog) != Gtk.ResponseType.OK:
- return
+ return False
self.on_apply_profile_settings()
self._ext_settings.profiles = self._settings.profiles
@@ -423,6 +424,7 @@ class SettingsDialog:
self._ext_settings.default_profile = list(filter(lambda r: r[1], self._profile_view.get_model()))[0][0]
self._ext_settings.save()
+
return True
@run_task