diff --git a/MRobot.iss b/MRobot.iss index f2ac647..ae7d594 100644 --- a/MRobot.iss +++ b/MRobot.iss @@ -9,9 +9,6 @@ OutputBaseFilename=MRobotInstaller [Files] Source: "dist\MRobot.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "assets\logo\*"; DestDir: "{app}\assets\logo"; Flags: ignoreversion recursesubdirs -Source: "assets\User_code\*"; DestDir: "{app}\assets\User_code"; Flags: ignoreversion recursesubdirs -Source: "assets\mech_lib\*"; DestDir: "{app}\assets\mech_lib"; Flags: ignoreversion recursesubdirs -Source: "assets\logo\M.ico"; DestDir: "{app}\assets\logo"; Flags: ignoreversion [Icons] Name: "{group}\MRobot"; Filename: "{app}\MRobot.exe"; IconFilename: "{app}\assets\logo\M.ico" diff --git a/README.md b/README.md index cad5bcb..9d2722c 100644 --- a/README.md +++ b/README.md @@ -86,5 +86,5 @@ 使用以下命令构建可执行文件: ```bash -pyinstaller MRobot.py --onefile --windowed --add-data "assets;assets" --add-data "app;app" --add-data "app/tools;app/tools" +pyinstaller MRobot.py --onefile --windowed --add-data "assets/logo;assets/logo" --add-data "app;app" --add-data "app/tools;app/tools" ``` \ No newline at end of file diff --git a/app/__pycache__/__init__.cpython-39.pyc b/app/__pycache__/__init__.cpython-39.pyc index 9dd2ee6..121d291 100644 Binary files a/app/__pycache__/__init__.cpython-39.pyc and b/app/__pycache__/__init__.cpython-39.pyc differ diff --git a/app/__pycache__/about_interface.cpython-39.pyc b/app/__pycache__/about_interface.cpython-39.pyc index 3490f28..2791c9f 100644 Binary files a/app/__pycache__/about_interface.cpython-39.pyc and b/app/__pycache__/about_interface.cpython-39.pyc differ diff --git a/app/__pycache__/ai_interface.cpython-39.pyc b/app/__pycache__/ai_interface.cpython-39.pyc index aee47f8..8ee1332 100644 Binary files a/app/__pycache__/ai_interface.cpython-39.pyc and b/app/__pycache__/ai_interface.cpython-39.pyc differ diff --git a/app/__pycache__/batch_export_dialog.cpython-39.pyc b/app/__pycache__/batch_export_dialog.cpython-39.pyc new file mode 100644 index 0000000..8eb294b Binary files /dev/null and b/app/__pycache__/batch_export_dialog.cpython-39.pyc differ diff --git a/app/__pycache__/category_management_dialog.cpython-39.pyc b/app/__pycache__/category_management_dialog.cpython-39.pyc new file mode 100644 index 0000000..662d16e Binary files /dev/null and b/app/__pycache__/category_management_dialog.cpython-39.pyc differ diff --git a/app/__pycache__/code_configuration_interface.cpython-39.pyc b/app/__pycache__/code_configuration_interface.cpython-39.pyc index 42472b8..bfc26be 100644 Binary files a/app/__pycache__/code_configuration_interface.cpython-39.pyc and b/app/__pycache__/code_configuration_interface.cpython-39.pyc differ diff --git a/app/__pycache__/code_generate_interface.cpython-39.pyc b/app/__pycache__/code_generate_interface.cpython-39.pyc index e239a45..7cb682c 100644 Binary files a/app/__pycache__/code_generate_interface.cpython-39.pyc and b/app/__pycache__/code_generate_interface.cpython-39.pyc differ diff --git a/app/__pycache__/data_interface.cpython-39.pyc b/app/__pycache__/data_interface.cpython-39.pyc index 7df10bd..5b32c94 100644 Binary files a/app/__pycache__/data_interface.cpython-39.pyc and b/app/__pycache__/data_interface.cpython-39.pyc differ diff --git a/app/__pycache__/finance_interface.cpython-39.pyc b/app/__pycache__/finance_interface.cpython-39.pyc new file mode 100644 index 0000000..967722b Binary files /dev/null and b/app/__pycache__/finance_interface.cpython-39.pyc differ diff --git a/app/__pycache__/function_fit_interface.cpython-39.pyc b/app/__pycache__/function_fit_interface.cpython-39.pyc index 886cba0..66edcfa 100644 Binary files a/app/__pycache__/function_fit_interface.cpython-39.pyc and b/app/__pycache__/function_fit_interface.cpython-39.pyc differ diff --git a/app/__pycache__/home_interface.cpython-39.pyc b/app/__pycache__/home_interface.cpython-39.pyc index 311a744..c6ce228 100644 Binary files a/app/__pycache__/home_interface.cpython-39.pyc and b/app/__pycache__/home_interface.cpython-39.pyc differ diff --git a/app/__pycache__/main_window.cpython-39.pyc b/app/__pycache__/main_window.cpython-39.pyc index 8e971ac..a8602e4 100644 Binary files a/app/__pycache__/main_window.cpython-39.pyc and b/app/__pycache__/main_window.cpython-39.pyc differ diff --git a/app/__pycache__/mini_tool_interface.cpython-39.pyc b/app/__pycache__/mini_tool_interface.cpython-39.pyc index 79f3a2a..a8c9259 100644 Binary files a/app/__pycache__/mini_tool_interface.cpython-39.pyc and b/app/__pycache__/mini_tool_interface.cpython-39.pyc differ diff --git a/app/__pycache__/part_library_interface.cpython-39.pyc b/app/__pycache__/part_library_interface.cpython-39.pyc index 74e20b5..235b83e 100644 Binary files a/app/__pycache__/part_library_interface.cpython-39.pyc and b/app/__pycache__/part_library_interface.cpython-39.pyc differ diff --git a/app/__pycache__/serial_terminal_interface.cpython-39.pyc b/app/__pycache__/serial_terminal_interface.cpython-39.pyc index 9671994..b65c683 100644 Binary files a/app/__pycache__/serial_terminal_interface.cpython-39.pyc and b/app/__pycache__/serial_terminal_interface.cpython-39.pyc differ diff --git a/app/code_page/__pycache__/bsp_interface.cpython-39.pyc b/app/code_page/__pycache__/bsp_interface.cpython-39.pyc index 397cf95..b64011f 100644 Binary files a/app/code_page/__pycache__/bsp_interface.cpython-39.pyc and b/app/code_page/__pycache__/bsp_interface.cpython-39.pyc differ diff --git a/app/home_interface.py b/app/home_interface.py index 4ba30be..678e166 100644 --- a/app/home_interface.py +++ b/app/home_interface.py @@ -5,10 +5,20 @@ import sys import os def resource_path(relative_path): - """获取资源文件的绝对路径,兼容打包和开发环境""" - if hasattr(sys, '_MEIPASS'): - # PyInstaller 打包后的临时目录 - return os.path.join(sys._MEIPASS, relative_path) + """获取资源文件的绝对路径,兼容打包和开发环境 + 对于 logo 文件,使用打包的临时目录(只有 logo 被打包) + 对于其他资源,使用可执行文件所在目录 + """ + if getattr(sys, 'frozen', False): + # 打包环境 + if 'logo' in relative_path: + # logo 文件使用打包的临时目录 + if hasattr(sys, '_MEIPASS'): + return os.path.join(sys._MEIPASS, relative_path) + # 其他资源使用可执行文件所在目录 + exe_dir = os.path.dirname(sys.executable) + return os.path.join(exe_dir, relative_path) + # 开发环境 return os.path.join(os.path.abspath("."), relative_path) class HomeInterface(QWidget): diff --git a/app/tools/__pycache__/analyzing_ioc.cpython-39.pyc b/app/tools/__pycache__/analyzing_ioc.cpython-39.pyc index 0310cdc..00dd03d 100644 Binary files a/app/tools/__pycache__/analyzing_ioc.cpython-39.pyc and b/app/tools/__pycache__/analyzing_ioc.cpython-39.pyc differ diff --git a/app/tools/__pycache__/auto_updater.cpython-39.pyc b/app/tools/__pycache__/auto_updater.cpython-39.pyc index a67e931..007de98 100644 Binary files a/app/tools/__pycache__/auto_updater.cpython-39.pyc and b/app/tools/__pycache__/auto_updater.cpython-39.pyc differ diff --git a/app/tools/__pycache__/check_update.cpython-39.pyc b/app/tools/__pycache__/check_update.cpython-39.pyc index 8f378d9..65d4b7a 100644 Binary files a/app/tools/__pycache__/check_update.cpython-39.pyc and b/app/tools/__pycache__/check_update.cpython-39.pyc differ diff --git a/app/tools/__pycache__/code_generator.cpython-39.pyc b/app/tools/__pycache__/code_generator.cpython-39.pyc index 390ddd7..fcc5e55 100644 Binary files a/app/tools/__pycache__/code_generator.cpython-39.pyc and b/app/tools/__pycache__/code_generator.cpython-39.pyc differ diff --git a/app/tools/__pycache__/code_task_config.cpython-39.pyc b/app/tools/__pycache__/code_task_config.cpython-39.pyc index 6aba332..9052484 100644 Binary files a/app/tools/__pycache__/code_task_config.cpython-39.pyc and b/app/tools/__pycache__/code_task_config.cpython-39.pyc differ diff --git a/app/tools/__pycache__/finance_manager.cpython-39.pyc b/app/tools/__pycache__/finance_manager.cpython-39.pyc new file mode 100644 index 0000000..dfb545a Binary files /dev/null and b/app/tools/__pycache__/finance_manager.cpython-39.pyc differ diff --git a/app/tools/__pycache__/part_download.cpython-39.pyc b/app/tools/__pycache__/part_download.cpython-39.pyc index dc02841..81d155e 100644 Binary files a/app/tools/__pycache__/part_download.cpython-39.pyc and b/app/tools/__pycache__/part_download.cpython-39.pyc differ diff --git a/app/tools/__pycache__/update_check_thread.cpython-39.pyc b/app/tools/__pycache__/update_check_thread.cpython-39.pyc index a77f001..b46ec3c 100644 Binary files a/app/tools/__pycache__/update_check_thread.cpython-39.pyc and b/app/tools/__pycache__/update_check_thread.cpython-39.pyc differ diff --git a/app/tools/__pycache__/update_code.cpython-39.pyc b/app/tools/__pycache__/update_code.cpython-39.pyc index cc982da..63ba87c 100644 Binary files a/app/tools/__pycache__/update_code.cpython-39.pyc and b/app/tools/__pycache__/update_code.cpython-39.pyc differ diff --git a/app/tools/code_generator.py b/app/tools/code_generator.py index 5549df1..676c581 100644 --- a/app/tools/code_generator.py +++ b/app/tools/code_generator.py @@ -97,29 +97,19 @@ class CodeGenerator: assets_dir = "" if getattr(sys, 'frozen', False): - # 打包后的环境 - print("检测到打包环境") + # 打包后的环境 - 始终使用可执行文件所在目录 + # 这样可以使用安装目录下的文件,而不是打包进去的文件 + exe_dir = os.path.dirname(sys.executable) + assets_dir = os.path.join(exe_dir, "assets") + print(f"打包环境:使用可执行文件目录: {assets_dir}") - # 优先使用sys._MEIPASS(PyInstaller的临时解包目录) - if hasattr(sys, '_MEIPASS'): - base_path = getattr(sys, '_MEIPASS') - assets_dir = os.path.join(base_path, "assets") - print(f"使用PyInstaller临时目录: {assets_dir}") - else: - # 后备方案:使用可执行文件所在目录 - exe_dir = os.path.dirname(sys.executable) - assets_dir = os.path.join(exe_dir, "assets") - print(f"使用可执行文件目录: {assets_dir}") - - # 如果都不存在,尝试其他可能的位置 + # 如果assets目录不存在,创建它 if not os.path.exists(assets_dir): - # 尝试从当前工作目录查找 - cwd_assets = os.path.join(os.getcwd(), "assets") - if os.path.exists(cwd_assets): - assets_dir = cwd_assets - print(f"从工作目录找到assets: {assets_dir}") - else: - print(f"警告:无法找到assets目录,使用默认路径: {assets_dir}") + try: + os.makedirs(assets_dir, exist_ok=True) + print(f"创建assets目录: {assets_dir}") + except Exception as e: + print(f"创建assets目录失败: {e}") else: # 开发环境 current_dir = os.path.dirname(os.path.abspath(__file__)) diff --git a/assets/Finance_Data/accounts/7751771f-1363-4606-b292-2db511004bae/metadata.json b/assets/Finance_Data/accounts/7751771f-1363-4606-b292-2db511004bae/metadata.json new file mode 100644 index 0000000..0b87776 --- /dev/null +++ b/assets/Finance_Data/accounts/7751771f-1363-4606-b292-2db511004bae/metadata.json @@ -0,0 +1,8 @@ +{ + "id": "7751771f-1363-4606-b292-2db511004bae", + "name": "admin", + "description": "默认管理账户", + "categories": [], + "created_at": "2025-12-29T20:48:32.536465", + "updated_at": "2025-12-29T20:48:32.536472" +} \ No newline at end of file