diff --git a/.vscode/settings.json b/.vscode/settings.json index 9b59ae2..95575a1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,7 +4,8 @@ "markdown-preview-enhanced.revealjsTheme": "black.css", "markdown-preview-enhanced.previewTheme": "atom-dark.css", "files.associations": { - "*.qss": "css" + "*.qss": "css", + "*.gui": "json" }, "gitLineAuthor.colorConfigs": [ { diff --git a/Gui/hooks/zip_json.py b/Gui/hooks/zip_json.py new file mode 100644 index 0000000..4250e12 --- /dev/null +++ b/Gui/hooks/zip_json.py @@ -0,0 +1,11 @@ +import json +import sys + +def zip_json(json_file): + with open(json_file, 'r') as f: + data = json.load(f) + with open(json_file, 'w') as f: + json.dump(data, f, ensure_ascii=False) + +if __name__ == '__main__': + zip_json(sys.argv[1]) \ No newline at end of file diff --git a/Gui/install_pack.py b/Gui/install_pack.py index 9f225e7..80555cd 100644 --- a/Gui/install_pack.py +++ b/Gui/install_pack.py @@ -832,12 +832,14 @@ def closeEvent(self, event): shared_memory = QSharedMemory(mem_id[2]) if shared_memory.attach(): # 已经有一个实例在运行 + QMessageBox.critical(None, get_init_lang('1d'), get_init_lang('33')) sys.exit(2) shared_memory.create(1) is_running = any(list(map(lambda x: QSharedMemory(x).attach(), mem_id[3:4]))) if is_running: # 已经有一个实例在运行 + QMessageBox.critical(None, get_init_lang('1d'), get_init_lang('31')) sys.exit(2) is_ipk = '--ipk' in app.arguments() @@ -886,11 +888,6 @@ def closeEvent(self, event): sys.exit(1) if is_admin(): - is_running = any(list(map(lambda x: QSharedMemory(x).attach(), mem_id[3:4]))) - if is_running: - # 已经有一个实例在运行 - sys.exit(2) - has_package = os.path.exists(get_resource_path('packages')) if not has_package: QMessageBox.warning(None, get_ipk_lang('1d'), get_ipk_lang('1f')) diff --git a/Gui/main.py b/Gui/main.py index 5955147..65d68b9 100644 --- a/Gui/main.py +++ b/Gui/main.py @@ -17,7 +17,7 @@ from uiStyles import indexes as style_indexes # 界面组件样式索引 from sharelibs import (run_software, langs, create_shortcut, __version__, is_pre, get_icon, default_button_text, get_unit_value, unit_lang, get_size_text, get_file_hash, system_lang, settings, QtThread, - default_settings, mem_id, get_resource_path, run_as_admin, get_lang, multi_replace) # 共享库 + default_settings, mem_id, get_resource_path, run_as_admin, get_lang, set_style, compile_ui, UIWindow) # 共享库 import parse_dev # 解析开发固件配置 import winreg # 注册表库 import math # 数学库 @@ -251,20 +251,6 @@ def get_now_filetime(): little_endian = struct.pack('