* moved call check_remote_hashes into module_parsing

Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
2024-05-12 18:00:22 +07:00
parent bafcb26fbe
commit b9607db785
2 changed files with 9 additions and 11 deletions

View File

@@ -10,7 +10,7 @@ from PyQt5.QtGui import QRegExpValidator
from PyQt5.QtWidgets import QDialog, QFileDialog
from dataIO import dataIO
from module_parsing.script import check_remote_hashes, update_configs
from module_parsing.script import update_configs
from module_second.script import SecondWindow
from statics import update_config_name
from util import *
@@ -35,9 +35,7 @@ class MainWindow(QDialog, Ui_MainWindow):
update_bool = update_cfg.get("update_on_start")
if update_bool:
self.ui.updates_checkbox.setChecked(update_bool)
update_list = check_remote_hashes()
if update_list and len(update_list) > 0:
update_configs(update_list)
update_configs()
self.file_path = ""
self.old_file = ""

View File

@@ -52,15 +52,15 @@ def check_remote_hashes():
return False
def update_configs(cfg_list):
"""
:param cfg_list: config list to update
"""
progress = QProgressDialog("Downloading configs...", None, 0, len(cfg_list), flags=Qt.Window | Qt.WindowTitleHint)
def update_configs():
update_list = check_remote_hashes()
if not update_list or len(update_list) == 0:
return
progress = QProgressDialog("Downloading configs...", None, 0, len(update_list), flags=Qt.Window | Qt.WindowTitleHint)
progress.setWindowTitle("Download progress")
progress.setWindowModality(Qt.WindowModal)
progress.show()
for cfg in cfg_list:
for cfg in update_list:
check_path(cfg)
response_status, response = get_response_result(github_link + cfg)
if response_status:
@@ -69,5 +69,5 @@ def update_configs(cfg_list):
dataIO.save_json(cfg, remote_cfg)
progress.setValue(progress.value()+1)
QApplication.processEvents()
progress.setValue(len(cfg_list))
progress.setValue(len(update_list))
QApplication.processEvents()