Split InspectorPanel into sections (#152) #153

Merged
liamjd merged 2 commits from 152-inspector-panel-sections into main 2026-10-11 08:35:33 +01:00
Owner

Splits the inspector into sections so it can host controls, ahead of #136's worker-slot control. This is a refactor: the panel shows exactly what it showed after #142.

  • InspectorSection (abstract, extends VBoxContainer) has two methods: applies_to(entity, ctx) and refresh(entity, ctx).
  • InspectorPanel keeps the title and the timing. On each selection change and tick it asks every section under %Sections whether it applies, hides the ones that don't, and refreshes the rest. A section is never handed a null entity.
  • Today's rows become DetailsSection, with pawn_rows, building_rows, IDLE_TEXT and NONE_TEXT moved onto it.
  • InspectorContext (tasks, buildings, task_for()) replaces panel.tasks / panel.buildings. game.gd builds it.

The spec and the decisions are on #152.

Verification

  • Full GUT suite: 43 scripts, 948 tests, all passing (main: 42 / 930). The 18 new tests are in test_inspector_sections.gd. Its stub section applies only to buildings and is added with add_child() alone, which shows that adding a section needs no change to the panel's code.
  • test_inspector_panel.gd changes only to follow what moved, as the amended acceptance criterion allows.
  • Checked headed with tools/screenshot_inspector.gd. The pawn, building and working-pawn shots look the same as after #142.

Caveats

  • 136-worker-slot-control has commit b4e42f6, which edits inspector_panel.tscn next to the old %Rows node. Expect a conflict when that branch is rebuilt from main.
  • The suite reports 15 orphaned PawnCard/BuildingCard nodes from the entity-list tests. They are unrelated to this change, but nobody has checked whether main reports them too.

Closes #152

🤖 Generated with Claude Code

Splits the inspector into **sections** so it can host controls, ahead of #136's worker-slot control. This is a refactor: the panel shows exactly what it showed after #142. - `InspectorSection` (abstract, extends `VBoxContainer`) has two methods: `applies_to(entity, ctx)` and `refresh(entity, ctx)`. - `InspectorPanel` keeps the title and the timing. On each selection change and tick it asks every section under `%Sections` whether it applies, hides the ones that don't, and refreshes the rest. A section is never handed a null entity. - Today's rows become `DetailsSection`, with `pawn_rows`, `building_rows`, `IDLE_TEXT` and `NONE_TEXT` moved onto it. - `InspectorContext` (`tasks`, `buildings`, `task_for()`) replaces `panel.tasks` / `panel.buildings`. `game.gd` builds it. The spec and the decisions are on #152. ## Verification - Full GUT suite: 43 scripts, 948 tests, all passing (main: 42 / 930). The 18 new tests are in `test_inspector_sections.gd`. Its stub section applies only to buildings and is added with `add_child()` alone, which shows that adding a section needs no change to the panel's code. - `test_inspector_panel.gd` changes only to follow what moved, as the amended acceptance criterion allows. - Checked headed with `tools/screenshot_inspector.gd`. The pawn, building and working-pawn shots look the same as after #142. ## Caveats - `136-worker-slot-control` has commit `b4e42f6`, which edits `inspector_panel.tscn` next to the old `%Rows` node. Expect a conflict when that branch is rebuilt from main. - The suite reports 15 orphaned `PawnCard`/`BuildingCard` nodes from the entity-list tests. They are unrelated to this change, but nobody has checked whether main reports them too. Closes #152 🤖 Generated with [Claude Code](https://claude.com/claude-code)
New test_inspector_sections.gd covers InspectorContext.task_for(), how the
panel finds and refreshes its sections, and DetailsSection.applies_to(). A
stub section that applies only to buildings exercises a section that does not
apply.

test_inspector_panel.gd changes only to follow what moved: the row builders
and their constants to DetailsSection, %Rows into the section, and the
registries into panel.context.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The panel keeps the title and the timing, and stacks every InspectorSection
under %Sections. On each refresh it asks each section whether it applies,
hides it if not, and refreshes it if so. A new section is a new scene
instanced under %Sections, with no change to the panel's code.

Today's rows become DetailsSection. Dependencies reach sections through an
InspectorContext, which game.gd builds the way it builds TaskContext.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
liamjd merged commit d7b6c758ea into main 2026-10-11 08:35:33 +01:00
liamjd deleted branch 152-inspector-panel-sections 2026-10-11 08:35:33 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
liamjd/UntitledColonyBuilder!153
No description provided.