From bedb8797b5179e1757edc3d225c20cd724112989 Mon Sep 17 00:00:00 2001 From: Valerie Tsai <87097162+vtsai881@users.noreply.github.com> Date: Sun, 3 Dec 2023 15:55:59 -0500 Subject: [PATCH] Update commands.py added all_frames variable to exportAnalysisFile() and exportCSVFile() command definitions (ln 329, 331). added all_frames conditional to ExportAnalysisFile(command) definition --- sleap/gui/commands.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/sleap/gui/commands.py b/sleap/gui/commands.py index 90f40397e..4e8f0670d 100644 --- a/sleap/gui/commands.py +++ b/sleap/gui/commands.py @@ -326,13 +326,13 @@ def saveProjectAs(self): """Show gui to save project as a new file.""" self.execute(SaveProjectAs) - def exportAnalysisFile(self, all_videos: bool = False): + def exportAnalysisFile(self, all_videos: bool = False, all_frames: bool = False): """Shows gui for exporting analysis h5 file.""" - self.execute(ExportAnalysisFile, all_videos=all_videos, csv=False) + self.execute(ExportAnalysisFile, all_videos=all_videos, all_frames=all_frames, csv=False) - def exportCSVFile(self, all_videos: bool = False): + def exportCSVFile(self, all_videos: bool = False, all_frames: bool = False): """Shows gui for exporting analysis csv file.""" - self.execute(ExportAnalysisFile, all_videos=all_videos, csv=True) + self.execute(ExportAnalysisFile, all_videos=all_videos, all_frames=all_frames, csv=True) def exportNWB(self): """Show gui for exporting nwb file.""" @@ -1142,13 +1142,24 @@ def do_action(cls, context: CommandContext, params: dict): adaptor = NixAdaptor else: adaptor = SleapAnalysisAdaptor + + if params['all_frames']: adaptor.write( filename=output_path, + all_frames=True, source_object=context.labels, source_path=context.state["filename"], video=video, - ) - + ) + else: + adaptor.write( + filename=output_path, + all_frames=False, + source_object=context.labels, + source_path=context.state["filename"], + video=video, + ) + @staticmethod def ask(context: CommandContext, params: dict) -> bool: def ask_for_filename(default_name: str, csv: bool) -> str: