51e30d41c63ce4fb5cc5a2a84c2c5b184282e12e
目的:补齐 Event.Uninstall 空实现,打通卸载全链路。 背景:原 plugin_registry.py 的 Uninstall 分支为空 pass;运行时直接 os.remove 删 .pyd 触发 WinError 5(Windows 文件锁,.pyd 已被 import)。 方案: - 卸载流程分层清理:Worker 写待删清单 → Registry 清字典/obj → main 清 toolBar/stackedWidget → plugins_card 刷新为未安装 - .pyd 文件删除延迟到下次启动 _process_pending_uninstalls, 在 worker 线程启动前、import 之前执行,避开文件锁 - 卸载后自动重启:QProcess.startDetached + QApplication.quit, 兼容开发模式(python.exe)与打包模式(main.exe) - _remove_with_retry 应对自重启时原进程句柄未释放的暂态竞争 - _on_local_discovered 加异常隔离,单插件失败不拖垮初始化 - QThread 生命周期管理:aboutToQuit → shutdown(quit+wait), finished → worker.deleteLater,消除 Destroyed 警告 - plugins_card 抽 refresh() 方法,统一卡片状态刷新 影响:卸载功能可用;自重启在命令行/打包模式正常,调试器环境 可能因子进程管理闪退(不影响交付)。
Model_Team_Tools
Languages
Python
100%