Closed vaibhavtrip29 closed 6 months ago
The recent code changes focused on enhancing the GUI functionality and data handling in the Sleap application. These updates include improvements such as session management, data presentation refinements, and adjustments to the camera handling logic, all aimed at enhancing the user experience and overall system robustness.
File | Summary |
---|---|
sleap/gui/app.py , sleap/gui/commands.py |
Added session management features like session selection check, removal methods, and enum value updates. |
sleap/gui/dataviews.py |
Introduced SessionsTableModel class for data representation and formatting changes in SuggestionsTableModel . |
sleap/gui/widgets/docks.py |
Enhanced SessionsDock functionality with model and table creation methods. |
sleap/io/cameras.py |
Updated camera handling logic for add_video method and added new methods. |
sleap/io/dataset.py |
Added session removal method and updated logic for path searching. |
tests/gui/test_dataviews.py , tests/gui/widgets/test_docks.py |
Tests and enhancements related to GUI functionality testing. |
🐇
Code changes dance like leaves in spring,
GUI enhancements make the heart sing.
Cameras iterate, datasets refine,
Testing the limits, line by line.
🌿
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?
Attention: Patch coverage is 78.57143%
with 9 lines
in your changes are missing coverage. Please review.
Project coverage is 73.70%. Comparing base (
cc78c91
) to head (f4c68ac
).:exclamation: Current head f4c68ac differs from pull request most recent head c9b5780. Consider uploading reports for the commit c9b5780 to get more accurate results
Files | Patch % | Lines |
---|---|---|
sleap/gui/dataviews.py | 37.50% | 5 Missing :warning: |
sleap/gui/widgets/docks.py | 92.30% | 2 Missing :warning: |
sleap/gui/commands.py | 75.00% | 1 Missing :warning: |
sleap/io/dataset.py | 50.00% | 1 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
[x] Automatically Loads labels.sessions
on project load
[x] Add Session button is working
[ ] Remove Session button is working
Description
The overall goal here is to add a new table to the
SessionsDock
that displays allRecordingSession
s in theSessionsDock.main_window.label.sessions: List[RecordingSession]
list. The widget should be a table that displays theRecordingSession
s hash (eventually name), number ofRecordingSession.cameras: List[Camcorder]
, and number ofRecordingSession.videos: List[Video]
(see Figure 1). ThisSessionsTable
will be used to dynamically populate ourCamerasTable
later on.GenericTableModel
to create a new model calledSessionsTableModel
with the class attributeproperties = ("id", "videos", "cameras")
(similar toVideosTableModel
)SessionsTableModel.item_to_data(self, obj: List[RecordingSession], item: RecordingSession)
which returns the following dictionary:{id: item.__hash__(), videos: len(item.videos), cameras: len(item.cameras)}
(similar toVideosTableModel.item_to_data
)sessions_model_type = SessionsTableModel
attribute toSessionsDock
(similar toSkeletonDock.nodes_model_type
) and pass into themodel_type
list forsuper().__init__
SessionsDock.create_models
method (or append to it if it already exists) that sets aSessionsDock.sessions_model = SessionsDock.sessions_model_type(items=main_window.state["labels"].sessions, context=main_window.commands)
and returns a list of all models created (seeSkeletonDock.create_models
)SessionsDock.create_tables
method (or append to it if it already exists) that sets aSessionsDock.sessions_table = GenericTableView(state=..., row_name="session", ...)
and returns a list of all tables created (seeSkeletonDock.create_tables
)CommandContext.add_session(self)
RemoveSession
(similar toAddSession
with only ado_action
method) that usesLabels.remove_recording_session(session: RecordingSession)
(does not exist yet, but it will be named this) to remove theRecordingSession
from the labelsCommandContext.remove_session(self, session: RecordingSession)
which takes in aRecordingSession
to remove andCommandContext.execute
s theRemoveSession
class (similar toCommandContext.add_session
but with an additional argument)CommandContext.remove_session
(similar to you add sessions button).RecordingSession
(see comment onCamerasTable
PR)SessionsDock.lay_everything_out
method, add theSessionsDock.sessions_table
to theSessionsDock.wgt_layout: QVBoxLayout
(see theInstancesDock.lay_everything_out
).sessions
option toUpdateTopic: Enum
MainWindow.on_data_update
add (or append to) theif _has_topic(UpdateTopic.sessions)
that updates the items to display in theSessionsTable
(seevideo_dock.table
update)Test the
SessionsTable
Tests for the
SessionsTable
will be added totests/gui/test_dataviews.py
.RecordingSession
is returned when we select a specific row of the table (see existing test for inspiration)RecordingSession
inlabels.sessions
, theRecordingSession
in the table is updated as wellTest the
SessionsTable
as part of theSessionsDock
Tests for the
SessionsDock
will be added totests/gui/widgets/test_docks.py
.GuiState
(see existing test)