Merge Nest into a renamed 'Units' menu (first in the header), Nest listed first

Nest had its own single-entry popover for no strong reason, and Allies
was its own separate one right next to it, both are 'your own side of
the map'. Merged into one 'Units' popover, Nest always first (there's
only ever one), Allies listed below it, and moved to the first spot in
the header's row of menu buttons.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Dominik Moritz Roth 2026-08-09 20:26:42 +02:00
parent 3955fa42c7
commit c74a8eefea

View File

@ -271,11 +271,10 @@ class MainWindow(Adw.ApplicationWindow):
header.pack_start(Gtk.Separator(orientation=Gtk.Orientation.VERTICAL))
for label, popover_builder in (
("Nest", self._build_nest_popover),
("Units", self._build_units_popover),
("Spotters", self._build_spotters_popover),
("Reference Points", self._build_rp_popover),
("Targets", self._build_targets_popover),
("Allies", self._build_allies_popover),
("Scout Flights", self._build_scout_flights_popover),
):
header.pack_start(self._make_menu_button(label, popover_builder))
@ -714,27 +713,6 @@ class MainWindow(Adw.ApplicationWindow):
else:
self.cursor_label.set_label(coord.label())
# -- Nest -----------------------------------------------------------------
def _build_nest_popover(self, rebuild) -> Gtk.Widget:
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=4)
box.set_margin_top(6)
box.set_margin_bottom(6)
nest = self.board.nest
box.append(_row(
f"Nest ({_location_status(nest)})",
on_input=lambda: self._open_coord_dialog(
title="Set Nest coordinates",
on_submit=lambda loc, _id, _t: self._apply_and_refresh(nest, loc),
initial_location=nest.location,
),
hidden=nest.hidden,
on_toggle_hidden=lambda: self._toggle_hidden(nest, rebuild),
show_geo=nest.show_geo_desc,
on_toggle_show_geo=lambda: self._toggle_show_geo(nest, rebuild),
))
return box
# -- Spotters --------------------------------------------------------------
def _build_spotters_popover(self, rebuild) -> Gtk.Widget:
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
@ -885,16 +863,33 @@ class MainWindow(Adw.ApplicationWindow):
rebuild()
self.toast(f"{target.name} converted to {new_rp.name}.")
# -- Allies ---------------------------------------------------------------
def _build_allies_popover(self, rebuild) -> Gtk.Widget:
"""A friendly contact ('FriendlyTank#1:'), tracked entirely
separately from Targets (see models.py's Ally/Board.allies):
never fired on, so no shell/charge/assignment/alive controls
here, just position/visibility, same as a Reference Point."""
# -- Units (Nest + Allies) -------------------------------------------------
def _build_units_popover(self, rebuild) -> Gtk.Widget:
"""Your own side of the map: the Nest (always first, there's
only ever one) plus every friendly contact ('FriendlyTank#1:',
tracked entirely separately from Targets, see models.py's
Ally/Board.allies). Allies are never fired on, so no shell/
charge/assignment/alive controls here, just position/
visibility, same as a Reference Point."""
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
box.set_margin_top(6)
box.set_margin_bottom(6)
nest = self.board.nest
box.append(_row(
f"Nest ({_location_status(nest)})",
on_input=lambda: self._open_coord_dialog(
title="Set Nest coordinates",
on_submit=lambda loc, _id, _t: self._apply_and_refresh(nest, loc),
initial_location=nest.location,
),
hidden=nest.hidden,
on_toggle_hidden=lambda: self._toggle_hidden(nest, rebuild),
show_geo=nest.show_geo_desc,
on_toggle_show_geo=lambda: self._toggle_show_geo(nest, rebuild),
))
box.append(Gtk.Separator())
for a in list(self.board.allies):
box.append(_row(
f"{a.name} ({_location_status(a)})",