Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

revert(pets): pets no longer hold a phone during a voice call

rubenluetke10-beep8d86f4004df9
diff --git a/docs/pets.md b/docs/pets.md
index 390b36b87b..fa9126030e 100644
--- a/docs/pets.md
+++ b/docs/pets.md
@@ -35,18 +35,7 @@ one click.
listening, dictating or talking, and carry a travelling highlight while
thinking or transcribing;
- speaker: silence the assistant's voice for this session (TTS volume 0,
- mirrored from `VoiceSpeakerMuteChanged`);
- - phone (its own disc, in the bell's look): call Jarvis — the handset rings
- while it dials — or, during a conversation, hang up (the handset lies
- flat).
-- **On the phone**: while a voice conversation runs (listen / think / speak)
- the pet holds a corded handset to its head, drawn into the pet's own
- `phone.png` rows (one per `CALL_STATES` state, `"phone"` and
- `"phone_sheet"` in `pet.json`). Each built-in pet grips it its own way
- (`PhoneRig` in `scripts/pets/build_pets.py`): Gigi, Miso, Bolt and Ember
- raise an arm or paw, Mochi pulls out a soft nub, Shelly curls up a fold of
- its foot, and Brew cradles the handset in its handle. A pet without phone
- rows (an uploaded one) keeps its plain rows during a call.
+ mirrored from `VoiceSpeakerMuteChanged`).
- **The thought bubble** above the pet's head while Jarvis thinks, drawn in
the pets' pixel art: a white pixel cloud with a dark outline and two small
puffs trailing down to the head. Bobbing dots while Jarvis just thinks, the
@@ -237,12 +226,6 @@ Two row conventions make the pet feel alive:
act twice in a row; any other state cancels it, and the overlay's frame
timer covers the wait, so idling costs nothing extra. A user upload is a
single sheet, so the store drops `acts` from an uploaded `pet.json`.
-- **On the phone.** A pet may also draw its call states holding a handset:
- `"phone_sheet": "phone.png"` and `"phone": {"listening": {...},
- "thinking": {...}, "talking": {...}}` (only the `CALL_STATES`, rows of
- their own sheet). During a voice conversation the renderer shows those
- rows instead of the plain ones; a call state without its own phone row
- borrows the `listening` one. Uploads drop `phone` like `acts`.
Rules the loader enforces (`jarvis/ui/pets/manifest.py`):
diff --git a/jarvis/ui/pets/builtin/bolt/pet.json b/jarvis/ui/pets/builtin/bolt/pet.json
index 00fd38778c..b5b87fbb6e 100644
--- a/jarvis/ui/pets/builtin/bolt/pet.json
+++ b/jarvis/ui/pets/builtin/bolt/pet.json
@@ -107,26 +107,5 @@
"fps": 8,
"loop": false
}
- },
- "phone_sheet": "phone.png",
- "phone": {
- "listening": {
- "row": 0,
- "frames": 6,
- "fps": 8,
- "loop": true
- },
- "thinking": {
- "row": 1,
- "frames": 8,
- "fps": 8,
- "loop": true
- },
- "talking": {
- "row": 2,
- "frames": 4,
- "fps": 10,
- "loop": true
- }
}
}
diff --git a/jarvis/ui/pets/builtin/bolt/phone.png b/jarvis/ui/pets/builtin/bolt/phone.png
deleted file mode 100644
index 2222115d72..0000000000
Binary files a/jarvis/ui/pets/builtin/bolt/phone.png and /dev/null differ
diff --git a/jarvis/ui/pets/builtin/brew/pet.json b/jarvis/ui/pets/builtin/brew/pet.json
index a1a4a3ddc3..527b2732ba 100644
--- a/jarvis/ui/pets/builtin/brew/pet.json
+++ b/jarvis/ui/pets/builtin/brew/pet.json
@@ -101,26 +101,5 @@
"fps": 10,
"loop": false
}
- },
- "phone_sheet": "phone.png",
- "phone": {
- "listening": {
- "row": 0,
- "frames": 6,
- "fps": 8,
- "loop": true
- },
- "thinking": {
- "row": 1,
- "frames": 8,
- "fps": 8,
- "loop": true
- },
- "talking": {
- "row": 2,
- "frames": 4,
- "fps": 10,
- "loop": true
- }
}
}
diff --git a/jarvis/ui/pets/builtin/brew/phone.png b/jarvis/ui/pets/builtin/brew/phone.png
deleted file mode 100644
index 9451f0775b..0000000000
Binary files a/jarvis/ui/pets/builtin/brew/phone.png and /dev/null differ
diff --git a/jarvis/ui/pets/builtin/ember/pet.json b/jarvis/ui/pets/builtin/ember/pet.json
index 79124e825f..e9a5ffc42e 100644
--- a/jarvis/ui/pets/builtin/ember/pet.json
+++ b/jarvis/ui/pets/builtin/ember/pet.json
@@ -107,26 +107,5 @@
"fps": 8,
"loop": false
}
- },
- "phone_sheet": "phone.png",
- "phone": {
- "listening": {
- "row": 0,
- "frames": 6,
- "fps": 8,
- "loop": true
- },
- "thinking": {
- "row": 1,
- "frames": 8,
- "fps": 8,
- "loop": true
- },
- "talking": {
- "row": 2,
- "frames": 4,
- "fps": 10,
- "loop": true
- }
}
}
diff --git a/jarvis/ui/pets/builtin/ember/phone.png b/jarvis/ui/pets/builtin/ember/phone.png
deleted file mode 100644
index c18221d1f4..0000000000
Binary files a/jarvis/ui/pets/builtin/ember/phone.png and /dev/null differ
diff --git a/jarvis/ui/pets/builtin/gigi/pet.json b/jarvis/ui/pets/builtin/gigi/pet.json
index eafef04b2a..b503410744 100644
--- a/jarvis/ui/pets/builtin/gigi/pet.json
+++ b/jarvis/ui/pets/builtin/gigi/pet.json
@@ -107,26 +107,5 @@
"fps": 7,
"loop": false
}
- },
- "phone_sheet": "phone.png",
- "phone": {
- "listening": {
- "row": 0,
- "frames": 6,
- "fps": 8,
- "loop": true
- },
- "thinking": {
- "row": 1,
- "frames": 8,
- "fps": 8,
- "loop": true
- },
- "talking": {
- "row": 2,
- "frames": 4,
- "fps": 10,
- "loop": true
- }
}
}
diff --git a/jarvis/ui/pets/builtin/gigi/phone.png b/jarvis/ui/pets/builtin/gigi/phone.png
deleted file mode 100644
index 16a1fd34b5..0000000000
Binary files a/jarvis/ui/pets/builtin/gigi/phone.png and /dev/null differ
diff --git a/jarvis/ui/pets/builtin/miso/pet.json b/jarvis/ui/pets/builtin/miso/pet.json
index 0bf79e1e91..f8095f3fb1 100644
--- a/jarvis/ui/pets/builtin/miso/pet.json
+++ b/jarvis/ui/pets/builtin/miso/pet.json
@@ -107,26 +107,5 @@
"fps": 8,
"loop": false
}
- },
- "phone_sheet": "phone.png",
- "phone": {
- "listening": {
- "row": 0,
- "frames": 6,
- "fps": 8,
- "loop": true
- },
- "thinking": {
- "row": 1,
- "frames": 8,
- "fps": 8,
- "loop": true
- },
- "talking": {
- "row": 2,
- "frames": 4,
- "fps": 10,
- "loop": true
- }
}
}
diff --git a/jarvis/ui/pets/builtin/miso/phone.png b/jarvis/ui/pets/builtin/miso/phone.png
deleted file mode 100644
index d0e75dd119..0000000000
Binary files a/jarvis/ui/pets/builtin/miso/phone.png and /dev/null differ
diff --git a/jarvis/ui/pets/builtin/mochi/pet.json b/jarvis/ui/pets/builtin/mochi/pet.json
index eb7c3f9975..88bab2707c 100644
--- a/jarvis/ui/pets/builtin/mochi/pet.json
+++ b/jarvis/ui/pets/builtin/mochi/pet.json
@@ -107,26 +107,5 @@
"fps": 8,
"loop": false
}
- },
- "phone_sheet": "phone.png",
- "phone": {
- "listening": {
- "row": 0,
- "frames": 6,
- "fps": 8,
- "loop": true
- },
- "thinking": {
- "row": 1,
- "frames": 8,
- "fps": 8,
- "loop": true
- },
- "talking": {
- "row": 2,
- "frames": 4,
- "fps": 10,
- "loop": true
- }
}
}
diff --git a/jarvis/ui/pets/builtin/mochi/phone.png b/jarvis/ui/pets/builtin/mochi/phone.png
deleted file mode 100644
index d8b71c1fdf..0000000000
Binary files a/jarvis/ui/pets/builtin/mochi/phone.png and /dev/null differ
diff --git a/jarvis/ui/pets/builtin/shelly/pet.json b/jarvis/ui/pets/builtin/shelly/pet.json
index 97af9055fb..9cf702bb3a 100644
--- a/jarvis/ui/pets/builtin/shelly/pet.json
+++ b/jarvis/ui/pets/builtin/shelly/pet.json
@@ -107,26 +107,5 @@
"fps": 8,
"loop": false
}
- },
- "phone_sheet": "phone.png",
- "phone": {
- "listening": {
- "row": 0,
- "frames": 6,
- "fps": 8,
- "loop": true
- },
- "thinking": {
- "row": 1,
- "frames": 8,
- "fps": 8,
- "loop": true
- },
- "talking": {
- "row": 2,
- "frames": 4,
- "fps": 10,
- "loop": true
- }
}
}
diff --git a/jarvis/ui/pets/builtin/shelly/phone.png b/jarvis/ui/pets/builtin/shelly/phone.png
deleted file mode 100644
index fc88976070..0000000000
Binary files a/jarvis/ui/pets/builtin/shelly/phone.png and /dev/null differ
diff --git a/jarvis/ui/pets/loader.py b/jarvis/ui/pets/loader.py
index 021ae0f553..ba0cc4aaf6 100644
--- a/jarvis/ui/pets/loader.py
+++ b/jarvis/ui/pets/loader.py
@@ -28,7 +28,6 @@ from jarvis.ui.pets.manifest import (
PetManifestError,
check_act_cells,
check_cells,
- check_phone_cells,
check_sheet_size,
parse_manifest,
)
@@ -63,10 +62,6 @@ class PetPack:
acts: Mapping[str, tuple[Image.Image, ...]] = field(
default_factory=lambda: MappingProxyType({})
)
- #: Decoded on-the-phone rows by call state (empty when the pet has none).
- phone: Mapping[str, tuple[Image.Image, ...]] = field(
- default_factory=lambda: MappingProxyType({})
- )
def builtin_root() -> Path:
@@ -128,10 +123,6 @@ def read_manifest(pet_dir: Path, *, builtin: bool) -> PetManifest:
check_cells(manifest, *_probe_png(pet_dir / manifest.sheet, manifest.sheet))
if manifest.acts and manifest.acts_sheet is not None:
check_act_cells(manifest, *_probe_png(pet_dir / manifest.acts_sheet, manifest.acts_sheet))
- if manifest.phone and manifest.phone_sheet is not None:
- check_phone_cells(
- manifest, *_probe_png(pet_dir / manifest.phone_sheet, manifest.phone_sheet)
- )
return manifest
@@ -195,21 +186,11 @@ def load_pet(pet_dir: Path, *, builtin: bool) -> PetPack:
acts_sheet.crop((col * size, top, (col + 1) * size, top + size))
for col in range(spec.frames)
)
- phone: dict[str, tuple[Image.Image, ...]] = {}
- if manifest.phone and manifest.phone_sheet is not None:
- phone_sheet = _decode(pet_dir / manifest.phone_sheet)
- for state, spec in manifest.phone.items():
- top = spec.row * size
- phone[state] = tuple(
- phone_sheet.crop((col * size, top, (col + 1) * size, top + size))
- for col in range(spec.frames)
- )
return PetPack(
manifest=manifest,
directory=pet_dir,
frames=MappingProxyType(frames),
acts=MappingProxyType(acts),
- phone=MappingProxyType(phone),
)
diff --git a/jarvis/ui/pets/manifest.py b/jarvis/ui/pets/manifest.py
index 7c0cab98e4..7852481779 100644
--- a/jarvis/ui/pets/manifest.py
+++ b/jarvis/ui/pets/manifest.py
@@ -19,7 +19,6 @@ from dataclasses import dataclass, field
from types import MappingProxyType
from jarvis.ui.pets.states import (
- CALL_STATES,
FRAME_SIZES,
MAX_FRAMES_PER_STATE,
NO_PET_ID,
@@ -101,11 +100,6 @@ class PetManifest:
#: ``acts_sheet``. Optional; without them the pet just idles.
acts: Mapping[str, AnimationSpec] = field(default_factory=lambda: MappingProxyType({}))
acts_sheet: str | None = None
- #: The pet on the phone: rows for the ``CALL_STATES`` in ``phone_sheet``,
- #: shown instead of the plain rows while a voice conversation runs.
- #: Optional; without them the pet just listens and talks as usual.
- phone: Mapping[str, AnimationSpec] = field(default_factory=lambda: MappingProxyType({}))
- phone_sheet: str | None = None
def spec_for(self, state: str) -> tuple[str, AnimationSpec]:
"""Return ``(resolved_state, spec)`` for ``state``.
@@ -144,13 +138,6 @@ class PetManifest:
if self.acts and self.acts_sheet is not None:
out["acts_sheet"] = self.acts_sheet
out["acts"] = {name: spec_json(spec) for name, spec in self.acts.items()}
- if self.phone and self.phone_sheet is not None:
- out["phone_sheet"] = self.phone_sheet
- out["phone"] = {
- state: spec_json(spec)
- for state in CALL_STATES
- if (spec := self.phone.get(state)) is not None
- }
return out
@@ -279,7 +266,6 @@ def parse_manifest(data: object, *, builtin: bool) -> PetManifest:
}
acts, acts_sheet = _parse_acts(data, sheet)
- phone, phone_sheet = _parse_phone(data, sheet, acts_sheet)
return PetManifest(
id=pet_id,
@@ -291,8 +277,6 @@ def parse_manifest(data: object, *, builtin: bool) -> PetManifest:
builtin=builtin,
acts=MappingProxyType(acts),
acts_sheet=acts_sheet,
- phone=MappingProxyType(phone),
- phone_sheet=phone_sheet,
)
@@ -328,34 +312,6 @@ def _parse_acts(data: Mapping, sheet: str) -> tuple[dict[str, AnimationSpec], st
return acts, acts_sheet
-def _parse_phone(
- data: Mapping, sheet: str, acts_sheet: str | None
-) -> tuple[dict[str, AnimationSpec], str | None]:
- """The optional on-the-phone rows and their sheet; both keys or neither."""
- raw_phone = data.get("phone")
- phone_sheet = data.get("phone_sheet")
- if raw_phone is None and phone_sheet is None:
- return {}, None
- if not isinstance(raw_phone, Mapping) or not raw_phone:
- raise PetManifestError("'phone' must be an object with at least one state.")
- if (
- not isinstance(phone_sheet, str)
- or not _SHEET_NAME_RE.match(phone_sheet)
- or ".." in phone_sheet
- or phone_sheet in (sheet, acts_sheet)
- ):
- raise PetManifestError("'phone_sheet' must be its own PNG file name inside the pet folder.")
- unknown = sorted(str(key) for key in raw_phone if key not in CALL_STATES)
- if unknown:
- raise PetManifestError(f"'{unknown[0]}' has no phone row; use one of the call states.")
- phone = {
- state: _parse_animation(f"phone {state}", raw_phone[state])
- for state in CALL_STATES
- if state in raw_phone
- }
- return phone, phone_sheet
-
-
def check_sheet_size(width: int, height: int) -> None:
"""Reject a sheet larger than ``MAX_SHEET_EDGE`` on either side."""
if width < 1 or height < 1:
@@ -382,12 +338,3 @@ def check_act_cells(manifest: PetManifest, width: int, height: int) -> None:
for name, spec in manifest.acts.items():
if (spec.row + 1) * size > height or spec.frames * size > width:
raise PetManifestError(f"Act '{name}' reaches outside the acts sheet.")
-
-
-def check_phone_cells(manifest: PetManifest, width: int, height: int) -> None:
- """Reject phone rows that reach outside a ``width x height`` phone sheet."""
- check_sheet_size(width, height)
- size = manifest.frame_size
- for state, spec in manifest.phone.items():
- if (spec.row + 1) * size > height or spec.frames * size > width:
- raise PetManifestError(f"Phone row '{state}' reaches outside the phone sheet.")
diff --git a/jarvis/ui/pets/states.py b/jarvis/ui/pets/states.py
index 2a67cda2a0..5790d35af7 100644
--- a/jarvis/ui/pets/states.py
+++ b/jarvis/ui/pets/states.py
@@ -18,7 +18,6 @@ Adding a state = add it here (at the END, so existing sheets keep their rows),
give it a fallback, teach the state machine when it applies, and add the label
to every locale. Nothing else needs touching.
"""
-
from __future__ import annotations
#: Every animation state a pet can show, in sprite-sheet row order.
@@ -68,12 +67,6 @@ STATE_FALLBACKS: dict[str, str] = {
"held": "listening",
}
-#: States a pet may also draw "on the phone" (``phone`` rows in ``pet.json``):
-#: the three a voice conversation runs through. While a call is live the
-#: renderer shows these rows instead of the plain ones; a pet without them
-#: simply keeps its plain rows.
-CALL_STATES: tuple[str, ...] = ("listening", "thinking", "talking")
-
#: The pet id that shows the control strip with no figure ("None" in the UI).
NO_PET_ID: str = "none"
diff --git a/jarvis/ui/pets/store.py b/jarvis/ui/pets/store.py
index 21f31d9a1f..3f24a42bd6 100644
--- a/jarvis/ui/pets/store.py
+++ b/jarvis/ui/pets/store.py
@@ -121,10 +121,10 @@ class PetStore:
data: dict = {}
if manifest_json is not None and manifest_json.strip():
data = _manifest_data(manifest_json)
- # An upload is ONE sheet: idle acts and phone rows would point
- # at a file that never arrives, so they are dropped, not rejected.
- for key in ("acts", "acts_sheet", "phone", "phone_sheet"):
- data.pop(key, None)
+ # An upload is ONE sheet: idle acts would point at a file that
+ # never arrives, so they are dropped rather than rejected.
+ data.pop("acts", None)
+ data.pop("acts_sheet", None)
if frame_size is None and "frame_size" in data:
frame_size = data["frame_size"]
size = _pick_frame_size(width, height, frame_size)
diff --git a/scripts/pets/build_pets.py b/scripts/pets/build_pets.py
index 89a761d5ce..9dbd9a12cb 100644
--- a/scripts/pets/build_pets.py
+++ b/scripts/pets/build_pets.py
@@ -41,7 +41,6 @@ sys.path.insert(0, str(REPO_ROOT))
from PIL import Image # noqa: E402
from jarvis.ui.pets.states import ( # noqa: E402
- CALL_STATES,
MAX_FRAMES_PER_STATE,
ONE_SHOT_STATES,
PET_FORMAT,
@@ -357,9 +356,6 @@ class Pose:
#: The idle act this frame belongs to (``""`` outside acts); ``state`` is
#: then ``"idle"`` so a pet's ordinary idle drawing still applies.
act: str = ""
- #: The pet is on the phone (a ``phone`` row): its ``PhoneRig`` limb holds
- #: the handset, so the pet's own drawing leaves that limb out.
- phone: bool = False
def base_pose(state: str, i: int) -> Pose:
@@ -700,108 +696,6 @@ def fx_held(f: Frame, i: int, left: Px, right: Px) -> None:
f.paint(line(right[0] - 2, right[1] - 6, right[0], right[1] - 8), ARC)
-# ---------------------------------------------------------------------------
-# On the phone: a corded handset every pet holds to its head during a call.
-# ---------------------------------------------------------------------------
-
-PHONE_BODY = hexc("#f1ebdf")
-PHONE_SHADE = hexc("#c4b8a4")
-PHONE_GRILL = hexc("#6e6355")
-
-#: The handset's two cups (earpiece, mouthpiece) and the bar between them.
-#: Seen from the front, a handset held to the head is a "bone": two round
-#: ends joined by a thick bar, lying diagonally across the cheek.
-HANDSET_CUP = (3.1, 2.7)
-#: Where a paw grips the bar: this share of the way from ear to mouth.
-HANDSET_GRIP_T = 0.55
-#: The coiled cord's sideways sway per frame, so it hangs and swings a little.
-_CORD_SWAY = (0, 0, 1, 1, 0, 0, -1, -1)
-
-
-def handset_mask(ear: tuple[float, float], mouth: tuple[float, float]) -> tuple[Mask, Mask]:
- """(cups, bar): the two round ends and the thick bar joining them."""
- cups = ellipse(ear[0], ear[1], *HANDSET_CUP) | ellipse(mouth[0], mouth[1], *HANDSET_CUP)
- bar = thick(shifted(thick(line(int(ear[0]), int(ear[1]), int(mouth[0]), int(mouth[1]))), -1, 0))
- return cups, bar
-
-
-def draw_handset(f: Frame, ear: tuple[float, float], mouth: tuple[float, float]) -> None:
- cups, bar = handset_mask(ear, mouth)
- body = cups | bar
- colors = shade(body, PHONE_BODY, light=FX_WHITE, dark=PHONE_SHADE, dark_depth=1)
- f.part(body, colors)
-
-
-def handset_grip(ear: tuple[float, float], mouth: tuple[float, float]) -> Px:
- t = HANDSET_GRIP_T
- return (round(ear[0] + (mouth[0] - ear[0]) * t), round(ear[1] + (mouth[1] - ear[1]) * t))
-
-
-def draw_cord(f: Frame, start: Px, end: Px, i: int) -> None:
- """A coiled cord sagging from the mouthpiece down to ``end``.
-
- Two pixels wide with alternating light and shaded cells inside a dark
- outline: at this size that zigzag is what reads as a coil.
- """
- (x0, y0), (x1, y1) = start, end
- sway = _CORD_SWAY[i % len(_CORD_SWAY)]
- # A quadratic sag: straight down first, then over to ``end``.
- cx, cy = x0 + sway, y1
- cells: dict[Px, RGBA] = {}
- steps = max(abs(x1 - x0), abs(y1 - y0)) * 2 + 2
- for k in range(steps + 1):
- t = k / steps
- x = round((1 - t) ** 2 * x0 + 2 * (1 - t) * t * cx + t * t * x1)
- y = round((1 - t) ** 2 * y0 + 2 * (1 - t) * t * cy + t * t * y1)
- for dx in (0, 1):
- cells[(x + dx, y)] = PHONE_BODY if (x + dx + y) % 2 == 0 else PHONE_SHADE
- f.paint(outer_ring(set(cells)), OUTLINE)
- f.paint_map(cells)
-
-
-@dataclass(frozen=True)
-class PhoneRig:
- """How one pet holds the handset during a call (``Pose.phone``).
-
- ``ear`` and ``mouth`` are the centres of the earpiece and mouthpiece cups
- in cell coordinates before the pose offset: the earpiece at the side of
- the head, the mouthpiece over the cheek towards the mouth. ``hold`` draws
- the limb that grips the bar — an arm, a paw, a pseudopod, a handle —
- from the body to the grip it is given, on top of the handset. The coiled
- cord sags from the mouthpiece to ``cord_end``.
- """
-
- ear: tuple[float, float]
- mouth: tuple[float, float]
- hold: Callable[[Frame, Pose, Px], None]
- cord_end: Px = (40, 44)
-
-
-def draw_phone(f: Frame, pose: Pose, rig: PhoneRig) -> None:
- """The cord, the handset, then the limb over its grip."""
- with f.offset(pose.dx, pose.dy):
- mouth = (round(rig.mouth[0]), round(rig.mouth[1] + HANDSET_CUP[1]))
- end = (rig.cord_end[0], rig.cord_end[1] - pose.dy)
- draw_cord(f, mouth, end, pose.i)
- draw_handset(f, rig.ear, rig.mouth)
- rig.hold(f, pose, handset_grip(rig.ear, rig.mouth))
-
-
-def paw_hold(
- shoulder: Px, fill: RGBA, light: RGBA, dark: RGBA, *, paw: tuple[float, float] = (2.2, 2.0)
-) -> Callable[[Frame, Pose, Px], None]:
- """A round paw on the grip with a stubby arm back to ``shoulder``."""
-
- def hold(f: Frame, pose: Pose, grip: Px) -> None:
- gx, gy = grip
- arm = thick(line(shoulder[0], shoulder[1], gx, gy + 1))
- ball = ellipse(gx + 0.5, gy + 0.5, *paw)
- limb = arm | ball
- f.part(limb, shade(limb, fill, light=light, dark=dark, dark_depth=1))
-
- return hold
-
-
@dataclass(frozen=True)
class Anchors:
"""Where a pet's effects go (cell coordinates, before the pose offset)."""
@@ -895,9 +789,6 @@ class PetDesign:
#: Idle acts: little one-shot scenes the pet plays now and then while
#: nothing happens (``docs/pets.md``). Written to their own ``acts.png``.
acts: tuple[IdleAct, ...] = ()
- #: How the pet holds a phone during a call; its ``phone.png`` rows are
- #: the ``CALL_STATES`` drawn with it. ``None`` = no phone rows.
- phone: PhoneRig | None = None
def counts(self) -> Mapping[str, int]:
return {**FRAME_COUNTS, **(self.frame_counts or {})}
@@ -1003,10 +894,6 @@ _GIGI_TYPE = (
def _gigi_arms(pose: Pose) -> tuple[Mask, Mask]:
"""The left and the right arm for this pose."""
- if pose.phone:
- # The right arm holds the handset (``_gigi_phone_arm``).
- left, _right = _gigi_arms(replace(pose, phone=False))
- return left, set()
if pose.act:
left, right = _GIGI_ACT_ARMS[pose.act][pose.i]
return set(_GIGI_ARMS[left]), mirrored(_GIGI_ARMS[right])
@@ -1614,17 +1501,6 @@ def gigi_post(img: Image.Image, pose: Pose) -> Image.Image:
return img
-def _gigi_phone_arm(f: Frame, pose: Pose, grip: Px) -> None:
- """Gigi's thin white arm, raised from the band to a hand on the grip."""
- gx, gy = grip
- arm = polyline([(37, 26), (38, 26), (39, 25), (gx + 1, gy + 2)])
- hand = ellipse(gx + 0.5, gy + 0.5, 1.6, 1.6)
- f.paint(outer_ring(arm | hand), OUTLINE)
- f.paint(arm | hand, GIGI_WHITE)
-
-
-GIGI_PHONE = PhoneRig(ear=(39.0, 13.0), mouth=(33.0, 25.5), hold=_gigi_phone_arm)
-
GIGI_ANCHORS = Anchors(
arcs_left=(9, 16),
arcs_right=(38, 16),
@@ -1655,7 +1531,6 @@ GIGI = PetDesign(
"held": _gigi_held_fx,
},
acts=GIGI_ACTS,
- phone=GIGI_PHONE,
)
@@ -1888,12 +1763,10 @@ def _draw_miso_sitting(f: Frame, pose: Pose) -> None:
f.paint(ellipse(CX, 38, 5, 4), MISO_CREAM)
paws_up = state == "success" and pose.dy <= -4
if state == "thinking":
- if not pose.phone: # on the phone that paw holds the handset
- _miso_paw(f, 28.5, 43) # the other paw is at the chin
+ _miso_paw(f, 28.5, 43) # the other paw is at the chin
elif state != "working" and not paws_up:
_miso_paw(f, 19.5, 43)
- if not pose.phone:
- _miso_paw(f, 28.5, 43)
+ _miso_paw(f, 28.5, 43)
ears = ("rest", "rest")
whiskers = 0
if state == "listening":
@@ -2582,17 +2455,6 @@ _MISO_ACT_BODIES: dict[str, Callable[[Frame, Pose], None]] = {
}
-def _miso_phone_paw(f: Frame, pose: Pose, grip: Px) -> None:
- """Miso's right front leg, raised from the chest to the handset."""
- gx, gy = grip
- arm = thick(line(30, 35, gx, gy + 2))
- _miso_fur(f, arm, 1)
- _miso_paw(f, gx + 0.5, gy + 0.5)
-
-
-MISO_PHONE = PhoneRig(ear=(40.5, 18.0), mouth=(34.5, 28.5), hold=_miso_phone_paw)
-
-
MISO_ANCHORS = Anchors(
arcs_left=(10, 18),
arcs_right=(37, 18),
@@ -2620,7 +2482,6 @@ MISO = PetDesign(
"held": _miso_held_fx,
},
acts=MISO_ACTS,
- phone=MISO_PHONE,
)
@@ -3284,21 +3145,6 @@ BREW_ACTS = (
)
-def _brew_phone_handle(f: Frame, pose: Pose, grip: Px) -> None:
- """No arms: the bar runs through the handle, whose outer half is drawn
- again in front of it, so the teapot cradles the handset in its loop."""
- _ = grip
- base, light, dark = BREW_GLAZE
- ring = ellipse(9, 31, 6, 6) - ellipse(9, 31, 3, 3)
- front = {p for p in ring if p[0] <= 6}
- f.part(front, _shade(front, base, light, dark, 1))
-
-
-BREW_PHONE = PhoneRig(
- ear=(5.0, 23.5), mouth=(13.0, 35.0), hold=_brew_phone_handle, cord_end=(5, 45)
-)
-
-
BREW_ANCHORS = Anchors(
arcs_left=(11, 17),
arcs_right=(32, 17),
@@ -3330,7 +3176,6 @@ BREW = PetDesign(
"held": brew_held,
},
waist=39,
- phone=BREW_PHONE,
)
@@ -3480,9 +3325,6 @@ def _bolt_arms(pose: Pose) -> tuple[Mask | None, Mask | None]:
"""The left and the right arm (``None``: drawn by the state's effect)."""
if pose.act:
return _bolt_act_arms(pose)
- if pose.phone:
- # The right arm holds the handset (``_bolt_phone_arm``).
- return _bolt_arms(replace(pose, phone=False))[0], None
rest, up, swing = _BOLT_ARM_REST, _BOLT_ARM_UP, _BOLT_ARM_SWING
s, i = pose.state, pose.i
if s == "success":
@@ -4226,16 +4068,6 @@ BOLT_ACTS = (
)
-def _bolt_phone_arm(f: Frame, pose: Pose, grip: Px) -> None:
- """Bolt's right metal arm, bent up from the case to the handset."""
- gx, gy = grip
- arm = thick(line(38, 26, gx, gy + 2)) | ellipse(gx + 0.5, gy + 0.5, 2.0, 2.0)
- f.part(arm, _shade(arm, BOLT_METAL, FX_WHITE, BOLT_METAL_DARK, 1))
-
-
-BOLT_PHONE = PhoneRig(ear=(41.5, 12.5), mouth=(35.5, 22.5), hold=_bolt_phone_arm)
-
-
BOLT_ANCHORS = Anchors(
arcs_left=(12, 15),
arcs_right=(35, 15),
@@ -4268,7 +4100,6 @@ BOLT = PetDesign(
"held": bolt_held,
},
acts=BOLT_ACTS,
- phone=BOLT_PHONE,
)
@@ -4666,16 +4497,6 @@ def mochi_held(f: Frame, pose: Pose) -> None:
f.paint({(20, top + 1), (19, top), (28, top + 1), (29, top)}, ARC)
-def _mochi_phone_nub(f: Frame, pose: Pose, grip: Px) -> None:
- """No arms either: Mochi pulls a soft nub out of its body to hold it."""
- paw_hold((37, 38), MOCHI_BASE, MOCHI_LIGHT, MOCHI_DARK, paw=(2.4, 2.2))(f, pose, grip)
-
-
-MOCHI_PHONE = PhoneRig(
- ear=(41.5, 25.5), mouth=(35.5, 35.5), hold=_mochi_phone_nub, cord_end=(42, 45)
-)
-
-
MOCHI_ANCHORS = Anchors(
arcs_left=(8, 24),
arcs_right=(39, 17),
@@ -5128,7 +4949,6 @@ MOCHI = PetDesign(
"held": mochi_held,
},
acts=MOCHI_ACTS,
- phone=MOCHI_PHONE,
)
@@ -5876,16 +5696,6 @@ SHELLY_ACTS: tuple[IdleAct, ...] = (
)
-def _shelly_phone_foot(f: Frame, pose: Pose, grip: Px) -> None:
- """A snail has only its foot: a soft fold of it curls up to the handset."""
- paw_hold((12, 40), SHELLY_BODY, SHELLY_BODY_LIGHT, SHELLY_BODY_DARK)(f, pose, grip)
-
-
-SHELLY_PHONE = PhoneRig(
- ear=(5.0, 26.0), mouth=(10.0, 37.0), hold=_shelly_phone_foot, cord_end=(3, 45)
-)
-
-
SHELLY = PetDesign(
id="shelly",
name="Shelly",
@@ -5913,7 +5723,6 @@ SHELLY = PetDesign(
"held": _shelly_held_fx,
},
acts=SHELLY_ACTS,
- phone=SHELLY_PHONE,
)
@@ -6286,9 +6095,6 @@ def _ember_tail_for(pose: Pose) -> tuple[int, int]:
def _ember_arms(pose: Pose) -> tuple[tuple[Px, Px], ...]:
"""(shoulder, claw) of each arm of the sitting dragon."""
- if pose.phone:
- # The right arm holds the handset (``_ember_phone_arm``).
- return _ember_arms(replace(pose, phone=False))[:1]
state, i = pose.state, pose.i
rest = (((16, 32), (14, 37)), ((31, 32), (33, 37)))
if state == "thinking":
@@ -6347,7 +6153,7 @@ def _draw_ember_sitting(f: Frame, pose: Pose) -> None:
cap = (0, 1, 1, 0, 1, 1, 0, 0)[i % 8] # the cap jiggles on the hop
with f.offset(tilt, 0):
_ember_head(f, pose, fins, cap=cap, soot=state == "error" and i >= 3)
- if state == "thinking" and not pose.phone:
+ if state == "thinking":
# The tapping claw sits in front of the chin.
tap = 1 if i % 4 in (1, 2) else 0
_ember_hand(f, 29, 28 + tap)
@@ -7250,14 +7056,6 @@ EMBER_ACTS = (
)
-def _ember_phone_arm(f: Frame, pose: Pose, grip: Px) -> None:
- """Ember's right arm, raised from the shoulder to a claw on the handset."""
- _ember_arm(f, (31, 32), grip)
-
-
-EMBER_PHONE = PhoneRig(ear=(39.0, 16.0), mouth=(33.0, 27.5), hold=_ember_phone_arm)
-
-
EMBER = PetDesign(
id="ember",
name="Ember",
@@ -7286,7 +7084,6 @@ EMBER = PetDesign(
"held": _ember_held_fx,
},
acts=EMBER_ACTS,
- phone=EMBER_PHONE,
)
@@ -7357,43 +7154,6 @@ def render_frame(pet: PetDesign, state: str, i: int) -> Image.Image:
return image
-def render_phone_frame(pet: PetDesign, state: str, i: int) -> Image.Image:
- """Frame ``i`` of ``state`` with the pet on the phone.
-
- The pet's own pose and drawing (minus the limb its rig uses), the
- handset with its cord and the holding limb on top. Listening and talking
- drop the shared effect: the phone at the ear already says "in a call",
- and sound arcs would run into the handset. Thinking keeps its own.
- """
- assert pet.phone is not None # noqa: S101 — callers check
- pose = replace(pet.pose(state, i), phone=True)
- body = Frame()
- pet.draw(body, pose)
- draw_phone(body, pose, pet.phone)
- image = breathe(body.image(), pose.stretch, pet.waist + pose.dy)
- if pet.post is not None:
- image = pet.post(image, pose)
- if state == "thinking":
- fx = Frame()
- own = pet.fx.get(state)
- if own is not None:
- own(fx, pose)
- else:
- draw_effects(fx, pose, pet.anchors)
- image.alpha_composite(fx.image())
- return image
-
-
-def build_phone_sheet(pet: PetDesign) -> Image.Image:
- """One row per call state (``CALL_STATES`` order), the pet on the phone."""
- counts = pet.counts()
- sheet = Image.new("RGBA", (CELL * MAX_FRAMES_PER_STATE, CELL * len(CALL_STATES)), (0, 0, 0, 0))
- for row, state in enumerate(CALL_STATES):
- for i in range(counts[state]):
- sheet.paste(render_phone_frame(pet, state, i), (i * CELL, row * CELL))
- return sheet
-
-
def build_sheet(pet: PetDesign) -> Image.Image:
sheet = Image.new("RGBA", (CELL * MAX_FRAMES_PER_STATE, CELL * len(PET_STATES)), (0, 0, 0, 0))
counts = pet.counts()
@@ -7405,8 +7165,6 @@ def build_sheet(pet: PetDesign) -> Image.Image:
#: File name of a pet's idle-act sheet.
ACTS_SHEET = "acts.png"
-#: File name of a pet's on-the-phone sheet.
-PHONE_SHEET = "phone.png"
def build_manifest(pet: PetDesign) -> dict:
@@ -7429,12 +7187,6 @@ def build_manifest(pet: PetDesign) -> dict:
act.name: {"row": row, "frames": act.frames, "fps": act.fps, "loop": False}
for row, act in enumerate(pet.acts)
}
- if pet.phone is not None:
- manifest["phone_sheet"] = PHONE_SHEET
- manifest["phone"] = {
- state: {**_animation(state, row, counts, fps), "row": row}
- for row, state in enumerate(CALL_STATES)
- }
return manifest
@@ -7510,9 +7262,6 @@ def build_all(out_dir: Path) -> list[Path]:
if pet.acts:
save_png(build_acts_sheet(pet), folder / ACTS_SHEET)
written.append(folder / ACTS_SHEET)
- if pet.phone is not None:
- save_png(build_phone_sheet(pet), folder / PHONE_SHEET)
- written.append(folder / PHONE_SHEET)
folder = out_dir / "template"
folder.mkdir(parents=True, exist_ok=True)
sheet, manifest = build_template()
diff --git a/tests/unit/ui/pets/test_builtin_pets.py b/tests/unit/ui/pets/test_builtin_pets.py
index 2d591e95aa..2fa531cfe0 100644
--- a/tests/unit/ui/pets/test_builtin_pets.py
+++ b/tests/unit/ui/pets/test_builtin_pets.py
@@ -12,7 +12,7 @@ import pytest
from PIL import Image
from jarvis.ui.pets.loader import COLOR_KEY, builtin_root, list_pets, load_pet
-from jarvis.ui.pets.states import CALL_STATES, DEFAULT_PET_ID, PET_STATES
+from jarvis.ui.pets.states import DEFAULT_PET_ID, PET_STATES
REPO_ROOT = Path(__file__).resolve().parents[4]
BUILD_SCRIPT = REPO_ROOT / "scripts" / "pets" / "build_pets.py"
@@ -89,11 +89,10 @@ def test_committed_pet_matches_the_generator(generated: Path, pet_id: str) -> No
assert (ours / "pet.json").read_text(encoding="utf-8") == (fresh / "pet.json").read_text(
encoding="utf-8"
)
- for extra in ("acts.png", "phone.png"):
- if (fresh / extra).exists():
- assert _pixels(ours / extra) == _pixels(fresh / extra), (
- f"{pet_id}: run `python scripts/pets/build_pets.py` and commit the result"
- )
+ if (fresh / "acts.png").exists():
+ assert _pixels(ours / "acts.png") == _pixels(fresh / "acts.png"), (
+ f"{pet_id}: run `python scripts/pets/build_pets.py` and commit the result"
+ )
def test_committed_template_matches_the_generator(generated: Path) -> None:
@@ -137,15 +136,3 @@ def test_every_builtin_pet_has_idle_acts(pet_id: str) -> None:
for frame in frames:
assert frame.getchannel("A").getbbox() is not None, f"{name} has an empty frame"
assert any(frame.tobytes() != idle for frame in frames), f"{name} never moves"
-
-
[email protected]("pet_id", EXPECTED_PETS)
-def test_every_builtin_pet_can_hold_a_phone(pet_id: str) -> None:
- """In a call every built-in pet holds a handset (docs/pets.md, On the phone)."""
- pack = load_pet(builtin_root() / pet_id, builtin=True)
- assert set(pack.phone) == set(CALL_STATES)
- for state in CALL_STATES:
- plain, phone = pack.frames[state], pack.phone[state]
- assert len(phone) == len(plain) == pack.manifest.phone[state].frames
- for before, after in zip(plain, phone, strict=True):
- assert before.tobytes() != after.tobytes(), f"{state}: no handset drawn"
diff --git a/tests/unit/ui/pets/test_manifest.py b/tests/unit/ui/pets/test_manifest.py
index a80baa1159..02b3310190 100644
--- a/tests/unit/ui/pets/test_manifest.py
+++ b/tests/unit/ui/pets/test_manifest.py
@@ -13,7 +13,6 @@ from jarvis.ui.pets.manifest import (
PetManifestError,
check_act_cells,
check_cells,
- check_phone_cells,
check_sheet_size,
parse_manifest,
)
@@ -267,49 +266,3 @@ def test_an_act_must_fit_its_sheet() -> None:
check_act_cells(manifest, 48 * 5, 48 * 2)
with pytest.raises(PetManifestError):
check_act_cells(manifest, 48 * 6, 48)
-
-
-# --- On the phone ------------------------------------------------------------------
-
-
-def _phone(**overrides: object) -> dict:
- phone: dict = {
- "listening": {"row": 0, "frames": 6, "fps": 8, "loop": True},
- "talking": {"row": 2, "frames": 4, "fps": 10, "loop": True},
- }
- phone.update(overrides)
- return phone
-
-
-def test_phone_rows_are_optional_call_states_on_their_own_sheet() -> None:
- manifest = parse_manifest(_data(phone=_phone(), phone_sheet="phone.png"), builtin=True)
- assert list(manifest.phone) == ["listening", "talking"]
- assert manifest.phone_sheet == "phone.png"
- again = parse_manifest(manifest.to_json(), builtin=True)
- assert again.phone == manifest.phone and again.phone_sheet == "phone.png"
- plain = parse_manifest(_data(), builtin=True)
- assert not plain.phone and plain.phone_sheet is None
- assert "phone" not in plain.to_json()
-
-
- "overrides",
- [
- {"phone": _phone()}, # no sheet
- {"phone_sheet": "phone.png"}, # no rows
- {"phone": {}, "phone_sheet": "phone.png"},
- {"phone": _phone(), "phone_sheet": "sheet.png"}, # the state sheet
- {"phone": _phone(), "phone_sheet": "../phone.png"},
- {"phone": {"sleeping": {"row": 0, "frames": 2, "fps": 3}}, "phone_sheet": "p.png"},
- ],
-)
-def test_broken_phone_rows_are_rejected(overrides: dict) -> None:
- with pytest.raises(PetManifestError):
- parse_manifest(_data(**overrides), builtin=True)
-
-
-def test_a_phone_row_must_fit_its_sheet() -> None:
- manifest = parse_manifest(_data(phone=_phone(), phone_sheet="phone.png"), builtin=True)
- check_phone_cells(manifest, 48 * 6, 48 * 3)
- with pytest.raises(PetManifestError):
- check_phone_cells(manifest, 48 * 6, 48 * 2)
diff --git a/tests/unit/ui/test_pet_overlay_renderer.py b/tests/unit/ui/test_pet_overlay_renderer.py
index e15ca528b6..c72b7185d2 100644
--- a/tests/unit/ui/test_pet_overlay_renderer.py
+++ b/tests/unit/ui/test_pet_overlay_renderer.py
@@ -420,7 +420,7 @@ def test_a_live_level_drives_the_talking_frame() -> None:
renderer.on_mode("speak")
renderer.feed_level(0.9, clock.now)
key = renderer.frame_key()
- assert key[3] == 3 # loud: the widest mouth
+ assert key[-1] == 3 # loud: the widest mouth
assert renderer.next_frame_delay_ms() == pr.LEVEL_POLL_MS + 2
# The same smoothed level gives the same key: no repaint.
assert renderer.frame_key() == key
@@ -428,7 +428,7 @@ def test_a_live_level_drives_the_talking_frame() -> None:
for _ in range(8):
clock.now += 0.05
renderer.feed_level(0.0, clock.now)
- assert renderer.frame_key()[3] == 0
+ assert renderer.frame_key()[-1] == 0
# The voice stopped arriving: back to the swing at the manifest rate.
clock.now += pr.LEVEL_FRESH_S + 0.05
assert renderer.next_frame_delay_ms() <= 105
@@ -441,7 +441,7 @@ def test_garbage_levels_are_ignored() -> None:
renderer.feed_level(None, clock.now)
renderer.feed_level(float("nan"), clock.now)
renderer.feed_level("loud", clock.now) # type: ignore[arg-type]
- assert renderer.frame_key()[3] in range(4)
+ assert renderer.frame_key()[-1] in range(4)
# --- idle acts ----------------------------------------------------------------
@@ -489,14 +489,14 @@ def test_an_idle_pet_plays_an_act_after_a_while_and_returns_to_idle() -> None:
clock.now += first_delay - 0.01
assert renderer.frame_key()[2] == "idle"
clock.now += 0.02
- assert renderer.frame_key()[2:4] == ("act:wave", 0)
+ assert renderer.frame_key()[2:] == ("act:wave", 0)
clock.now += 0.11
- assert renderer.frame_key()[2:4] == ("act:wave", 1)
+ assert renderer.frame_key()[2:] == ("act:wave", 1)
clock.now += 0.25 # past the act's 0.3 s
assert renderer.frame_key()[2] == "idle"
clock.now += gap + 0.01
# Never the same act twice in a row.
- assert renderer.frame_key()[2:4] == ("act:hop", 0)
+ assert renderer.frame_key()[2:] == ("act:hop", 0)
def test_any_other_state_cancels_the_act() -> None:
@@ -533,26 +533,3 @@ def test_a_pet_without_acts_just_idles() -> None:
renderer, _ = _renderer(clock)
clock.now += 120.0
assert renderer.frame_key()[2] == "idle"
-
-
-# --- on the phone ------------------------------------------------------------
-
-
-def test_a_voice_call_shows_the_pets_phone_rows_and_hanging_up_puts_them_away() -> None:
- renderer = pr.PetRenderer("gigi")
- renderer.on_mode("speak")
- renderer.on_mode("listen")
- assert renderer.on_call
- assert renderer.frame_key()[2] == "phone:listening"
- on_call = renderer.render()
- renderer.on_mode("idle")
- assert not renderer.on_call
- assert not str(renderer.frame_key()[2]).startswith("phone:")
- assert renderer.render() is not on_call
-
-
-def test_a_pet_without_phone_rows_keeps_its_plain_rows_in_a_call() -> None:
- renderer = pr.PetRenderer("fake", loader=_Loader({"fake": _Pack()}))
- renderer.on_mode("listen")
- assert renderer.on_call
- assert renderer.frame_key()[2] == "listening"
diff --git a/ui/orb/overlay.py b/ui/orb/overlay.py
index 13a5bed47b..ed9a98061d 100644
--- a/ui/orb/overlay.py
+++ b/ui/orb/overlay.py
@@ -979,7 +979,7 @@ class MascotRenderer:
# from OrbBusBridge on AudioOutFirst events).
self._overlay_mouth(frame, t)
- # --- 4. POST layer from animations (hand, thought bubble, phone, Z-Z-Z…)
+ # --- 4. POST layer from animations (hand, thought bubble, Z-Z-Z…)
if self._animations:
post_layer = self._make_overlay_layer(t, which="post")
if post_layer is not None:
diff --git a/ui/orb/pet_renderer.py b/ui/orb/pet_renderer.py
index baa49d59a4..f8b6668a31 100644
--- a/ui/orb/pet_renderer.py
+++ b/ui/orb/pet_renderer.py
@@ -43,7 +43,7 @@ from typing import Any
from PIL import Image
-from jarvis.ui.pets.states import CALL_STATES, NO_PET_ID
+from jarvis.ui.pets.states import NO_PET_ID
from ui.orb import controls as orb_controls
log = logging.getLogger("jarvis.orb")
@@ -90,12 +90,6 @@ _ACT_KEY = "act:"
_ColorKey = tuple[int, int, int]
-#: Frame-key prefix of an on-the-phone row (``pet.json`` ``phone``).
-_PHONE_KEY = "phone:"
-#: Voice modes in which the pet is "on the phone" — the same set that turns
-#: the strip's phone button into hang-up.
-CALL_MODES: frozenset[str] = frozenset({"listen", "think", "speak"})
-
def dpi_ratio_for(points_per_inch: float | None, platform: str = sys.platform) -> float:
"""The display scale factor from what Tk reports as one inch, in pixels.
@@ -314,8 +308,6 @@ class PetRenderer:
self._level = 0.0
self._level_at = -math.inf
self._smoothed = 0.0
- #: A voice conversation runs: the pet holds the phone to its ear.
- self._on_call = False
self.load(pet_id)
# -- pack ------------------------------------------------------------
@@ -360,14 +352,11 @@ class PetRenderer:
return
edge = int(pack.manifest.frame_size)
acts: Mapping[str, Any] = getattr(pack, "acts", None) or {}
- # Phone rows join the crop too: the handset reaches past the head.
- phone: Mapping[str, Any] = getattr(pack, "phone", None) or {}
# Act frames join the crop (a flame may reach past the idle figure)
# and are scaled with the states, under a prefixed key.
source: Mapping[str, Any] = {
**pack.frames,
**{_ACT_KEY + str(name): seq for name, seq in acts.items()},
- **{_PHONE_KEY + str(state): seq for state, seq in phone.items()},
}
try:
crop, (idle_w, idle_h) = figure_crop(source, edge)
@@ -443,12 +432,6 @@ class PetRenderer:
def on_mode(self, mode: str) -> None:
self._machine.on_mode(mode)
- self._on_call = str(mode) in CALL_MODES
-
- @property
- def on_call(self) -> bool:
- """The pet is holding the phone (a voice conversation runs)."""
- return self._on_call
def on_outcome(self, kind: str) -> None:
self._machine.on_outcome(kind)
@@ -527,22 +510,6 @@ class PetRenderer:
elapsed = max(0.0, now - started)
return _ACT_KEY + name, spec, frame_index(elapsed, spec.frames, spec.fps, False), elapsed
- def _phone_spec(self, state: str) -> tuple[str, Any] | None:
- """The on-the-phone row for ``state`` during a call, or ``None``.
-
- A pet with phone rows but none for this exact state borrows its
- ``listening`` phone row, so the handset never vanishes mid-call; a pet
- without phone rows (an uploaded one) keeps its plain rows.
- """
- if not self._on_call:
- return None
- phone = getattr(self._pack.manifest, "phone", None) or {}
- for name in (state, "listening"):
- spec = phone.get(name)
- if spec is not None and state in CALL_STATES and self._frames.get(_PHONE_KEY + name):
- return _PHONE_KEY + name, spec
- return None
-
def _current(self) -> tuple[str, Any, int, float, bool]:
"""(resolved state, spec, frame index, elapsed seconds, level-driven) for now."""
state = self.state()
@@ -550,7 +517,7 @@ class PetRenderer:
if act is not None:
key, spec, index, elapsed = act
return key, spec, index, elapsed, False
- resolved, spec = self._phone_spec(state) or self._pack.manifest.spec_for(state)
+ resolved, spec = self._pack.manifest.spec_for(state)
resolved = str(resolved)
sequence = self._frames.get(resolved) or self._frames.get(state) or ()
frames = len(sequence) or max(1, int(getattr(spec, "frames", 1)))