Skip to content

Conversation

@sjmf
Copy link
Owner

@sjmf sjmf commented Feb 4, 2026

Summary

  • Adds File > Take Screenshot menu action that captures the current video frame at native camera resolution (closes Screenshot functionality #25)
  • Copies the frame to the clipboard immediately, then opens a save dialog defaulting to ~/kvm_screenshot_<timestamp>.png
  • Shows confirmation dialogs for save success, save failure (clipboard-only fallback), or dialog cancellation (clipboard-only)

Details

The QPixmap is grabbed directly from the QGraphicsPixmapItem which holds the frame at the camera's native resolution — QGraphicsView.fitInView() only scales the view, not the underlying pixmap — so the screenshot bypasses any window-size-dependent scaling.

No new dependencies. QPixmap.save() handles PNG natively and QApplication.clipboard() is already used for paste.

Test plan

  • 8 new tests in test_kvm_screenshot.py covering:
    • No video frame / null pixmap warnings
    • Clipboard copy
    • File save success with confirmation dialog
    • File save failure with warning dialog
    • Dialog cancellation (clipboard-only path)
    • Default timestamped filename format
    • None clipboard graceful handling
  • Full suite: 245 passed, 4 skipped, 0 failed

sjmf and others added 3 commits February 4, 2026 03:47
Adds the menu entry and a stub method, wired up but not yet
implemented.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Import QFileDialog
- Grab QPixmap from the display item at native camera resolution
- Copy to clipboard immediately via QApplication.clipboard()
- Open a save dialog defaulting to ~/kvm_screenshot_<timestamp>.png
- Show confirmation dialogs for save, save-failure, or clipboard-only

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add QFileDialog to mocked widgets in test base
- Test no-frame warning, None pixmap, clipboard copy, file save
  success/failure, dialog cancellation, default filename format,
  and None clipboard handling

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Feb 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.25%. Comparing base (b6c67ac) to head (e01410c).
⚠️ Report is 7 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #27      +/-   ##
==========================================
+ Coverage   77.98%   78.25%   +0.26%     
==========================================
  Files          19       19              
  Lines        1731     1752      +21     
  Branches      210      214       +4     
==========================================
+ Hits         1350     1371      +21     
  Misses        381      381              
Flag Coverage Δ
unittests 78.25% <100.00%> (+0.26%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sjmf sjmf merged commit ae90d00 into main Feb 4, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Screenshot functionality

1 participant