Skip to content

Generic canvas events (WIP)#61

Draft
gselzer wants to merge 3 commits intopyapp-kit:mainfrom
gselzer:canvas-events
Draft

Generic canvas events (WIP)#61
gselzer wants to merge 3 commits intopyapp-kit:mainfrom
gselzer:canvas-events

Conversation

@gselzer
Copy link
Copy Markdown
Collaborator

@gselzer gselzer commented Mar 30, 2026

Adds KeyPressEvent and KeyReleaseEvent with the goal of enabling keyboard shortcuts in downstream tools such as ndv.

Key events are modeled using app-model's KeyBinding type. Longer-term, we should consider upstreaming pieces of the events system to app-model.

This PR also makes some minor refactors to the events model (e.g. renaming canvas_pospos, world_ray removed from MouseEvent base) in the pursuit of more general events that can be used by Canvas event filters now and maybe upstream in app-model later.

What's included

  • KeyPressEvent and KeyReleaseEvent event types
  • Qt backend support for keyboard events
  • Example: keyboard_pan_zoom.py

TODO

  • Consider adding keyboard shortcuts directly into CameraControllers
  • Jupyter backend keyboard events
  • Wx backend keyboard events

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 75.49020% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.74%. Comparing base (d8da025) to head (e74145c).

Files with missing lines Patch % Lines
src/scenex/model/_canvas.py 53.57% 13 Missing ⚠️
src/scenex/app/_jupyter.py 0.00% 6 Missing ⚠️
src/scenex/model/_nodes/camera.py 87.87% 4 Missing ⚠️
src/scenex/app/_wx.py 92.30% 1 Missing ⚠️
src/scenex/imgui/_controls.py 0.00% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (75.49%) is below the target coverage (85.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #61      +/-   ##
==========================================
- Coverage   88.13%   84.74%   -3.39%     
==========================================
  Files          62       62              
  Lines        2950     2977      +27     
==========================================
- Hits         2600     2523      -77     
- Misses        350      454     +104     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

gselzer added 3 commits March 30, 2026 14:47
As these events become more general we should use broader language
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.

1 participant