Skip to content

[P3] Focus Mode / Zoom settings widgets are constructed dynamically in main.gd _ready() #359

Description

@itsmiso-ai

Ask: Move the Focus Mode CheckButton and Zoom slider/label from runtime construction in main.gd _ready() into main.tscn (or a settings_panel_builder.gd) so the settings UI is visible in the scene file and restylable without code changes.
Expected files: scripts/main.gd, scenes/main.tscn

Problem: scripts/main.gd _ready() constructs the Focus Mode toggle and Zoom controls at scripts/main.gd:268-296 by calling CheckButton.new(), Label.new(), and HSlider.new(), wiring signal handlers that capture settings/tick_timer via closures, and parenting them to settings_panel.get_node("SettingsMargin/SettingsBox"). Three concerns are mixed: scene composition, persisted-settings round-trip, and tick-timer reconfiguration. Because the widgets are created in code, scenes/main.tscn does not describe them; opening the .tscn cannot reveal what the settings panel looks like, and a refactor of settings_panel.get_node("SettingsMargin/SettingsBox") silently breaks _ready with a null deref. The 2026-07-08 audit (#269 finding 9) flagged this and it has not been addressed.

Evidence:

  • scripts/main.gd:268 — comment "Focus Mode and Zoom Controls (Issue Add true focus mode and zoom controls #19)" introduces the runtime construction block
  • scripts/main.gd:270var focus_mode_btn := CheckButton.new()
  • scripts/main.gd:272focus_mode_btn.text = "Focus Mode"; focus_mode_btn.toggled.connect(func(val): ... settings['focus_mode'] = val; save_settings(); if tick_timer: tick_timer.wait_time = tick_seconds_for_setting())
  • scripts/main.gd:281var zoom_label := Label.new()
  • scripts/main.gd:285var zoom_slider := HSlider.new() wired to Constants.ZOOM_MIN / ZOOM_MAX / ZOOM_STEP with a value_changed handler that mutates settings['zoom_factor'] and rebuilds the zoom label text
  • scripts/main.gd:279, 284, 295add_child() calls into settings_panel.get_node(...) — path-coupled: changing the scene path silently breaks runtime
  • scenes/main.tscn — does not contain the Focus Mode CheckButton, the Zoom label, or the Zoom HSlider; grepping the scene file for "zoom" or "focus" returns nothing
  • tests/test_dock_layout.gd — exercises only apply_anchor_layout(); no test exists for the dynamic settings widgets

Acceptance:

  • Focus Mode CheckButton, Zoom label, and Zoom HSlider are placed in scenes/main.tscn inside the SettingsBox, each with a unique-name (%FocusModeButton, %ZoomLabel, %ZoomSlider)
  • main.gd _ready() references the scene-placed nodes via % unique-name access, retaining the same toggle/value_changed handlers and the same settings persistence semantics
  • The runtime construction block is removed from main.gd
  • Verify scenes/main.tscn renders the settings panel identically (open the scene in Godot, check Focus Mode + Zoom appear under Settings)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    auditAudit, review, or investigation work.priority/p3Low priority.status/readyReady for Dispatch worker pickup.type/choreChore or maintenance.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions