Beispiel #1
0
 def add(self, calibration, overwrite=False):
     for calib in self._calibrations.copy():
         if calib.unique_id != calibration.unique_id:
             continue
         if overwrite:
             self._calibrations.remove(calib)
             break
         logger.warning(
             f"Did not add calibration {calibration.name} ({calibration.unique_id})"
             " because it is already in the storage. Currently in storage:\n"
             + "\n".join(f"- {c.name} ({c.unique_id})"
                         for c in self._calibrations))
         return
     is_calib_editable = (self._from_same_recording(calibration)
                          and calibration.is_offline_calibration)
     if is_calib_editable:
         available_gazer_classes = user_selectable_gazer_classes()
     else:
         available_gazer_classes = registered_gazer_classes()
     gazer_class_names = gazer_classes_by_class_name(
         available_gazer_classes).keys()
     if calibration.gazer_class_name not in gazer_class_names:
         logger.warning(
             f"Did not add calibration {calibration.name} ({calibration.unique_id}) because gaze mapping method ({calibration.gazer_class_name}) is not available."
         )
         return
     self._calibrations.append(calibration)
     self._calibrations.sort(key=lambda c: c.name)
Beispiel #2
0
    def _create_mapping_method_selector(self, calibration):
        gazers = user_selectable_gazer_classes()
        gazers_map = gazer_labels_by_class_names(gazers)

        return ui.Selector(
            "gazer_class_name",
            calibration,
            label="Gaze Mapping",
            labels=list(gazers_map.values()),
            selection=list(gazers_map.keys()),
        )