diff --git a/src/gazeMapper/GUI/_impl/gui.py b/src/gazeMapper/GUI/_impl/gui.py index bcfe065..48317c8 100644 --- a/src/gazeMapper/GUI/_impl/gui.py +++ b/src/gazeMapper/GUI/_impl/gui.py @@ -325,21 +325,7 @@ def _session_lister_set_actions_to_show(self, lister: session_lister.SessionList if self.study_config is None: lister.set_actions_to_show(set()) - actions = {process.Action.IMPORT, process.Action.CODE_EPISODES, process.Action.DETECT_MARKERS, process.Action.GAZE_TO_PLANE, process.Action.EXPORT_TRIALS, process.Action.MAKE_VIDEO} - if self.study_config.auto_code_sync_points: - actions.add(process.Action.AUTO_CODE_SYNC) - if self.study_config.auto_code_trial_episodes and self.study_config.sync_ref_recording: - actions.add(process.Action.AUTO_CODE_TRIALS) - if self.study_config.get_cam_movement_for_et_sync_method in ['plane', 'function']: - actions.add(process.Action.SYNC_ET_TO_CAM) - if self.study_config.sync_ref_recording: - actions.add(process.Action.SYNC_TO_REFERENCE) - if glassesTools.annotation.Event.Validate in self.study_config.planes_per_episode: - actions.add(process.Action.RUN_VALIDATION) - - if for_recordings: - actions = {a for a in actions if not process.is_action_session_level(a)} - + actions = self.study_config.get_process_actions(exclude_session_level=for_recordings) lister.set_actions_to_show(actions) def close_project(self): diff --git a/src/gazeMapper/config.py b/src/gazeMapper/config.py index 2fc9406..39f15d8 100644 --- a/src/gazeMapper/config.py +++ b/src/gazeMapper/config.py @@ -10,7 +10,7 @@ from glassesTools import annotation, utils from glassesValidator import process as gv_process -from . import marker, plane, session, type_utils +from . import marker, plane, process, session, type_utils from .typed_dict_defaults import TypedDictDefault @@ -371,6 +371,24 @@ def field_problems(self) -> type_utils.ProblemDict: type_utils.merge_problem_dicts(problems, self._check_make_video(False)) return problems + def get_process_actions(self, exclude_session_level: bool=False) -> set[process.Action]: + actions = {process.Action.IMPORT, process.Action.CODE_EPISODES, process.Action.DETECT_MARKERS, process.Action.GAZE_TO_PLANE, process.Action.EXPORT_TRIALS, process.Action.MAKE_VIDEO} + if self.auto_code_sync_points: + actions.add(process.Action.AUTO_CODE_SYNC) + if self.auto_code_trial_episodes and self.sync_ref_recording: + actions.add(process.Action.AUTO_CODE_TRIALS) + if self.get_cam_movement_for_et_sync_method in ['plane', 'function']: + actions.add(process.Action.SYNC_ET_TO_CAM) + if self.sync_ref_recording: + actions.add(process.Action.SYNC_TO_REFERENCE) + if annotation.Event.Validate in self.planes_per_episode: + actions.add(process.Action.RUN_VALIDATION) + + if exclude_session_level: + actions = {a for a in actions if not process.is_action_session_level(a)} + + return actions + def store_as_json(self, path: str|pathlib.Path|None=None): if not path: path = guess_config_dir(self.working_directory)