Skip to content

Commit

Permalink
move getting of possible actions from gui to config.Study
Browse files Browse the repository at this point in the history
  • Loading branch information
dcnieho committed Sep 4, 2024
1 parent 2633bfb commit 1872367
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
16 changes: 1 addition & 15 deletions src/gazeMapper/GUI/_impl/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
20 changes: 19 additions & 1 deletion src/gazeMapper/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1872367

Please sign in to comment.