mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2026-01-16 04:23:35 +01:00
separated data load/upload for the satellite tab
This commit is contained in:
@@ -443,7 +443,7 @@ def download_data(*, settings, download_type=DownloadType.ALL, callback=log, fil
|
||||
ftp.download_files(save_path, file_list, callback)
|
||||
# *.xml and webtv
|
||||
if download_type in (DownloadType.ALL, DownloadType.SATELLITES):
|
||||
ftp.download_xml(save_path, settings.satellites_xml_path, STC_XML_FILE, callback)
|
||||
ftp.download_xml(save_path, settings.satellites_xml_path, files_filter or STC_XML_FILE, callback)
|
||||
if download_type in (DownloadType.ALL, DownloadType.WEBTV):
|
||||
ftp.download_xml(save_path, settings.satellites_xml_path, WEB_TV_XML_FILE, callback)
|
||||
|
||||
@@ -524,7 +524,7 @@ def upload_data(*, settings, download_type=DownloadType.ALL, callback=log, done_
|
||||
|
||||
if download_type is DownloadType.ALL or download_type is DownloadType.SERVICES:
|
||||
if download_type is DownloadType.ALL:
|
||||
ftp.upload_xml(data_path, sat_xml_path, STC_XML_FILE, callback)
|
||||
ftp.upload_xml(data_path, sat_xml_path, files_filter or STC_XML_FILE, callback)
|
||||
|
||||
if s_type is SettingsType.NEUTRINO_MP:
|
||||
ftp.upload_xml(data_path, sat_xml_path, WEB_TV_XML_FILE, callback)
|
||||
|
||||
@@ -2215,7 +2215,7 @@ class Application(Gtk.Application):
|
||||
self.on_task_done(app, task)
|
||||
|
||||
@run_task
|
||||
def on_download_data(self, download_type=DownloadType.ALL):
|
||||
def on_download_data(self, download_type=DownloadType.ALL, files_filter=None):
|
||||
backup, backup_src, data_path = self._settings.backup_before_downloading, None, None
|
||||
try:
|
||||
if backup and download_type is not DownloadType.SATELLITES:
|
||||
@@ -2223,7 +2223,7 @@ class Application(Gtk.Application):
|
||||
backup_path = self._settings.profile_backup_path or self._settings.default_backup_path
|
||||
backup_src = backup_data(data_path, backup_path, download_type is DownloadType.ALL)
|
||||
|
||||
download_data(settings=self._settings, download_type=download_type)
|
||||
download_data(settings=self._settings, download_type=download_type, files_filter=files_filter)
|
||||
except Exception as e:
|
||||
msg = "Downloading data error: {}"
|
||||
log(msg.format(e), debug=self._settings.debug_mode, fmt_message=msg)
|
||||
@@ -2236,12 +2236,12 @@ class Application(Gtk.Application):
|
||||
else:
|
||||
GLib.idle_add(self.open_data)
|
||||
|
||||
def on_upload_data(self, download_type=DownloadType.ALL):
|
||||
def on_upload_data(self, download_type=DownloadType.ALL, files_filter=None):
|
||||
if not self.is_data_saved():
|
||||
gen = self.save_data(lambda: self.upload_data(download_type))
|
||||
gen = self.save_data(lambda: self.upload_data(download_type, files_filter=files_filter))
|
||||
GLib.idle_add(lambda: next(gen, False), priority=GLib.PRIORITY_LOW)
|
||||
else:
|
||||
self.upload_data(download_type)
|
||||
self.upload_data(download_type, files_filter=files_filter)
|
||||
|
||||
@run_task
|
||||
def upload_data(self, download_type, files_filter=None):
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2018-2024 Dmitriy Yefremov
|
||||
# Copyright (c) 2018-2025 Dmitriy Yefremov
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -580,11 +580,11 @@ class SatellitesTool(Gtk.Box):
|
||||
|
||||
def on_download(self, app, page):
|
||||
if page is Page.SATELLITE:
|
||||
self._app.on_download_data(DownloadType.SATELLITES)
|
||||
self._app.on_download_data(DownloadType.SATELLITES, files_filter=(f"{self._dvb_type}.xml",))
|
||||
|
||||
def on_upload(self, app, page):
|
||||
if page is Page.SATELLITE:
|
||||
self._app.upload_data(DownloadType.SATELLITES)
|
||||
self._app.upload_data(DownloadType.SATELLITES, files_filter=(f"{self._dvb_type}.xml",))
|
||||
|
||||
@run_idle
|
||||
def on_update(self, item=None):
|
||||
|
||||
Reference in New Issue
Block a user