Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All instances are always selectable #1817

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Arthurmayo
Copy link

@Arthurmayo Arthurmayo commented Jun 20, 2024

Description

Predicted instances were not selectable if they were not colored. This fix allows all instances to always be selectable by the user.

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!

❤️

Summary by CodeRabbit

  • Bug Fixes
    • Improved the logic for video selection to ensure the selectable attribute is always set to true, enhancing user interaction with predicted videos.

Copy link

coderabbitai bot commented Jun 20, 2024

Walkthrough

The recent change in video.py involves simplifying the logic that determines the self.selectable attribute within a class. Previously, the attribute depended on the state of self.predicted and the color manager's prediction settings. Now, self.selectable is always set to True, streamlining the code and potentially enhancing usability by making all items selectable regardless of other conditions.

Changes

File Change Summary
sleap/gui/widgets/video.py Simplified the logic for setting self.selectable to be always True.

Poem

In the code where widgets play,
Selectable options lead the way,
No longer bound by past conditions,
Simplified with clear decisions.
Now every item can take the stage,
A brighter path on the coding page. 🌟🐇


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
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>.
    • 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 @coderabbitai in 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 @coderabbitai in 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file 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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range and nitpick comments (4)
sleap/gui/widgets/video.py (4)

Line range hint 306-306: Avoid using bare except statements as they can catch unexpected exceptions and make debugging harder.

- except:
+ except Exception as e:
+     # Handle specific exceptions or log error

Line range hint 970-970: The loop control variable idx is not used within the loop body and can be replaced with _.

- for i, instance in enumerate(labeled_frame.instances_to_show):
+ for _i, instance in enumerate(labeled_frame.instances_to_show):

Line range hint 1169-1172: Consider using contextlib.suppress for a cleaner approach to handling exceptions where the action is to pass.

- try:
-     child.wheelEvent(event)
- except TypeError:
-     pass
+ from contextlib import suppress
+ with suppress(TypeError):
+     child.wheelEvent(event)

Line range hint 1470-1470: The variable in_bounds is assigned but never used, which can be removed to clean up the code.

- in_bounds = True
- if (x > w) or (x < 0) or (y > h) or (y < 0):
-     in_bounds = False
+ if (x > w) or (x < 0) or (y > h) or (y < 0):
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 36cdba2 and 062e87e.

Files selected for processing (1)
  • sleap/gui/widgets/video.py (1 hunks)
Additional context used
Ruff
sleap/gui/widgets/video.py

27-27: Module level import not at top of file (E402)


28-28: Module level import not at top of file (E402)


29-29: Module level import not at top of file (E402)


30-30: Module level import not at top of file (E402)


32-32: Module level import not at top of file (E402)


33-33: Module level import not at top of file (E402)


34-34: Module level import not at top of file (E402)


35-35: Module level import not at top of file (E402)


36-51: Module level import not at top of file (E402)


52-65: Module level import not at top of file (E402)


67-67: Module level import not at top of file (E402)


68-68: Module level import not at top of file (E402)


69-69: Module level import not at top of file (E402)


70-70: Module level import not at top of file (E402)


71-71: Module level import not at top of file (E402)


72-72: Module level import not at top of file (E402)


73-73: Module level import not at top of file (E402)


74-74: Module level import not at top of file (E402)


75-75: Module level import not at top of file (E402)


110-110: Use super() instead of super(__class__, self) (UP008)

Remove __super__ parameters


181-182: Use a single if statement instead of nested if statements (SIM102)

Combine if statements using and


214-214: Use super() instead of super(__class__, self) (UP008)

Remove __super__ parameters


306-306: Do not use bare except (E722)


970-970: Loop control variable idx not used within loop body (B007)

Rename unused idx to _idx


1010-1011: Use a single if statement instead of nested if statements (SIM102)

Combine if statements using and


1139-1140: Use a single if statement instead of nested if statements (SIM102)

Combine if statements using and


1169-1172: Use contextlib.suppress(TypeError) instead of try-except-pass (SIM105)

Replace with contextlib.suppress(TypeError)


1209-1209: Use super() instead of super(__class__, self) (UP008)

Remove __super__ parameters


1209-1209: Star-arg unpacking after a keyword argument is strongly discouraged (B026)


1324-1324: Use super() instead of super(__class__, self) (UP008)

Remove __super__ parameters


1390-1390: Use super() instead of super(__class__, self) (UP008)

Remove __super__ parameters


1396-1396: Star-arg unpacking after a keyword argument is strongly discouraged (B026)


1470-1470: Local variable in_bounds is assigned to but never used (F841)

Remove assignment to unused variable in_bounds


1543-1543: Use super() instead of super(__class__, self) (UP008)

Remove __super__ parameters


1567-1567: Use super() instead of super(__class__, self) (UP008)

Remove __super__ parameters


1582-1582: Use super() instead of super(__class__, self) (UP008)

Remove __super__ parameters


1629-1629: Use super() instead of super(__class__, self) (UP008)

Remove __super__ parameters


1632-1632: Star-arg unpacking after a keyword argument is strongly discouraged (B026)


1780-1780: Use super() instead of super(__class__, self) (UP008)

Remove __super__ parameters


1965-1965: Avoid extraneous parentheses (UP034)

Remove extraneous parentheses


1965-1965: Avoid extraneous parentheses (UP034)

Remove extraneous parentheses


1968-1968: Avoid extraneous parentheses (UP034)

Remove extraneous parentheses


1968-1968: Avoid extraneous parentheses (UP034)

Remove extraneous parentheses


2278-2278: Use super() instead of super(__class__, self) (UP008)

Remove __super__ parameters


2283-2283: Use super() instead of super(__class__, self) (UP008)

Remove __super__ parameters


2300-2300: Use super() instead of super(__class__, self) (UP008)

Remove __super__ parameters


2344-2344: Loop control variable i not used within loop body (B007)

Rename unused i to _i

Additional comments not posted (1)
sleap/gui/widgets/video.py (1)

1790-1790: The change ensures that all instances are always selectable, aligning with the PR's goal. This is a simple yet effective fix for the issue where non-colored predicted instances were not selectable.

Copy link
Contributor

@gitttt-1234 gitttt-1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be movable. Ensure on-click functionality to create Instance from PredictedInstance still works.

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.

2 participants