fix: keep advanced settings when the panel is collapsed - #3
Open
rsmxingu wants to merge 1 commit into
Open
Conversation
get_config() read the advanced widgets (CRF, preset, silence threshold, margin) only while self.advanced_visible was True. So if a user opened Advanced Settings, customized values, then collapsed the panel before clicking Optimize, those values were silently discarded and the encode fell back to the preset defaults. Gate on intent instead of visibility: add self.advanced_used, set to True the first time the panel is opened and never reset. get_config() now honors the advanced widgets whenever advanced_used is True, regardless of whether the panel is currently expanded. Tests: - update test_get_config_advanced_view to set advanced_used (the prior test asserted the buggy visibility-based contract). - add test_get_config_advanced_collapsed_keeps_values as a regression for the collapsed-but-customized case. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem
get_config()reads the advanced widgets (CRF, encoding preset, silence threshold, cut margin) only whileself.advanced_visibleisTrue:So this sequence silently loses the user's input:
Because the panel is no longer visible,
advanced_visibleisFalseand the encode falls back to the preset defaults — the customized values are discarded without any indication.Change
Gate on intent instead of current visibility:
self.advanced_used, initializedFalse.Truethe first time the panel is opened (intoggle_advanced); it is never reset.get_config()now honors the advanced widgets wheneveradvanced_usedisTrue, regardless of whether the panel is currently expanded.This preserves the existing default behavior for users who never touch Advanced Settings, while fixing the data loss for users who do.
Tests
test_get_config_advanced_viewto setadvanced_used(the previous test encoded the buggy visibility-based contract).test_get_config_advanced_collapsed_keeps_valuesas a regression: panel collapsed (advanced_visible=False) but engaged earlier (advanced_used=True) must still return the widget values.Testing notes
python3 -m py_compile ui.py tests/test_ui.pypasses.tests/test_ui.pysuite requirestkinter, which was unavailable in my sandbox, so I could not execute it here. Please runpython3 -m unittest tests.test_uiin an environment with tkinter to confirm. The processor suite (tests/test_processor.py, 8 tests) passes unchanged.🤖 Generated with Claude Code