修复当录制记录(频道)数量太多时,界面异常卡顿,flet的cpu占用异常增高问题--本修改来自 CodeX GPT5.4 修改#389
Closed
creky wants to merge 12 commits into
Closed
修复当录制记录(频道)数量太多时,界面异常卡顿,flet的cpu占用异常增高问题--本修改来自 CodeX GPT5.4 修改#389creky wants to merge 12 commits into
creky wants to merge 12 commits into
Conversation
Owner
|
creky@70e8717 creky@078fc7d 这三个commit 请单独开分支提交pr,另外不要提交test文件夹以及多余的.idea文件夹,我会将其合并。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 标题(Title)
请提供这个Pull Request中提议的更改的简洁描述:
🔍 描述(Description)
请描述这个PR做了什么/为什么这些更改是必要的:
📝 类型(Type of Change)
这个PR引入了哪种类型的更改?(请勾选所有适用的选项)
🏗️ 测试(Testing)
请描述您已经进行的测试:
如果适用,请提供测试更改的说明:
📋 检查清单(Checklist)
在您创建这个PR之前,请确保以下所有框都被勾选,方法是在每个框中放置一个
x:注意: 这个PR在所有复选框被勾选之前不会被合并。
---以下来自codex的问题解析:
问题根因基本确认了,不是在录制逻辑本身,而是在 Flet 桌面 UI 层被“多卡片 + 高频整页刷新”拖住了。原来的录制列表页在列表模式下用的是 Column,卡片多时会让 Flutter 端承担很重的布局成本;同时卡片状态更新走 page.update(),会把整页一起重绘;再叠加“每张卡一个永久 duration 协程”,记录一多就会把桌面端 flet.exe 的 CPU 拉高。
我已经把修复落到 recordings_view.py 和 recording_card.py 里了。核心改动是:列表模式从 Column 改成了支持按需构建的 ListView,并去掉外层嵌套滚动;过滤、搜索、刷新这些操作改成“批量改可见性,最后统一更新一次”,不再对每张卡单独 update();卡片状态刷新从整页 page.update() 改成单卡 card.update();原来“每张卡一个后台任务”的时长刷新改成了一个共享循环,只更新正在录制且当前可见的卡片。这几处组合起来,能明显降低 UI diff、布局和重绘压力。顺手还修了刷新时错误操作 Container.controls 的问题,并清理了选择状态缓存,避免列表越来越乱。
我做过两层校验:一是 python -m py_compile app\ui\views\recordings_view.py app\ui\components\business\recording_card.py 已通过;二是按当前依赖 flet==0.27.6 实例化验证了 ListView/GridView 参数,避免运行时报构造参数错误。还没有替你实际拉起桌面窗口做人工滚动压测,所以最后一步建议你在大 recordings.json 数据量下直接打开录制页对比一下 CPU 和滚动流畅度。
感谢您的贡献!