diff --git a/app/properties.py b/app/properties.py index a6f3a1a9..b27984d2 100644 --- a/app/properties.py +++ b/app/properties.py @@ -45,6 +45,7 @@ def get_default_settings(): "services_path": "/etc/enigma2/", "user_bouquet_path": "/etc/enigma2/", "satellites_xml_path": "/etc/tuxbox/", "data_dir_path": DATA_PATH + "enigma2/", "picons_path": "/usr/share/enigma2/picon", "picons_dir_path": DATA_PATH + "enigma2/picons/", + "backup_dir_path": DATA_PATH + "enigma2/backup/", "backup_before_save": True, "backup_before_downloading": True, "v5_support": False, "http_api_support": False, "use_colors": True, "new_color": "rgb(255,230,204)", "extra_color": "rgb(179,230,204)"}, @@ -55,6 +56,7 @@ def get_default_settings(): "services_path": "/var/tuxbox/config/zapit/", "user_bouquet_path": "/var/tuxbox/config/zapit/", "satellites_xml_path": "/var/tuxbox/config/", "data_dir_path": DATA_PATH + "neutrino/", "picons_path": "/usr/share/tuxbox/neutrino/icons/logo/", "picons_dir_path": DATA_PATH + "neutrino/picons/", + "backup_dir_path": DATA_PATH + "neutrino/backup/", "backup_before_save": True, "backup_before_downloading": True}, "profile": Profile.ENIGMA_2.value} diff --git a/app/ui/backup.py b/app/ui/backup.py index 09603d9d..6f611c11 100644 --- a/app/ui/backup.py +++ b/app/ui/backup.py @@ -7,7 +7,7 @@ from datetime import datetime from enum import Enum from app.commons import run_idle -from app.properties import Profile +from app.properties import Profile, get_default_settings from app.ui.dialogs import show_dialog, DialogType from app.ui.main_helper import append_text_to_tview from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH @@ -19,22 +19,25 @@ class RestoreType(Enum): class BackupDialog: - def __init__(self, transient, data_path, profile, callback): + def __init__(self, transient, options, profile, callback): handlers = {"on_restore_bouquets": self.on_restore_bouquets, "on_restore_all": self.on_restore_all, "on_remove": self.on_remove, "on_view_popup_menu": self.on_view_popup_menu, "on_info_button_toggled": self.on_info_button_toggled, "on_info_bar_close": self.on_info_bar_close, - "on_cursor_changed": self.on_cursor_changed} + "on_cursor_changed": self.on_cursor_changed, + "on_resize": self.on_resize} builder = Gtk.Builder() builder.set_translation_domain("demon-editor") builder.add_from_file(UI_RESOURCES_PATH + "backup_dialog.glade") builder.connect_signals(handlers) - self._data_path = data_path - self._backup_path = data_path + "backup/" + def_settings = get_default_settings().get(profile.value) + self._options = options.get(profile.value) + self._data_path = options.get("data_dir_path", def_settings["data_dir_path"]) + self._backup_path = options.get("backup_dir_path", def_settings["backup_dir_path"]) self._profile = profile self._open_data_callback = callback self._dialog_window = builder.get_object("dialog_window") @@ -46,6 +49,11 @@ class BackupDialog: self._info_check_button = builder.get_object("info_check_button") self._info_bar = builder.get_object("info_bar") self._message_label = builder.get_object("message_label") + # Setting the last size of the dialog window if it was saved + window_size = self._options.get("backup_tool_window_size", None) + if window_size: + self._dialog_window.resize(*window_size) + self.init_data() def show(self): @@ -157,6 +165,10 @@ class BackupDialog: self.show_info_message("Done!", Gtk.MessageType.INFO) self._open_data_callback(self._data_path) + def on_resize(self, window): + if self._options: + self._options["backup_tool_window_size"] = window.get_size() + def backup_data(path): """ Creating data backup from a folder at the specified path """ diff --git a/app/ui/backup_dialog.glade b/app/ui/backup_dialog.glade index 94c95b86..87da6f06 100644 --- a/app/ui/backup_dialog.glade +++ b/app/ui/backup_dialog.glade @@ -50,6 +50,7 @@ Author: Dmitriy Yefremov True document-revert center + True diff --git a/app/ui/lang/ru/LC_MESSAGES/demon-editor.mo b/app/ui/lang/ru/LC_MESSAGES/demon-editor.mo index 6f2022d4..0aff6bcd 100644 Binary files a/app/ui/lang/ru/LC_MESSAGES/demon-editor.mo and b/app/ui/lang/ru/LC_MESSAGES/demon-editor.mo differ diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py index 8b1ea954..0788b666 100644 --- a/app/ui/main_app_window.py +++ b/app/ui/main_app_window.py @@ -1295,7 +1295,7 @@ class Application(Gtk.Application): def on_backup_tool_show(self, item): """ Shows backup tool dialog """ BackupDialog(self._main_window, - self._options.get(self._profile).get("data_dir_path", ""), + self._options, Profile(self._profile), self.open_data).show() diff --git a/app/ui/settings_dialog.glade b/app/ui/settings_dialog.glade index 3a10729d..39a93854 100644 --- a/app/ui/settings_dialog.glade +++ b/app/ui/settings_dialog.glade @@ -727,7 +727,7 @@ Author: Dmitriy Yefremov 2 True - + True False Services and Bouquets files: @@ -751,8 +751,7 @@ Author: Dmitriy Yefremov - - True + False User bouquet files: 2.2351741291171123e-10 @@ -764,8 +763,6 @@ Author: Dmitriy Yefremov - True - False True /etc/enigma2/ gtk-edit @@ -776,7 +773,7 @@ Author: Dmitriy Yefremov - + True False Satellites.xml file: @@ -800,7 +797,7 @@ Author: Dmitriy Yefremov - + True False Picons: @@ -855,7 +852,7 @@ Author: Dmitriy Yefremov 2 True - + True False Picons path: @@ -872,8 +869,10 @@ Author: Dmitriy Yefremov True /data/picons gtk-edit - folder-open-symbolic - + folder-open + False + Select + 0 @@ -881,7 +880,7 @@ Author: Dmitriy Yefremov - + True False Data path: @@ -899,17 +898,45 @@ Author: Dmitriy Yefremov True /data gtk-edit - folder-open-symbolic + folder-open False Select Select - + 0 1 + + + True + False + Backup path: + 0.019999999552965164 + + + 0 + 4 + + + + + True + True + /data/backup + gtk-edit + folder-open + False + Select + + + + 0 + 5 + + diff --git a/app/ui/settings_dialog.py b/app/ui/settings_dialog.py index 44386504..4d1feaab 100644 --- a/app/ui/settings_dialog.py +++ b/app/ui/settings_dialog.py @@ -23,8 +23,7 @@ class Property(Enum): class SettingsDialog: def __init__(self, transient, options): - handlers = {"on_data_dir_field_icon_press": self.on_data_dir_field_icon_press, - "on_picons_dir_field_icon_press": self.on_picons_dir_field_icon_press, + handlers = {"on_field_icon_press": self.on_field_icon_press, "on_profile_changed": self.on_profile_changed, "on_reset": self.on_reset, "apply_settings": self.apply_settings, @@ -60,6 +59,7 @@ class SettingsDialog: self._data_dir_field = builder.get_object("data_dir_field") self._picons_field = builder.get_object("picons_field") self._picons_dir_field = builder.get_object("picons_dir_field") + self._backup_dir_field = builder.get_object("backup_dir_field") # Info bar self._info_bar = builder.get_object("info_bar") self._message_label = builder.get_object("info_bar_message_label") @@ -98,10 +98,7 @@ class SettingsDialog: return response - def on_data_dir_field_icon_press(self, entry, icon, event_button): - update_entry_data(entry, self._dialog, self._options.get(self._options.get("profile"))) - - def on_picons_dir_field_icon_press(self, entry, icon, event_button): + def on_field_icon_press(self, entry, icon, event_button): update_entry_data(entry, self._dialog, self._options.get(self._options.get("profile"))) def on_profile_changed(self, item): @@ -130,26 +127,29 @@ class SettingsDialog: self.set_settings() def set_settings(self): + def_settings = get_default_settings().get(self._active_profile) options = self._options.get(self._active_profile) - self._host_field.set_text(options.get("host", "")) - self._port_field.set_text(options.get("port", "")) - self._login_field.set_text(options.get("user", "")) - self._password_field.set_text(options.get("password", "")) - self._http_login_field.set_text(options.get("http_user", "")) - self._http_password_field.set_text(options.get("http_password", "")) - self._http_port_field.set_text(options.get("http_port", "80")) - self._telnet_login_field.set_text(options.get("telnet_user", "")) - self._telnet_password_field.set_text(options.get("telnet_password", "")) - self._telnet_port_field.set_text(options.get("telnet_port", "")) - self._telnet_timeout_spin_button.set_value(options.get("telnet_timeout", 5)) - self._services_field.set_text(options.get("services_path", "")) - self._user_bouquet_field.set_text(options.get("user_bouquet_path", "")) - self._satellites_xml_field.set_text(options.get("satellites_xml_path", "")) - self._picons_field.set_text(options.get("picons_path", "")) - self._data_dir_field.set_text(options.get("data_dir_path", "")) - self._picons_dir_field.set_text(options.get("picons_dir_path", "")) - self._before_save_switch.set_active(options.get("backup_before_save", True)) - self._before_downloading_switch.set_active(options.get("backup_before_downloading", True)) + self._host_field.set_text(options.get("host", def_settings["host"])) + self._port_field.set_text(options.get("port", def_settings["port"])) + self._login_field.set_text(options.get("user", def_settings["user"])) + self._password_field.set_text(options.get("password", def_settings["password"])) + self._http_login_field.set_text(options.get("http_user", def_settings["http_user"])) + self._http_password_field.set_text(options.get("http_password", def_settings["http_password"])) + self._http_port_field.set_text(options.get("http_port", def_settings["http_port"])) + self._telnet_login_field.set_text(options.get("telnet_user", def_settings["telnet_user"])) + self._telnet_password_field.set_text(options.get("telnet_password", def_settings["telnet_password"])) + self._telnet_port_field.set_text(options.get("telnet_port", def_settings["telnet_port"])) + self._telnet_timeout_spin_button.set_value(options.get("telnet_timeout", def_settings["telnet_timeout"])) + self._services_field.set_text(options.get("services_path", def_settings["services_path"])) + self._user_bouquet_field.set_text(options.get("user_bouquet_path", def_settings["user_bouquet_path"])) + self._satellites_xml_field.set_text(options.get("satellites_xml_path", def_settings["satellites_xml_path"])) + self._picons_field.set_text(options.get("picons_path", def_settings["picons_path"])) + self._data_dir_field.set_text(options.get("data_dir_path", def_settings["data_dir_path"])) + self._picons_dir_field.set_text(options.get("picons_dir_path", def_settings["picons_dir_path"])) + self._backup_dir_field.set_text(options.get("backup_dir_path", def_settings["backup_dir_path"])) + self._before_save_switch.set_active(options.get("backup_before_save", def_settings["backup_before_save"])) + self._before_downloading_switch.set_active(options.get("backup_before_downloading", + def_settings["backup_before_downloading"])) if Profile(self._active_profile) is Profile.ENIGMA_2: self._support_ver5_check_button.set_active(options.get("v5_support", False)) @@ -184,6 +184,7 @@ class SettingsDialog: options["picons_path"] = self._picons_field.get_text() options["data_dir_path"] = self._data_dir_field.get_text() options["picons_dir_path"] = self._picons_dir_field.get_text() + options["backup_dir_path"] = self._backup_dir_field.get_text() options["backup_before_save"] = self._before_save_switch.get_active() options["backup_before_downloading"] = self._before_downloading_switch.get_active() diff --git a/deb/usr/share/locale/ru/LC_MESSAGES/demon-editor.mo b/deb/usr/share/locale/ru/LC_MESSAGES/demon-editor.mo index 6f2022d4..0aff6bcd 100644 Binary files a/deb/usr/share/locale/ru/LC_MESSAGES/demon-editor.mo and b/deb/usr/share/locale/ru/LC_MESSAGES/demon-editor.mo differ diff --git a/po/ru/demon-editor.po b/po/ru/demon-editor.po index b0dadaeb..5eace9a1 100644 --- a/po/ru/demon-editor.po +++ b/po/ru/demon-editor.po @@ -592,6 +592,9 @@ msgstr "Резервное копирование" msgid "Backups" msgstr "Резервные копии" +msgid "Backup path:" +msgstr "Путь к резервным копиям:" + msgid "Restore bouquets" msgstr "Восстановить букеты" @@ -613,6 +616,9 @@ msgstr "Помеченные как новые:" msgid "With an extra name in the bouquet:" msgstr "С пользовательским именем в букете:" +msgid "Select" +msgstr "Выбрать" + msgid "About" msgstr "О программе"