Skip to content

fix: keep advanced settings when the panel is collapsed - #3

Open
rsmxingu wants to merge 1 commit into
rsd:masterfrom
rsmxingu:fix/advanced-settings-persist
Open

fix: keep advanced settings when the panel is collapsed#3
rsmxingu wants to merge 1 commit into
rsd:masterfrom
rsmxingu:fix/advanced-settings-persist

Conversation

@rsmxingu

Copy link
Copy Markdown

Problem

get_config() reads the advanced widgets (CRF, encoding preset, silence threshold, cut margin) only while self.advanced_visible is True:

if self.advanced_visible:
    noise_threshold = self.thresh_entry.get().strip()
    crf = int(self.crf_slider.get())
    ...
else:
    # preset-based defaults (CRF 35, preset "slow", margin 0.2, ...)

So this sequence silently loses the user's input:

  1. Open Advanced Settings
  2. Customize CRF / preset / threshold / margin
  3. Collapse the panel (toggle it shut)
  4. Click Optimize

Because the panel is no longer visible, advanced_visible is False and the encode falls back to the preset defaults — the customized values are discarded without any indication.

Change

Gate on intent instead of current visibility:

  • Add self.advanced_used, initialized False.
  • Set it True the first time the panel is opened (in toggle_advanced); it is never reset.
  • get_config() now honors the advanced widgets whenever advanced_used is True, 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

  • Updated test_get_config_advanced_view to set advanced_used (the previous test encoded the buggy visibility-based contract).
  • Added test_get_config_advanced_collapsed_keeps_values as 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.py passes.
  • The full tests/test_ui.py suite requires tkinter, which was unavailable in my sandbox, so I could not execute it here. Please run python3 -m unittest tests.test_ui in an environment with tkinter to confirm. The processor suite (tests/test_processor.py, 8 tests) passes unchanged.

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant