-
-
Save papr/01c31956c3dc060eb5b38d04d6170dd9 to your computer and use it in GitHub Desktop.
Custom 2D detector that exposes its internal settings as UI elements. For installation instructions, see https://docs.pupil-labs.com/developer/core/plugin-api/#adding-a-plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyglui import ui | |
from pupil_detector_plugins.detector_2d_plugin import Detector2DPlugin | |
class AllControls2DPlugin(Detector2DPlugin): | |
label = "2D Detector - All Controls" | |
order = 0.1005 | |
def __init__(self, *args, **kwargs): | |
super().__init__(*args, **kwargs) | |
self._stop_other_pupil_detectors() | |
def _stop_other_pupil_detectors(self): | |
plugin_list = self.g_pool.plugins | |
# Deactivate other PupilDetectorPlugin instances | |
for plugin in plugin_list: | |
if isinstance(plugin, Detector2DPlugin) and plugin is not self: | |
plugin.alive = False | |
# Force Plugin_List to remove deactivated plugins | |
plugin_list.clean() | |
@classmethod | |
def parse_pretty_class_name(cls) -> str: | |
return cls.label | |
def init_ui(self): | |
super().init_ui() | |
self.menu.append(ui.Separator()) | |
self.menu.append(ui.Info_Text("Custom 2d detector settings")) | |
for name in self.pupil_detector.get_properties(): | |
self.menu.append(ui.Text_Input(name, self.pupil_detector_properties)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment