Files
ItemSense/specs/001-core-ui-camera.md

1.4 KiB

Feature: Core UI and Camera Feed (PyObjC)

Status: COMPLETE

Description

Create the main application window using PyObjC (AppKit) and display a live camera feed. This ensures a native macOS look and feel.

Requirements

  1. App & Window Setup (AppKit):

    • Initialize NSApplication.
    • Create a main NSWindow titled "ItemSense".
    • Size: 800x600 (resizable).
    • Window should center on screen.
  2. UI Layout:

    • Use NSStackView (vertical) or manual constraints to layout:
      • Top: Video Feed (NSImageView).
      • Bottom: "Capture" button (NSButton).
  3. Camera Feed:

    • Use opencv-python to capture frames from webcam (index 0).
    • Convert frames (cv2 BGR -> RGB) to NSImage/CGImage.
    • Update the NSImageView at ~30 FPS using a timer (NSTimer or equivalent app loop integration).
  4. Capture Button:

    • Standard macOS Push Button.
    • Label: "Capture".
    • Action: Print "Capture clicked" to console.
  5. Lifecycle:

    • Ensure Cmd+Q works.
    • Ensure closing the window terminates the app (or at least the applicationShouldTerminateAfterLastWindowClosed: delegate method returns True).

Acceptance Criteria

  • App launches with a native macOS window "ItemSense".
  • Live camera feed is visible in the view.
  • "Capture" button is visible at the bottom.
  • Clicking "Capture" prints to console.
  • App exits cleanly on window close or Cmd+Q.