feat: granular label/action styling, GUI settings persistence, and undo/redo (v0.11.0)#101
Merged
Conversation
…el backgrounds are enabled
…mation set styling to a new section
…revent action label overlapping
…uments, and API updates
…abel background configuration
…ntiguous level indexing in the UI
…nt and session-state synchronization
… configuration overrides for specific models
…prove session state synchronization when loading game settings
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.
Overview
This PR adds per-player/per-level control over label backgrounds and action label positioning, a new
gui_settings.yamlpersistence layer that auto-saves and restores per-game settings, a multi-step undo/redo system, a Settings download button, and a suite of GUI improvements including a dynamic colour-scheme palette and a colorblind-accessible default.API & Core (
core.py,cli.py)Label backgrounds —
label_bgnow acceptsbool | dict[int, bool], enabling selective application per player or per level:label_bg_by="player"|"level"— how to interpret a dict keylabel_bg_style="player_bg"|"white_bg"— player-colour background with white text, or vice versa--label-bg=1,2,--label-bg-by=player,--label-bg-style=white_bg_any_label_bg(),_label_bg_active(player, level)used internallyAction label positioning —
action_label_positionnow acceptsfloat | dict[int, float]for per-player or per-level control:action_label_position_by="player"|"level"— dict key interpretationvary_action_label_positions=True— automatically distributes labels evenly across sibling edgesvary_action_label_positions_by,vary_action_label_positions_choicesfor selective application--action-label-position=0:0.3,1:0.7,--vary-action-label-positions, etc.New public function —
get_game_levels(game_source, level_scaling, sublevel_scaling)returns the sorted list of actual level values present in the tree (not just the max), with correct scaling for pygambit games. Exported fromdraw_tree.All
generate_*,draw_tree, andef_to_texsignatures updated;commandline()return tuple extended accordingly.GUI (
app.py)Settings download — "Settings" button in the Downloads expander writes the current GUI configuration as a YAML snippet ready to paste into the
overrides:section ofgui_settings.yaml.Color scheme palette — Default changed from "custom" to "colorblind". The Palette section now appears for every non-"default" scheme, pre-filled with that scheme's actual colours. Editing any colour auto-switches to "custom"; switching back to a named scheme resets the palette to its defaults.
Per-game settings persistence — A new
gui_settings.yamlfile (committed, not gitignored) stores defaults and per-game overrides. Settings are auto-saved on every change (only values that differ from draw_tree defaults are stored). When the user switches to a game, its saved settings are automatically restored.Undo / Redo / Reset — Three sidebar buttons with a bounded 50-step undo stack. ↩ Undo / ↪ Redo do full widget-state snapshot swaps; ↺ Reset removes the current game's overrides from
gui_settings.yamland reloads the effective defaults.Label styling UI — "Enable Label Background" expands into a scope selector (All / By Player / By Level) with multi-select for selective application, a style toggle (player-colour vs white background), and an opacity slider.
Action label positioning UI — Positioning Mode (Global / By Player / By Level) provides per-player or per-level sliders. "Vary Action Label Positions" checkbox with "Vary by" sub-selector applies automatic even spacing, disabling the manual position controls.
Level-based selection fixes —
get_game_levels(with correct level_scaling) replacescount_levelsfor populating level multiselects and sliders, ensuring only levels that actually exist in the tree are shown and that selections take effect correctly.Tests & Docs
TestLabelBackgroundextended with 9 new cases covering dictlabel_bg,label_bg_style, and CLI parsingcommandline()tuple unpacks updated for the two new return values (label_bg_by,label_bg_style)docs/python_api.mdanddocs/cli.mdupdated with all new parametersDependencies & version
pyyamladded todependencies