diff --git a/MRobot.iss b/MRobot.iss index f6208d4..497644d 100644 --- a/MRobot.iss +++ b/MRobot.iss @@ -1,6 +1,6 @@ [Setup] AppName=MRobot -AppVersion=1.1.0 +AppVersion=1.1.1 DefaultDirName={userappdata}\MRobot DefaultGroupName=MRobot OutputDir=. diff --git a/app/__pycache__/__init__.cpython-39.pyc b/app/__pycache__/__init__.cpython-39.pyc index 121d291..d064b6b 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 2791c9f..0229bca 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 8ee1332..349e7de 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 index 8eb294b..e94eba2 100644 Binary files a/app/__pycache__/batch_export_dialog.cpython-39.pyc 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 index 662d16e..f77c6ce 100644 Binary files a/app/__pycache__/category_management_dialog.cpython-39.pyc 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 bfc26be..993ebde 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 7cb682c..e1fcdcb 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 5b32c94..1082ba2 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 index 967722b..d1f2e53 100644 Binary files a/app/__pycache__/finance_interface.cpython-39.pyc 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 66edcfa..6132bc0 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 c6ce228..0f1e54c 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 a8602e4..ff2b933 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 a8c9259..f5bceaf 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 235b83e..aefcd13 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 b65c683..9270ed1 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/about_interface.py b/app/about_interface.py index 624229c..fc9091d 100644 --- a/app/about_interface.py +++ b/app/about_interface.py @@ -15,7 +15,7 @@ from app.tools.check_update import check_update from app.tools.auto_updater import AutoUpdater, check_update_availability from app.tools.update_check_thread import UpdateCheckThread -__version__ = "1.1.0" +__version__ = "1.1.1" class AboutInterface(QWidget): def __init__(self, parent=None): diff --git a/app/code_configuration_interface.py b/app/code_configuration_interface.py index 2c521a5..f8c8820 100644 --- a/app/code_configuration_interface.py +++ b/app/code_configuration_interface.py @@ -2,16 +2,55 @@ from PyQt5.QtWidgets import QWidget, QVBoxLayout, QStackedWidget, QSizePolicy from PyQt5.QtCore import Qt from qfluentwidgets import PushSettingCard, FluentIcon, TabBar from qfluentwidgets import TitleLabel, BodyLabel, PushButton, FluentIcon -from PyQt5.QtWidgets import QFileDialog, QDialog, QHBoxLayout +from PyQt5.QtWidgets import QFileDialog, QHBoxLayout from qfluentwidgets import ComboBox, PrimaryPushButton, SubtitleLabel +from qfluentwidgets import MessageBoxBase, InfoBar import os +import sys import shutil import tempfile from .function_fit_interface import FunctionFitInterface from .ai_interface import AIInterface -from qfluentwidgets import InfoBar from .tools.update_code import update_code from .code_generate_interface import CodeGenerateInterface +from .tools.code_generator import CodeGenerator + + +class PresetIocDialog(MessageBoxBase): + """预设IOC选择对话框 - Fluent设计风格""" + def __init__(self, preset_files, parent=None): + super().__init__(parent) + self.preset_files = preset_files + self.titleLabel = SubtitleLabel("选择要使用的IOC模版") + + # 选择下拉框 + self.select_label = BodyLabel("预设IOC:") + self.preset_combo = ComboBox() + + for preset in preset_files: + self.preset_combo.addItem(preset['name']) + + # 添加控件到布局 + self.viewLayout.addWidget(self.titleLabel) + self.viewLayout.addSpacing(12) + + select_layout = QHBoxLayout() + select_layout.addWidget(self.select_label) + select_layout.addWidget(self.preset_combo, 1) + self.viewLayout.addLayout(select_layout) + + # 设置对话框属性 + self.widget.setMinimumWidth(400) + self.yesButton.setText("保存到") + self.cancelButton.setText("取消") + + def get_selected_preset(self): + """获取选中的预设""" + selected_index = self.preset_combo.currentIndex() + if 0 <= selected_index < len(self.preset_files): + return self.preset_files[selected_index] + return None + class CodeConfigurationInterface(QWidget): def __init__(self, parent=None): @@ -99,7 +138,9 @@ class CodeConfigurationInterface(QWidget): def get_preset_ioc_files(self): """获取预设的ioc文件列表""" try: - preset_ioc_dir = os.path.join(os.path.dirname(os.path.dirname(__file__)), "assets", "User_code", "ioc") + # 使用CodeGenerator统一的assets路径获取方法 + preset_ioc_dir = CodeGenerator.get_assets_dir("User_code/ioc") + if not os.path.exists(preset_ioc_dir): return [] @@ -128,54 +169,11 @@ class CodeConfigurationInterface(QWidget): ) return - # 创建选择对话框 - dialog = QDialog(self) - dialog.setWindowTitle("获取预设IOC") - dialog.resize(400, 200) - dialog.setModal(True) - - layout = QVBoxLayout(dialog) - layout.setContentsMargins(24, 24, 24, 24) - layout.setSpacing(16) - - # 标题 - title_label = SubtitleLabel("选择要使用的IOC模版") - layout.addWidget(title_label) - - # 选择下拉框 - select_layout = QHBoxLayout() - select_label = BodyLabel("预设IOC:") - preset_combo = ComboBox() - - # 修复ComboBox数据问题 - for i, preset in enumerate(preset_files): - preset_combo.addItem(preset['name']) - - select_layout.addWidget(select_label) - select_layout.addWidget(preset_combo) - layout.addLayout(select_layout) - - layout.addSpacing(16) - - # 按钮区域 - btn_layout = QHBoxLayout() - btn_layout.addStretch() - - cancel_btn = PushButton("取消") - ok_btn = PrimaryPushButton("保存到") - - cancel_btn.clicked.connect(dialog.reject) - ok_btn.clicked.connect(dialog.accept) - - btn_layout.addWidget(cancel_btn) - btn_layout.addWidget(ok_btn) - layout.addLayout(btn_layout) - - # 显示对话框 - if dialog.exec() == QDialog.Accepted: - selected_index = preset_combo.currentIndex() - if selected_index >= 0 and selected_index < len(preset_files): - selected_preset = preset_files[selected_index] + # 创建Fluent风格的对话框 + dialog = PresetIocDialog(preset_files, self) + if dialog.exec(): + selected_preset = dialog.get_selected_preset() + if selected_preset: self.save_preset_template(selected_preset) def save_preset_template(self, preset_info): diff --git a/app/code_page/__pycache__/bsp_interface.cpython-39.pyc b/app/code_page/__pycache__/bsp_interface.cpython-39.pyc index b64011f..72a66fa 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/tools/__pycache__/analyzing_ioc.cpython-39.pyc b/app/tools/__pycache__/analyzing_ioc.cpython-39.pyc index 00dd03d..cb1bfe9 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 007de98..6c82d57 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 65d4b7a..4ae9c79 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 fcc5e55..13151c7 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 9052484..bfefab7 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 index dfb545a..92ee3bf 100644 Binary files a/app/tools/__pycache__/finance_manager.cpython-39.pyc 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 81d155e..5bce7a5 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 b46ec3c..9fa638b 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 63ba87c..4a39eff 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/config/config.json b/config/config.json index 984f7b9..5c3cfec 100644 --- a/config/config.json +++ b/config/config.json @@ -1,6 +1,6 @@ { "QFluentWidgets": { "ThemeColor": "#fff18cb9", - "ThemeMode": "Light" + "ThemeMode": "Dark" } } \ No newline at end of file