Goto instance change key binding
Description
Adding a keybinding to jump to the next (or previous) frame where the number of displayed instances changes from the current frame
Types of changes
- [ ] Bugfix
- [ ] New feature
- [ ] Refactor / Code style update (no logical changes)
- [ ] Build / CI changes
- [ ] Documentation Update
- [ ] Other (explain)
Does this address any currently open issues?
[list open issues here]
Outside contributors checklist
- [ ] Review the guidelines for contributing to this repository
- [ ] Read and sign the CLA and add yourself to the authors list
- [ ] Make sure you are making a pull request against the develop branch (not main). Also you should start your branch off develop
- [ ] Add tests that prove your fix is effective or that your feature works
- [ ] Add necessary documentation (if appropriate)
Thank you for contributing to SLEAP!
:heart:
Summary by CodeRabbit
- New Features
- Introduced new keyboard shortcuts (Ctrl+Shift+Right and Ctrl+Shift+Left) for quick navigation to the next and previous instance changes.
- Added corresponding menu items under the "Go" menu for both next and previous instance changes, enhancing navigation within the application.
- Expanded the list of available shortcuts with the addition of "goto next instance change" and "goto prev instance change".
- Tests
- Added a new test to validate the functionality of navigating to the next instance change in labeled frames.
- Added a new test to validate the functionality of navigating to the previous instance change in labeled frames.
Walkthrough
The changes introduce two new keyboard shortcuts in the configuration file sleap/config/shortcuts.yaml for navigating instance changes within the application. The shortcuts, goto next instance change (Ctrl+Shift+Right) and goto prev instance change (Ctrl+Shift+Left), are complemented by new menu items in the MainWindow class of sleap/gui/app.py. The command logic for these actions is implemented in sleap/gui/commands.py, allowing users to navigate to frames with differing instance counts. Additionally, test cases for these functionalities are added in tests/gui/test_commands.py.
Changes
| Files | Change Summary |
|---|---|
sleap/config/shortcuts.yaml, sleap/gui/shortcuts.py |
Added new keyboard shortcuts: "goto next instance change" (Ctrl+Shift+Right) and "goto prev instance change" (Ctrl+Shift+Left) |
sleap/gui/app.py |
Introduced new menu items for "goto next instance change" and "goto prev instance change" in the MainWindow class |
sleap/gui/commands.py |
Added methods and classes for navigating to the next and previous instance changes (nextInstanceChange, GoNextInstanceChange, GoPrevInstanceChange) |
tests/gui/test_commands.py |
Added test functions test_go_next_instance_change and test_go_prev_instance_change to validate the new navigation commands |
Sequence Diagram(s)
sequenceDiagram
participant U as User
participant UI as Interface (Menu/Shortcut)
participant MW as MainWindow
participant CC as CommandContext
participant GN as GoNextInstanceChange
participant GP as GoPrevInstanceChange
participant V as Video/Data
U->>UI: Triggers "goto next instance change"
UI->>MW: Activates menu/shortcut command
MW->>CC: Calls nextInstanceChange()
CC->>GN: Executes GoNextInstanceChange.do_action(context, params)
GN->>V: Retrieves current frame and instance count
V-->>GN: Returns current data
GN->>V: Searches for next frame with a different instance count
V-->>GN: Returns target frame index
GN->>CC: Issues navigation instruction
CC-->>MW: Updates UI to target frame
MW-->>U: Displays the new instance change
U->>UI: Triggers "goto prev instance change"
UI->>MW: Activates menu/shortcut command
MW->>CC: Calls prevInstanceChange()
CC->>GP: Executes GoPrevInstanceChange.do_action(context, params)
GP->>V: Retrieves current frame and instance count
V-->>GP: Returns current data
GP->>V: Searches for previous frame with a different instance count
V-->>GP: Returns target frame index
GP->>CC: Issues navigation instruction
CC-->>MW: Updates UI to target frame
MW-->>U: Displays the new instance change
Suggested labels
2024-hackathon
Suggested reviewers
- roomrys
Poem
I’m a rabbit in the codefield, so spry and keen,
Hopping through shortcuts like a digital dream,
With a tap and a skip, I jump to the next change,
Instance hops in the code, daring and strange!
Celebrate each key press, let the changes gleam –
A bunny’s joy in every clean code stream! 🐇✨
✨ Finishing Touches
- [ ] 📝 Generate Docstrings
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and generate unit testing code.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai planto trigger planning for file edits and PR creation.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
Codecov Report
Attention: Patch coverage is 92.85714% with 2 lines in your changes missing coverage. Please review.
Project coverage is 76.17%. Comparing base (
7991f14) to head (4e9e869). Report is 98 commits behind head on develop.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| sleap/gui/commands.py | 92.30% | 2 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## develop #2148 +/- ##
===========================================
+ Coverage 75.43% 76.17% +0.73%
===========================================
Files 134 134
Lines 24749 24837 +88
===========================================
+ Hits 18670 18920 +250
+ Misses 6079 5917 -162
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.