Palette: reopen the last chosen kit instead of starting empty

The chosen kit is remembered in editor.properties [Palette]; a file without it
opens on its first kit. Saving preferences now keeps the other sections.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-06 21:14:30 +03:00
co-authored by Claude Opus 5.5
parent b63655462f
commit bc4e28d3f7
2 changed files with 45 additions and 5 deletions
+9 -3
View File
@@ -2980,6 +2980,8 @@ def populate_palette_types(event=None):
return
kit_name = palette_kit_names[index]
if event is not None and kit_name != app_state.LAST_PALETTE_KIT:
app_state.save_last_palette_kit(kit_name)
types = palette.list_component_types(kit_name)
for type_name, base in types:
@@ -3024,9 +3026,13 @@ def refresh_palette_kits():
palette_kit_var.set("")
return
palette_status.config(text=f"{len(palette_kit_names)} kits")
palette_kit_var.set("")
fit_tree_column(palette_tree)
# Reopen the kit chosen last so the palette is never left empty; a file without that
# kit opens on its first kit instead, without forgetting the remembered one.
if app_state.LAST_PALETTE_KIT in palette_kit_names:
palette_kit_combo.current(palette_kit_names.index(app_state.LAST_PALETTE_KIT))
else:
palette_kit_combo.current(0)
populate_palette_types()