fix(gui): keep Tools tabs idle until the page is shown - #201
Conversation
Real Tk queues the <<NotebookTabChanged>> of the Tools page's own select and runs it once the window is built, with any page in front. Its handler refreshed the tool on that tab, so the socket table was read at every start of the program, for a tab nobody had opened. The test said otherwise because the fake Tk fires no event. The handler now refreshes only while the Tools page is on screen. Diagnostics also checked from its constructor. Its first check now waits for the first refresh or pending() of the panel on screen, and a check that failed waits for "Check again" instead of running on every tick. Measured on Tk 8.6.15 and 9.0.4: no work with another page in front, one read when the window opens on Tools or when the person switches to it. The tests fire the recorded tab-change callbacks the way real Tk does after the constructor, with three new mutations. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📜 Recent review details⏰ Context from checks skipped due to timeout. (10)
🧰 Additional context used📓 Path-based instructions (8)Applies to text shown to the user (labels, buttons, tooltips, placeholders, dialogs, errors, status messages, empty states, translations).⚙️ CodeRabbit configuration file Files:
Verify tests check real behavior and would fail if the implementation were broken.⚙️ CodeRabbit configuration file Files:
Performance is a known weak spot of these projects.⚙️ CodeRabbit configuration file Files:
Applies only to code that builds or styles a GUI.⚙️ CodeRabbit configuration file Files:
SECURITY, HIGH PRIORITY.⚙️ CodeRabbit configuration file Files:
Python code.⚙️ CodeRabbit configuration file Files:
All code in this repository is written by an AI coding agent (Claude Code).⚙️ CodeRabbit configuration file Files:
Source excerpt: **Flat hyphen only.**📄 CodeRabbit inference engine (.github/claude-review-rules.md) Files:
📝 WalkthroughWalkthroughThe Tools page now refreshes a selected panel only when the page is current. Diagnostics defer their first check until refresh or pending handling, and do not automatically repeat a check after an outcome is recorded. ChangesToolbox view behavior
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~12 minutes Change: Bug fix Suggested labels: Merge Risk: ⚪ Minimal · up to The deferred Tools and Diagnostics behavior is ready to merge after normal checks. 🚥 Pre-merge checks | ✅ 13 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (13 passed)
Full details: Scope, Duplication And DocsExplanation The PR changes user-facing Tools behavior: Resolution Update the documentation in the same PR. Add an entry under
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
What
A tool on the Tools tab no longer does its first work at every start of the program. It waits until the Tools page is on screen.
<<NotebookTabChanged>>of the Tools page's ownselect(in its constructor) and runs it once the window is built, with any page in front.ToolboxPage._on_subpagethen refreshed the tool on that tab, and the socket table was read about 0.9 s after every start. The test that claimed "not at start-up" was green because the fake Tk fires no event._on_subpagenow refreshes only whileapp.current_page() is self.refresh()orpending()of the panel on screen (the pattern Sockets already used), and a check that failed waits for "Check again" instead of running on every tick.Measured on real Tk (8.6.15 and 9.0.4)
A probe builds the real window with an isolated ui state, the Tools tab remembered, and counts calls into the socket read and the environment check while the event loop runs.
_on_subpage, Diagnostics via its constructor)_on_page_changed)tools/ci_gui_render.pyis OK in en, pl and zh, and Diagnostics is measured with its rows (the render check'spending()starts the check).Tests
tests/test_toolbox.py:opened_on_start_up()fires the sub-notebook's recorded<<NotebookTabChanged>>callbacks and ticks, which is what real Tk does after the constructor. The Sockets start-up test uses it, and so does the newtest_diagnostics_checks_when_first_looked_at_and_not_at_start_up.test_a_first_check_that_fails_says_so_and_is_not_retried_by_itself.test_a_panel_is_built_on_first_view_and_the_open_tab_is_remembered: an off-screen tab change remembers the tab and refreshes nothing.No
CHANGELOG.mdline: the Tools tab is not released yet.Not checked
🤖 Generated with Claude Code
Summary by CodeRabbit