Let the user choose which settings persist - #915
Merged
Conversation
Which settings carried onto a freshly-opened file was hard-coded across ~25 inline blocks reading 38 `last_*` global keys. Eleven of those keys had no reader at all, six were written from five other places, and nothing enumerated them. Rewrite the mechanism onto the existing settings catalog: the sticky store is now one snapshot of the last persisted edit plus a list of chosen SettingRow ids, applied with apply_selected_fields. Every catalog row becomes stickyable, so a look setting can be opted in and a default one opted out. Persistent Settings… in the canvas overflow menu opens the picker, reusing GranularSettingsDialog in a new pick mode with tri-state group checkboxes on CollapsibleSection. Four carries stay hard-coded because they are not plain config-value copies: the rig-global flat-field profile, the Kelvin roll-locks, the 21 ExportConfig fields with no catalog row (output folder, ICC paths, contact-sheet layout), and the scan-setup prefs, which are kept out of the catalog so preset "Replace look" cannot reset the decode mode. Description fields keep their own key so the last confirm wins for the roll. Legacy keys migrate once on startup.
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.
What
Which settings carry onto a freshly-opened file is now a user choice, edited in a Persistent Settings… picker on the canvas ⋯ menu.
Why
_apply_sticky_settingshard-coded the list across ~25 inline blocks reading 38last_*global keys. The set had drifted: 11 of those keys had no reader at all (last_density,last_grade,last_wb_*,last_toe*,last_shoulder*,last_toning_config,last_retouch_config), 6 that were read got written from five other places, and nothing enumerated them.How
settings_catalog.pyalready describes every copyable setting as aSettingRowand already knows how to overlay a chosen subset (apply_selected_fields). Sticky is the same operation with a different source, so it is rewritten on top of it rather than gated key by key:global_settingstable.apply_selected_fields(snapshot, config, chosen_rows).sticky=Truedefault flag, so out-of-the-box behaviour is unchanged (50 of 140 rows).Both functions shrink to a few lines, and all 140 catalog rows become opt-in stickyable — a look setting can be opted in, a default one opted out.
Four carries stay hard-coded
They are not plain config-value copies:
profile_id/k1wb_temp_lock*Kelvin lockskelvin_to_wbExportConfigfieldslinear_raw/narrowband_scan_LOOK_ROWS, so preset "Replace look" would reset the decode modedescription_fieldskeeps its own key so the last Description… confirm wins for the roll rather than whichever frame was saved last.A
EXPORT_REMAINDERtest asserts the catalog's Export rows plus the remainder coverExportConfigexactly — that's the guard stopping a future export field from silently losing its carry (the output folder nearly did).UI
GranularSettingsDialoggains apreselect_idspick mode (values shown come from the snapshot, so the list reads as what would actually carry), andCollapsibleSectiongains an optional tri-state header checkbox. Both default off, so paste/preset/apply callers are untouched.Migration
Legacy
last_*keys seed the snapshot once on startup, including the pre-renamelast_true_black→ invertedpaper_black.Testing
make lint,make typeclean; 4574 passed.tests/test_sticky_settings.py(18),tests/test_sticky_dialog.py(6);tests/test_desktop_session.pyrewritten onto the new storage plus 5 new behaviour tests.Note
tests/test_scanner_icc.pyfails on this branch, but it fails identically onmain— it is untracked WIP from another work stream and is not included here.