-
Notifications
You must be signed in to change notification settings - Fork 119
(4a -> 4) Add double click functionality to UnlinkVideoTable #1763
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
(4a -> 4) Add double click functionality to UnlinkVideoTable #1763
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There must be something up with the load_video in videos.py. I would expect the unlinked_video to load, but it doesn't appear to be loading!
sleap/gui/widgets/docks.py
Outdated
| ellipsis_left=True, | ||
| ) | ||
| self.unlinked_videos_table = GenericTableView( | ||
| is_activatable= True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure to lint your files before pushing with
black <path/to/file>so
black sleap/gui/widgets/docks.py|
I re-encoded the video.mp4 files using this command: Screen.Recording.2024-05-17.at.4.01.03.PM.mov |
|
Warning Rate Limit Exceeded@roomrys has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 9 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. WalkthroughThe recent updates encompass various enhancements and modifications across multiple files in the SLEAP GUI application. These changes include improvements to video handling and GUI updates, addition of new encoding functions, and minor tweaks like adding print statements and blank lines. The modifications aim to improve functionality, maintainability, and user experience. Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant User
participant GUI
participant VideoHandler
participant Encoder
User->>GUI: Opens video file
GUI->>VideoHandler: Load video
VideoHandler->>GUI: Update GUI with video
User->>Encoder: Encode video
Encoder->>User: Provide encoded video
Poem
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
Out of diff range and nitpick comments (9)
sleap/gui/dataviews.py (1)
349-349: Consider replacing print statements with logging.While the print statement in
activateSelectedaids in debugging, it's generally a good practice to use logging instead of printing in production code. This allows better control over the output and integrates well with different logging systems.sleap/gui/widgets/video.py (3)
Line range hint
27-75: Move module-level imports to the top of the file for better readability and compliance with Python standards.+ import atexit + import math + import time + from typing import Callable, List, Optional, Union + import numpy as np + import qimage2ndarray + from qtpy import QtCore, QtWidgets + from qtpy.QtCore import QLineF, QMarginsF, QPointF, QRectF, Qt + from qtpy.QtGui import ( + QBrush, + QColor, + QCursor, + QFont, + QImage, + QKeyEvent, + QKeySequence, + QMouseEvent, + QPainter, + QPainterPath, + QPen, + QPixmap, + QPolygonF, + QTransform, + ) + from qtpy.QtWidgets import ( + QApplication, + QGraphicsEllipseItem, + QGraphicsItem, + QGraphicsObject, + QGraphicsPolygonItem, + QGraphicsRectItem, + QGraphicsScene, + QGraphicsTextItem, + QGraphicsView, + QShortcut, + QVBoxLayout, + QWidget, + ) + import sleap + from sleap.gui.color import ColorManager + from sleap.gui.shortcuts import Shortcuts + from sleap.gui.state import GuiState + from sleap.gui.widgets.slider import VideoSlider + from sleap.instance import Instance, Point, PredictedInstance + from sleap.io.video import Video + from sleap.prefs import prefs + from sleap.skeleton import Node
Line range hint
307-307: Specify exception types in theexceptblock to avoid masking unexpected errors.- except: + except SpecificExceptionType:
Line range hint
1471-1471: Remove the unused variablein_boundsto clean up the code.- in_bounds = Truesleap/gui/commands.py (5)
Line range hint
56-56: Remove unused import ofCamcorder.- from sleap.io.cameras import Camcorder, FrameGroup, InstanceGroup, RecordingSession + from sleap.io.cameras import FrameGroup, InstanceGroup, RecordingSession
Line range hint
196-196: Undefined reference toMainWindow. Ensure thatMainWindowis defined or imported correctly.
Line range hint
868-868: The local variablefile_diris assigned but never used. Consider removing it if it's unnecessary.- file_dir = os.path.dirname(filename)
Line range hint
1761-1761: Avoid using bareexceptstatements. Specify exception types to handle specific exceptions appropriately.- except: + except Exception as e:Also applies to: 1782-1782, 3354-3354
Line range hint
2555-2555: These f-strings do not contain placeholders. If dynamic string formatting is not needed, consider using regular strings.- f"This video type {type(video.backend)} for video at index {idx} " - f"does not support grayscale yet." + "This video type does not support grayscale yet."Also applies to: 2991-2991
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (12)
tests/data/videos/centered_pair_small_encoded.mp4is excluded by!**/*.mp4,!**/*.mp4tests/data/videos/dance_encoded.mp4is excluded by!**/*.mp4,!**/*.mp4tests/data/videos/min_session_backL_encoded.mp4is excluded by!**/*.mp4,!**/*.mp4tests/data/videos/min_session_back_encoded.mp4is excluded by!**/*.mp4,!**/*.mp4tests/data/videos/min_session_midL_encoded.mp4is excluded by!**/*.mp4,!**/*.mp4tests/data/videos/min_session_mid_encoded.mp4is excluded by!**/*.mp4,!**/*.mp4tests/data/videos/min_session_sideL_encoded.mp4is excluded by!**/*.mp4,!**/*.mp4tests/data/videos/min_session_side_encoded.mp4is excluded by!**/*.mp4,!**/*.mp4tests/data/videos/min_session_topL_encoded.mp4is excluded by!**/*.mp4,!**/*.mp4tests/data/videos/min_session_top_encoded.mp4is excluded by!**/*.mp4,!**/*.mp4tests/data/videos/small_robot_3_frame_encoded.mp4is excluded by!**/*.mp4,!**/*.mp4tests/data/videos/small_robot_encoded.mp4is excluded by!**/*.mp4,!**/*.mp4
Files selected for processing (7)
- Anaconda3-2023.04-MacOSX-x86_64.sh (1 hunks)
- sleap/gui/app.py (2 hunks)
- sleap/gui/commands.py (1 hunks)
- sleap/gui/dataviews.py (1 hunks)
- sleap/gui/scripts/reencoder.py (1 hunks)
- sleap/gui/widgets/docks.py (2 hunks)
- sleap/gui/widgets/video.py (2 hunks)
Additional Context Used
ShellCheck (3)
Anaconda3-2023.04-MacOSX-x86_64.sh (3)
[info] 1-1: The mentioned syntax error was in this simple command.
[error] 1-1: Couldn't parse this redirection. Fix to allow more checks.
[error] 1-1: Fix any mentioned problems and try again.
Ruff (39)
sleap/gui/app.py (1)
261-261: Local variable
filenameis assigned to but never usedsleap/gui/commands.py (8)
56-56:
sleap.io.cameras.Camcorderimported but unused
196-196: Undefined name
MainWindow
868-868: Local variable
file_diris assigned to but never used
1761-1761: Do not use bare
except
1782-1782: Do not use bare
except
2555-2555: f-string without any placeholders
2991-2991: f-string without any placeholders
3354-3354: Do not use bare
exceptsleap/gui/dataviews.py (6)
25-25:
typing.Dictimported but unused
25-25:
typing.Typeimported but unused
29-29:
sleap.gui.color.ColorManagerimported but unused
30-30:
sleap.io.dataset.Labelsimported but unused
31-31:
sleap.instance.Instanceimported but unused
118-118: Do not use bare
exceptsleap/gui/widgets/docks.py (3)
15-15: Redefinition of unused
QLabelfrom line 12
16-16: Redefinition of unused
QComboBoxfrom line 8
18-18: Redefinition of unused
QGroupBoxfrom line 10sleap/gui/widgets/video.py (21)
27-27: Module level import not at top of file
28-28: Module level import not at top of file
29-29: Module level import not at top of file
30-30: Module level import not at top of file
32-32: Module level import not at top of file
33-33: Module level import not at top of file
34-34: Module level import not at top of file
35-35: Module level import not at top of file
36-51: Module level import not at top of file
52-65: Module level import not at top of file
67-67: Module level import not at top of file
68-68: Module level import not at top of file
69-69: Module level import not at top of file
70-70: Module level import not at top of file
71-71: Module level import not at top of file
72-72: Module level import not at top of file
73-73: Module level import not at top of file
74-74: Module level import not at top of file
75-75: Module level import not at top of file
307-307: Do not use bare
except
1471-1471: Local variable
in_boundsis assigned to but never used
Additional comments not posted (2)
sleap/gui/widgets/docks.py (1)
674-675: Verify the impact of removing double-click functionality fromunlinked_videos_table.The method
on_unlinked_video_double_clickedwas commented out, and the table was made activatable. Please ensure that this change does not negatively affect the user experience, especially if the double-click functionality was used for important features.sleap/gui/widgets/video.py (1)
409-409: Check for potential issues with video loading logic.Verification successful
Verify handling of
Nonevideo inload_videomethodThe
load_videomethod implementations insleap/gui/widgets/video.pyandsleap/gui/dialogs/importvideos.pyhandle theNonevideo case appropriately.Key Findings:
sleap/gui/widgets/video.py:
- The method checks if
self.videoisNoneand callsself.reset()if true.- This ensures that the application handles the
Nonevideo case gracefully.sleap/gui/dialogs/importvideos.py:
- The method does not explicitly check for
Nonevideo, but it sets the video and frame index, and updates the label and plot accordingly.Recommendations:
- Ensure that all usages of
load_videoinsleap/gui/dialogs/importvideos.pyhandle theNonevideo case if necessary.Code Locations:
sleap/gui/widgets/video.py:def load_video(self, video: Video, plot=True): self.video = video if self.video is None: self.reset() else: self.view.scene.setSceneRect(0, 0, video.width, video.height) self.seekbar.setMinimum(0) self.seekbar.setMaximum(self.video.last_frame_idx) self.seekbar.setEnabled(True) self.seekbar.resizeEvent() if plot: self.plot()sleap/gui/dialogs/importvideos.py:def load_video(self, video: Video, initial_frame=0, plot=True): self.video = video self.frame_idx = initial_frame label = "(%d, %d), %d f, %d c" % ( self.video.width, self.video.height, self.video.frames, self.video.channels, ) self.video_label.setText(label) if plot: self.plot(initial_frame)Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the video loading logic handles all edge cases, especially when video is `None`. # Test: Search for other usages of `load_video` method to ensure consistency. Expect: Consistent handling of `None` video across the application. rg --type python $'load_video'Length of output: 60
Script:
#!/bin/bash # Description: Verify that the video loading logic handles all edge cases, especially when video is `None`. # Test: Search for other usages of `load_video` method to ensure consistency. Expect: Consistent handling of `None` video across the application. rg 'load_video' --glob '*.py'Length of output: 1196
Script:
#!/bin/bash # Description: Extract the `load_video` method implementations to verify handling of `None` video. # Extract the `load_video` method from `sleap/gui/widgets/video.py` ast-grep --lang python --pattern $'def load_video($_, $_):\n $$$' sleap/gui/widgets/video.py # Extract the `load_video` method from `sleap/gui/dialogs/importvideos.py` ast-grep --lang python --pattern $'def load_video($_, $_, $_):\n $$$' sleap/gui/dialogs/importvideos.py # Extract the `load_video` method from `sleap/io/video.py` ast-grep --lang python --pattern $'def load_video($_, $_):\n $$$' sleap/io/video.pyLength of output: 289
Script:
#!/bin/bash # Description: Extract the `load_video` method implementations to verify handling of `None` video. # Extract the `load_video` method from `sleap/gui/widgets/video.py` ast-grep --lang python --pattern $'def load_video(self, video: Video, plot=True):\n $$$' sleap/gui/widgets/video.py # Extract the `load_video` method from `sleap/gui/dialogs/importvideos.py` ast-grep --lang python --pattern $'def load_video(self, video: Video, initial_frame=0, plot=True):\n $$$' sleap/gui/dialogs/importvideos.py # Extract the `load_video` method from `sleap/io/video.py` ast-grep --lang python --pattern $'def load_video(filename: str, *args, **kwargs):\n $$$' sleap/io/video.pyLength of output: 2768
sleap/gui/app.py
Outdated
| # def set_current_video(self, video): | ||
| # """Sets the current video and updates the video player and other related UI components.""" | ||
| # self.state['video'] = video | ||
| # self.update_video_player(video) # Make sure this method exists in the player | ||
| # self.update_related_views(video) # Update other views that might depend on the video | ||
|
|
||
| # def update_video_player(self, video): | ||
| # """Updates the video player with a new video.""" | ||
| # if hasattr(self, 'player') and self.player: | ||
| # self.player.set_video(video) # Make sure the video player has this method | ||
|
|
||
| # def update_related_views(self, video): | ||
| # """Updates other views in the UI that might depend on the video being changed.""" | ||
| # self.plotFrame() # Refresh the frame view if necessary | ||
|
|
||
| # def set_video(self, video): | ||
| # """Load video into the video player.""" | ||
| # self.video_source = video # Store the video source for later use | ||
| # self.load_video() # Make sure this method exists in the player | ||
|
|
||
| # def set_current_video(self, video): | ||
| # """Sets the current video in the state and updates the GUI accordingly.""" | ||
| # self.state["video"] = video | ||
| # self.on_data_update([UpdateTopic.video]) | ||
|
|
||
| # def reset_views(self): | ||
| # """Resets views to their default state.""" | ||
| # self.player.reset_zoom() | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented-out code for clarity and maintainability.
- # # Sessions menu double click
- # def set_current_video(self, video):
- # """Sets the current video and updates the video player and other related UI components."""
- # self.state['video'] = video
- # self.update_video_player(video) # Make sure this method exists in the player
- # self.update_related_views(video) # Update other views that might depend on the video
-
- # def update_video_player(self, video):
- # """Updates the video player with a new video."""
- # if hasattr(self, 'player') and self.player:
- # self.player.set_video(video) # Make sure the video player has this method
-
- # def update_related_views(self, video):
- # """Updates other views in the UI that might depend on the video being changed."""
- # self.plotFrame() # Refresh the frame view if necessary
-
- # def set_video(self, video):
- # """Load video into the video player."""
- # self.video_source = video # Store the video source for later use
- # self.load_video() # Make sure this method exists in the player
-
- # def set_current_video(self, video):
- # """Sets the current video in the state and updates the GUI accordingly."""
- # self.state["video"] = video
- # self.on_data_update([UpdateTopic.video])
-
- # def reset_views(self):
- # """Resets views to their default state."""
- # self.player.reset_zoom()
-
- # def _initialize_gui(self):
- # """Initial setup for GUI components."""
- # self.player = QtVideoPlayer(self)Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| # def set_current_video(self, video): | |
| # """Sets the current video and updates the video player and other related UI components.""" | |
| # self.state['video'] = video | |
| # self.update_video_player(video) # Make sure this method exists in the player | |
| # self.update_related_views(video) # Update other views that might depend on the video | |
| # def update_video_player(self, video): | |
| # """Updates the video player with a new video.""" | |
| # if hasattr(self, 'player') and self.player: | |
| # self.player.set_video(video) # Make sure the video player has this method | |
| # def update_related_views(self, video): | |
| # """Updates other views in the UI that might depend on the video being changed.""" | |
| # self.plotFrame() # Refresh the frame view if necessary | |
| # def set_video(self, video): | |
| # """Load video into the video player.""" | |
| # self.video_source = video # Store the video source for later use | |
| # self.load_video() # Make sure this method exists in the player | |
| # def set_current_video(self, video): | |
| # """Sets the current video in the state and updates the GUI accordingly.""" | |
| # self.state["video"] = video | |
| # self.on_data_update([UpdateTopic.video]) | |
| # def reset_views(self): | |
| # """Resets views to their default state.""" | |
| # self.player.reset_zoom() |
Anaconda3-2023.04-MacOSX-x86_64.sh
Outdated
| <html> | ||
| <head><title>404 Not Found</title></head> | ||
| <body> | ||
| <h1>404 Not Found</h1> | ||
| <ul> | ||
| <li>Code: NoSuchKey</li> | ||
| <li>Message: The specified key does not exist.</li> | ||
| <li>Key: archive/Anaconda3-2023.04-MacOSX-x86_64.sh</li> | ||
| <li>RequestId: JN3NZ482V2KEXBWF</li> | ||
| <li>HostId: 0GXC8ZHyNDkFKx1qq4jrODGfQsL1teYcmq3W66a2rLSMAgrpIb5V6F3tUmkLB4Bd6VYiTe20VLw=</li> | ||
| </ul> | ||
| <hr/> | ||
| </body> | ||
| </html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file appears to be an HTML error page instead of a shell script.
This indicates that the script Anaconda3-2023.04-MacOSX-x86_64.sh might not exist at the specified location, leading to a 404 error. Please verify the URL or provide an alternative download source.
sleap/gui/scripts/reencoder.py
Outdated
| def encode_video(input_file, output_file): | ||
| """Encode a video using ffmpeg with specified parameters.""" | ||
| command = [ | ||
| 'ffmpeg', '-y', | ||
| '-i', input_file, | ||
| '-c:v', 'libx264', | ||
| '-pix_fmt', 'yuv420p', | ||
| '-preset', 'superfast', | ||
| '-crf', '23', | ||
| output_file | ||
| ] | ||
| try: | ||
| subprocess.run(command, check=True) | ||
| print(f"Encoding completed: {output_file}") | ||
| except subprocess.CalledProcessError: | ||
| print(f"An error occurred during encoding: {input_file}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enhance error handling in the encode_video function.
Consider raising an exception or returning a status code after an encoding failure, instead of just printing an error message. This would allow calling functions to handle errors more effectively.
sleap/gui/scripts/reencoder.py
Outdated
| def encode_directory(directory): | ||
| """Encodes all .mp4 files in the specified directory.""" | ||
| for filename in os.listdir(directory): | ||
| if filename.endswith(".mp4"): | ||
| input_file = os.path.join(directory, filename) | ||
| output_file = os.path.join(directory, os.path.splitext(filename)[0] + '_encoded.mp4') | ||
| print(f"Starting encoding: {input_file}") | ||
| encode_video(input_file, output_file) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add error handling for file access issues in encode_directory.
Consider adding error handling for potential exceptions that can arise from os.listdir and file access permissions. This will make the function more robust and prevent it from failing silently in case of issues.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## liezl/add-gui-elements-for-sessions #1763 +/- ##
====================================================================
Coverage 74.07% 74.08%
====================================================================
Files 135 135
Lines 25261 25264 +3
====================================================================
+ Hits 18713 18716 +3
Misses 6548 6548 ☔ View full report in Codecov by Sentry. |
sleap/gui/dataviews.py
Outdated
| """ | ||
| if self.is_activatable: | ||
| self.state[self.row_name] = self.getSelectedRowItem() | ||
| print("Activated:", self.row_name, self.state[self.row_name]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove debugging print
There was a problem hiding this 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
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- sleap/gui/scripts/reencoder.py (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- sleap/gui/scripts/reencoder.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- sleap/gui/app.py (1 hunks)
- sleap/gui/scripts/reencoder.py (1 hunks)
- sleap/gui/widgets/docks.py (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- sleap/gui/scripts/reencoder.py
Additional Context Used
Ruff (4)
sleap/gui/app.py (1)
261-261: Local variable
filenameis assigned to but never usedsleap/gui/widgets/docks.py (3)
15-15: Redefinition of unused
QLabelfrom line 12
16-16: Redefinition of unused
QComboBoxfrom line 8
18-18: Redefinition of unused
QGroupBoxfrom line 10
Additional comments not posted (2)
sleap/gui/widgets/docks.py (1)
674-674: Double-click functionality added tounlinked_videos_tableby making it activatable.sleap/gui/app.py (1)
1835-1836: Well-implemented drop event handling.The method effectively parses the filenames and checks for supported file types, raising an appropriate error for unsupported types.
sleap/gui/app.py
Outdated
| if __name__ == "__main__": | ||
| ds = os.environ["dsmview"] | ||
| main([ds]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add error handling for environment variable access.
- ds = os.environ["dsmview"]
+ ds = os.environ.get("dsmview", "default_value") # Replace 'default_value' with an appropriate defaultConsider adding error handling or a default value when accessing the 'dsmview' environment variable to prevent potential KeyError if it's not set.
Committable suggestion was skipped due low confidence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove some of the extra files please. Also, I don't see that the videos were reencoded. Can you add the re-encoded videos here (their binaries should have changed which should have been picked up by git).
sleap/gui/app.py
Outdated
| if __name__ == "__main__": | ||
| ds = os.environ["dsmview"] | ||
| main([ds]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if __name__ == "__main__": | |
| ds = os.environ["dsmview"] | |
| main([ds]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Outside diff range and nitpick comments (3)
sleap/gui/widgets/video.py (3)
Line range hint
27-75: Move module-level imports to the top of the file.+ from collections import deque + import atexit + import math + import time + from typing import Callable, List, Optional, Union + import numpy as np + import qimage2ndarray + from qtpy import QtCore, QtWidgets + from qtpy.QtCore import QLineF, QMarginsF, QPointF, QRectF, Qt + from qtpy.QtGui import ( + QBrush, + QColor, + QCursor, + QFont, + QImage, + QKeyEvent, + QKeySequence, + QMouseEvent, + QPainter, + QPainterPath, + QPen, + QPixmap, + QPolygonF, + QTransform, + ) + from qtpy.QtWidgets import ( + QApplication, + QGraphicsEllipseItem, + QGraphicsItem, + QGraphicsObject, + QGraphicsPolygonItem, + QGraphicsRectItem, + QGraphicsScene, + QGraphicsTextItem, + QGraphicsView, + QShortcut, + QVBoxLayout, + QWidget, + ) + import sleap + from sleap.gui.color import ColorManager + from sleap.gui.shortcuts import Shortcuts + from sleap.gui.state import GuiState + from sleap.gui.widgets.slider import VideoSlider + from sleap.instance import Instance, Point, PredictedInstance + from sleap.io.video import Video + from sleap.prefs import prefs + from sleap.skeleton import Node
Line range hint
307-307: Replace the bareexceptwith a more specific exception type.- except: + except Exception as e: + # Log or handle the exception as needed
Line range hint
1471-1471: Remove the unused local variablein_bounds.- in_bounds = True
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (12)
tests/data/videos/centered_pair_small.mp4is excluded by!**/*.mp4,!**/*.mp4tests/data/videos/dance.mp4is excluded by!**/*.mp4,!**/*.mp4tests/data/videos/min_session_back.mp4is excluded by!**/*.mp4,!**/*.mp4tests/data/videos/min_session_backL.mp4is excluded by!**/*.mp4,!**/*.mp4tests/data/videos/min_session_mid.mp4is excluded by!**/*.mp4,!**/*.mp4tests/data/videos/min_session_midL.mp4is excluded by!**/*.mp4,!**/*.mp4tests/data/videos/min_session_side.mp4is excluded by!**/*.mp4,!**/*.mp4tests/data/videos/min_session_sideL.mp4is excluded by!**/*.mp4,!**/*.mp4tests/data/videos/min_session_top.mp4is excluded by!**/*.mp4,!**/*.mp4tests/data/videos/min_session_topL.mp4is excluded by!**/*.mp4,!**/*.mp4tests/data/videos/small_robot.mp4is excluded by!**/*.mp4,!**/*.mp4tests/data/videos/small_robot_3_frame.mp4is excluded by!**/*.mp4,!**/*.mp4
Files selected for processing (1)
- sleap/gui/widgets/video.py (1 hunks)
Additional Context Used
Ruff (21)
sleap/gui/widgets/video.py (21)
27-27: Module level import not at top of file
28-28: Module level import not at top of file
29-29: Module level import not at top of file
30-30: Module level import not at top of file
32-32: Module level import not at top of file
33-33: Module level import not at top of file
34-34: Module level import not at top of file
35-35: Module level import not at top of file
36-51: Module level import not at top of file
52-65: Module level import not at top of file
67-67: Module level import not at top of file
68-68: Module level import not at top of file
69-69: Module level import not at top of file
70-70: Module level import not at top of file
71-71: Module level import not at top of file
72-72: Module level import not at top of file
73-73: Module level import not at top of file
74-74: Module level import not at top of file
75-75: Module level import not at top of file
307-307: Do not use bare
except
1471-1471: Local variable
in_boundsis assigned to but never used
sleap/gui/widgets/video.py
Outdated
| self.state.connect("show labels", self.plot) | ||
| self.state.connect("show edges", self.plot) | ||
| self.state.connect("video", self.load_video) | ||
| self.state.connect("unlinked_video", self.load_video) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
The signal unlinked_video is not properly defined in the codebase. It is referenced in several places, but there is no definition for it as a signal.
sleap/gui/widgets/video.py:self.state.connect("unlinked_video", self.load_video)
Please ensure that unlinked_video is defined as a signal in the appropriate class or module.
Analysis chain
Ensure the unlinked_video signal is properly defined and connected.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify that the signal 'unlinked_video' is properly defined and used elsewhere in the codebase.
# Test: Search for the definition of 'unlinked_video' as a signal.
rg --type py 'unlinked_video ='
# Test: Search for the connection of 'unlinked_video' signal.
rg --type py 'connect\("unlinked_video"'
Length of output: 270
Script:
#!/bin/bash
# Description: Verify that the signal 'unlinked_video' is properly defined and used elsewhere in the codebase.
# Test: Search for any mention of 'unlinked_video' in the codebase.
rg --type py 'unlinked_video'
Length of output: 2267
…com/talmolab/sleap into ramiz/add-doubleclick-functionality-unlinkvideotable
There was a problem hiding this 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 (3)
sleap/gui/widgets/docks.py (3)
Line range hint
15-15: Remove duplicate import ofQLabel.- from qtpy.QtWidgets import QLabel
Line range hint
16-16: Remove duplicate import ofQComboBox.- from qtpy.QtWidgets import QComboBox
Line range hint
18-18: Remove duplicate import ofQGroupBox.- from qtpy.QtWidgets import QGroupBox
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- sleap/gui/widgets/docks.py (1 hunks)
Additional Context Used
Ruff (3)
sleap/gui/widgets/docks.py (3)
15-15: Redefinition of unused
QLabelfrom line 12
16-16: Redefinition of unused
QComboBoxfrom line 8
18-18: Redefinition of unused
QGroupBoxfrom line 10
Additional comments not posted (1)
sleap/gui/widgets/docks.py (1)
676-676: Ensure theis_activatableattribute is properly utilized in theUnlinkVideoTable.This change aligns with the PR's objective to enhance the double-click functionality of the
UnlinkVideoTable. Make sure to verify that theis_activatableattribute is correctly handled in the event listeners and that it integrates well with the existing GUI logic.
…bleclick-functionality-unlinkvideotable
Description
Set
SessionsDock.unlinked_videos_table.is_activatable = Trueso thatstate["unlinked_video"]is updated to the selectedVideoitem in theSessionDock.unlinked_videos_table. Also make the callback forstate[unlinked_video"]just update thestate["video"]essentially making these states have the same callbacks.Types of changes
Does this address any currently open issues?
[list open issues here]
Outside contributors checklist
Thank you for contributing to SLEAP!
❤️