Add BrotherPR10ThreadLibrary class #78

Closed
opened 2026-06-24 00:11:39 +00:00 by Mark · 0 comments
Owner

Context

src/embroidery_converter/thread_manager.py defaults to DMCThreadLibrary:

class ThreadMatcher:
    def __init__(self, thread_library: Optional[ThreadLibrary] = None):
        self.thread_library: ThreadLibrary = thread_library or DMCThreadLibrary()

The SAAS service contract (Mark/easystitch-service/docs/api.md) and ThreadCraft #11 specify Brother PR-10 color matching. There's no BrotherPR10ThreadLibrary class.

Goal

Add a BrotherPR10ThreadLibrary(ThreadLibrary) class populated with the Brother "Polyneon" 40wt color card used by the PR-10 (79 entries per the ThreadCraft spec).

Implementation

  1. Source the 79-entry color card (Brother "Polyneon" 40wt / Robison-Anton equivalent).
  2. Define BrotherPR10ThreadLibrary(ThreadLibrary) in src/embroidery_converter/thread_manager.py.
  3. Each entry: {code: "907", name: "Pale Plum", hex: "#a89bb1"} — exactly the shape the service returns.
  4. Allow loading from a JSON file (THREAD_PALETTE_PATH in the service contract) so operators can swap catalogs without code changes.

Acceptance

  • BrotherPR10ThreadLibrary() instantiates with 79 entries.
  • ThreadMatcher(thread_library=BrotherPR10ThreadLibrary()).match_color("#aabbcc") returns a Brother PR-10 entry.
  • A unit test in tests/test_machine_library.py covers the catalog.
  • The PR-10 catalog can be loaded from a JSON file via a class method like BrotherPR10ThreadLibrary.from_json(path).

Blocks

  • Mark/easystitch-service#1 — /v1/threads/resolve needs this catalog.
  • Mark/Kimi_Agent_Brother_10_Digitizing_App#10 — palette picker is supposed to surface Brother catalog names.

Notes

  • The existing DMCThreadLibrary should be preserved (other callers may depend on it). BrotherPR10ThreadLibrary is additive.
  • The service contract is OK with whatever catalog you ship — it accepts any BrotherPR10ThreadLibrary-shaped catalog. v1 just needs something shippable.
## Context `src/embroidery_converter/thread_manager.py` defaults to `DMCThreadLibrary`: ```python class ThreadMatcher: def __init__(self, thread_library: Optional[ThreadLibrary] = None): self.thread_library: ThreadLibrary = thread_library or DMCThreadLibrary() ``` The SAAS service contract (`Mark/easystitch-service/docs/api.md`) and ThreadCraft #11 specify **Brother PR-10** color matching. There's no `BrotherPR10ThreadLibrary` class. ## Goal Add a `BrotherPR10ThreadLibrary(ThreadLibrary)` class populated with the Brother "Polyneon" 40wt color card used by the PR-10 (79 entries per the ThreadCraft spec). ## Implementation 1. Source the 79-entry color card (Brother "Polyneon" 40wt / Robison-Anton equivalent). 2. Define `BrotherPR10ThreadLibrary(ThreadLibrary)` in `src/embroidery_converter/thread_manager.py`. 3. Each entry: `{code: "907", name: "Pale Plum", hex: "#a89bb1"}` — exactly the shape the service returns. 4. Allow loading from a JSON file (`THREAD_PALETTE_PATH` in the service contract) so operators can swap catalogs without code changes. ## Acceptance - `BrotherPR10ThreadLibrary()` instantiates with 79 entries. - `ThreadMatcher(thread_library=BrotherPR10ThreadLibrary()).match_color("#aabbcc")` returns a Brother PR-10 entry. - A unit test in `tests/test_machine_library.py` covers the catalog. - The PR-10 catalog can be loaded from a JSON file via a class method like `BrotherPR10ThreadLibrary.from_json(path)`. ## Blocks - `Mark/easystitch-service#1` — `/v1/threads/resolve` needs this catalog. - `Mark/Kimi_Agent_Brother_10_Digitizing_App#10` — palette picker is supposed to surface Brother catalog names. ## Notes - The existing `DMCThreadLibrary` should be preserved (other callers may depend on it). `BrotherPR10ThreadLibrary` is additive. - The service contract is OK with whatever catalog you ship — it accepts any `BrotherPR10ThreadLibrary`-shaped catalog. v1 just needs *something* shippable.
Mark closed this issue 2026-06-24 00:11:39 +00:00
Sign in to join this conversation.
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
Mark/easystitch#78
No description provided.