Files
mil_sdk/mil/__init__.py
T
feifei.xu f188055228 清理无用代码、合并工具链、修复注释与日志问题
- 删除破损文件: main.py/main.ui/main_ui.py
- 删除 runtime_hook.py(归宿主维护),清除 tools/ 目录
- 合并 export_runtime/pack_zip/verify_companions 到 build_pyd.py
- 修复注释: docstring 参数与实际签名不一致、过时引用、拼写错误
- 修复日志: 消除静默吞异常、删冗余 log+raise、补缺失日志
- 精简 .gitignore
2026-07-21 18:14:34 +08:00

53 lines
2.7 KiB
Python

import re
from .ui.mil_tool import FrameMILTool
from .core.companion_loader import load_companions
from .core.manifest import COMPANION_PACKAGES
# 工具名称
NMAE = "MIL Tool"
# 工具版本
__MAJOR_VER: int = 0 # 主版本号
__MINOR_VER: int = 0 # 次版本号
__MICRO_VER: int = 6 # 修订版本号
VERSION:str = f"{__MAJOR_VER}.{__MINOR_VER}.{__MICRO_VER}"
# 工具描述
DESCRIPITION = """
主要用于生成Simulink Test Case。
"""
SVG = """
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 512 512"><path fill="#1de9b6" d="M495.855 367.604c-28.98-73.177-53.037-148.231-80.725-221.893c-12.23-31.362-24.198-62.986-40.868-92.33c-6.62-10.535-12.956-22.119-23.814-28.86c-2.739-1.74-5.828-2.479-8.88-2.42c-5.084.096-10.14 2.37-14.025 5.65c-14.571 11.543-23.209 28.334-32.896 43.793c-17.114 28.698-35.156 58.748-63.773 77.396c-13.44 9.485-31.039 10.514-43.995 20.686c-17.72 13.36-29.767 32.31-44.298 48.737c-3.31 3.956-8.436 5.53-12.916 7.67C86.315 243.71 42.945 261.35 0 279.916c36.367 28.132 75.115 53.157 112.208 80.321c10.172-2.018 20.383-6.196 30.877-4.339c16.63 5.207 26.377 21.15 34.006 35.721c15.5 31.765 26.7 65.307 39.253 98.283c20.988-1.493 39.878-12.31 56.104-25.025c31.24-25.307 55.034-58.001 81.23-88.192c12.552-13.199 25.347-28.92 44.197-32.593c19.05-4.601 39.454 2.22 53.581 15.338c19.818 17.719 37.376 38.203 60.544 51.765c-3.108-15.338-10.575-29.101-16.145-43.592M171.844 316.04c-18.284 10.817-37.699 19.717-56.71 29.162c-29.828-19.98-58.889-41.15-88.192-61.856c39.515-17.315 79.635-33.4 119.675-49.545c18.97 14.813 38.547 28.88 57.517 43.693c-8.92 14.248-19.657 27.487-32.29 38.546m40.665-49.646c-18.85-14.167-37.94-27.951-56.508-42.482c11.907-16.226 24.945-31.906 40.565-44.701c10.333-6.62 22.966-8.456 33.703-14.43c25.469-12.714 42.845-36.044 59.434-58.324c-21.271 55.216-43.975 110.654-77.194 159.937"/></svg>
"""
# 伴生包清单从 manifest 导入(唯一事实源),此处保留引用以兼容旧调用方
# 加新伴生包:改 mil/core/manifest.py 的 COMPANION_PACKAGES,不要改这里
def create_plugin(workspace, parent=None):
# 先挂伴生包,再构造 UI——mil 包内任何 import openpyxl 都将命中 build/ 下的 pyd
load_companions(COMPANION_PACKAGES)
return FrameMILTool(workspace, parent)
def create_plugin_svg(file:str):
with open(file,'w', encoding='utf-8') as f:
f.write(SVG.strip())
f.close()
def read_plugin_name():
return NMAE
def read_plugin_version():
return VERSION
def read_plugin_description():
return re.sub(r'^[\r\n]+',"",DESCRIPITION)
__all__ = [
"create_plugin",
"create_plugin_svg",
"read_plugin_name",
"read_plugin_version",
"read_plugin_description",
]