SettingsActivity: document ui_options label mapping for value-label row#7
Open
bitcoin3us wants to merge 1 commit into
Open
SettingsActivity: document ui_options label mapping for value-label row#7bitcoin3us wants to merge 1 commit into
bitcoin3us wants to merge 1 commit into
Conversation
Companion to MicroPythonOS#137 (framework change). Explains the (label, value) tuple semantics: label shown in picker AND in the settings-list row's value label; value is what gets stored. Adds a new "Display Labels for ui_options" section to settings-activity.md covering: - The (label, value) tuple format - Initial-render + post-save behavior - Fall-through for stale stored values not in current ui_options - Tips for choosing labels vs values (don't change values without a migration; labels are free to change) setting-activity.md gets a one-line cross-reference to the new section on the parent doc, since the same (label, value) contract applies in the picker UI as well. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
Companion to MicroPythonOS#137 which makes
SettingsActivityhonour the(label, value)tuple inui_optionswhen rendering the row's value label.Adds:
ui_options" section tosettings-activity.mdcovering the (label, value) tuple format, the initial-render + post-save behaviour, the fall-through for stale stored values, and tips for choosing labels vs values.ui_optionsdescription in bothsettings-activity.mdandsetting-activity.mdso callers know the label is shown in the parent list row (not just inside the picker).setting-activity.mdto the new section.Why
Before MPOS#137, a setting like:
{"title": "Hero Image", "key": "hero_image", "ui": "radiobuttons", "ui_options": [("Lightning Piggy", "lightningpiggy"), ...]}…displayed
"lightningpiggy"(the raw value, no space) in the row beneath the title, even though the picker correctly showed"Lightning Piggy". MPOS#137 fixes the framework; this doc PR explains the contract so framework users know to expect label-display (and what to do for stale values that no longer appear inui_options).Test plan