Closed roomrys closed 8 months ago
The recent updates focus on enhancing the user interface and functionality of a GUI application, specifically by improving session management and camera-video linkage. New features include the ability to unlink videos from cameras, better handling of camera selections in the GUI, and updates to data views and widgets to support these changes. The modifications span across app initialization, command actions, and GUI components, aiming to provide a more intuitive and flexible user experience.
Files | Change Summary |
---|---|
sleap/gui/app.py |
Added session state, selected_camera handling, button enablement, and updated session handling |
sleap/gui/commands.py |
Introduced method to unlink video from camera; updated do_action for session handling |
sleap/gui/dataviews.py |
Added Camcorder , RecordingSession imports; new CamerasTableModel class |
sleap/gui/widgets/docks.py |
Updated with CamerasTableModel , new methods for model and table creation, video unlink button |
tests/gui/test_dataviews.py tests/gui/widgets/test_docks.py |
Enhanced tests for camera table functionality, SessionsDock , and camera unlinking |
In the land of code, where the bits do hop,
A rabbit worked, with no intent to stop. 🐇💻
"Let cameras unlink, let sessions flow,"
It said with a wink, making the GUI glow.
With every push and pull, it danced with glee,
"For a more intuitive GUI, trust in me!"
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?
[x] Cameras Table is displayed on opening GUI
[ ] Cameras Table should be updated based on the GUIState "sessions"
[x] Cameras Table automatically loads
[x] Unlink video button works
Description
The overall goal is to add
Camcorder
/Video
assignment table to theSessionsDock
that is linked to theSessionsTable
created above. ThisCamerasTable
will have two columns. One column will display theCamcorder.name
s of allCamcorder
s in theRecordingSession.cameras: List[Camcorder]
list. The second column will show whichVideo
s are assigned to the adjacentCamcorder.name
by displaying the returned value ofRecordingSession.get_video(Camcorder)
(or""
ifNone
).GenericTableModel
to create a new model calledCamerasTableModel
withproperties = ("camera", "video")
CamerasTableModel.object_to_items(self, obj: RecordingSession)
which returns the list ofCamcorder
s inobj.cameras: List[Camcorder]
CamerasTableModel.item_to_data(self, obj: RecordingSession, item: Camcorder)
which returns the following dictionary:{camera: item.name, video: obj.get_video(item)}
cameras_model_type = CamerasTableModel
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.cameras_model = SessionsDock.sessions_model_type(items=main_window.state["selected_session"], 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.cameras_table = GenericTableView(state=..., row_name="camera", ...)
and returns a list of all tables created (seeSkeletonDock.create_tables
)CommandContext.unlink_video_from_camera
method to un-link aVideo
from aCamcorder
CommandContext.unlink_video_from_camera
methodCamcorder
for theCamerasTable
SessionsDock.lay_everything_out
method, add theSessionsDock.cameras_table
to theSessionsDock.wgt_layout: QVBoxLayout
(see theInstancesDock.lay_everything_out
).sessions
option toUpdateTopic: Enum
if not already thereMainWindow.on_data_update
add (or append to) theif _has_topic(UpdateTopic.sessions)
that updates the items to display in theCamerasTable
(seevideo_dock.table
update)GuiState
for the"session"
key to the firstRecordingSession
inlabels.sessions: List[RecordingSession]
when loading aLabels
project (similar to how we set the state for"video"
)Test the
CamerasTable
Tests for the
CamerasTable
will be added totests/gui/test_dataviews.py
. These tests will only test the functionality of the table as it's own entity.Camcorder
is returned when we select a specific row of the table (see existing test for inspiration)Camcorder
inlabels.sessions
, theCamcorder
in the table is updated as well (i.e. if we unlink aVideo
from aCamcorder
, the data in theVideo
cell should be empty)Test the
CamerasTable
as part of theSessionsDock
Tests for the
SessionsDock
will be added totests/gui/widgets/test_docks.py
.GuiState
(see existing test)