def init_ui(self): self.add_menu() self.menu.label = 'Recorder' self.menu_icon.order = 0.29 self.menu.append( ui.Info_Text( 'Pupil recordings are saved like this: "path_to_recordings/recording_session_name/nnn" where "nnn" is an increasing number to avoid overwrites. You can use "/" in your session name to create subdirectories.' )) self.menu.append( ui.Info_Text( 'Recordings are saved to "~/pupil_recordings". You can change the path here but note that invalid input will be ignored.' )) self.menu.append( ui.Text_Input('rec_root_dir', self, setter=self.set_rec_root_dir, label='Path to recordings')) self.menu.append( ui.Text_Input('session_name', self, setter=self.set_session_name, label='Recording session name')) self.menu.append( ui.Switch('show_info_menu', self, on_val=True, off_val=False, label='Request additional user info')) self.menu.append( ui.Selector( 'raw_jpeg', self, selection=[True, False], labels=["bigger file, less CPU", "smaller file, more CPU"], label='Compression')) self.menu.append( ui.Info_Text( 'Recording the raw eye video is optional. We use it for debugging.' )) self.menu.append( ui.Switch('record_eye', self, on_val=True, off_val=False, label='Record eye')) self.button = ui.Thumb('running', self, setter=self.toggle, label='R', hotkey='r') self.button.on_color[:] = (1, .0, .0, .8) self.g_pool.quickbar.insert(2, self.button) self.low_disk_space_thumb = ui.Thumb('low_disk_warn', label='!', getter=lambda: True, setter=lambda x: None) self.low_disk_space_thumb.on_color[:] = (1, .0, .0, .8) self.low_disk_space_thumb.status_text = 'Low disk space'
def init_gui(self): self.menu = ui.Growing_Menu('Surface Tracker') self.g_pool.sidebar.append(self.menu) self.button = ui.Thumb('running',self,label='Track',hotkey='t') self.button.on_color[:] = (.1,.2,1.,.8) self.g_pool.quickbar.append(self.button) self.add_button = ui.Thumb('add_surface',setter=self.add_surface,getter=lambda:False,label='Add surface',hotkey='a') self.g_pool.quickbar.append(self.add_button) self.update_gui_markers()
def init_ui(self): self.add_menu() self.button = None self.calib_button = ui.Thumb('active', self, label='C', setter=self.toggle_calibration, hotkey='c') self.test_button = ui.Thumb('active', self, label='T', setter=self.toggle_accuracy_test, hotkey='t') on_color = (.3, .2, 1., .9) self.calib_button.on_color[:] = on_color self.test_button.on_color[:] = on_color self.g_pool.quickbar.insert(0, self.calib_button) self.g_pool.quickbar.insert(1, self.test_button)
def init_gui(self): if self.g_pool.app == "player": self.alive = False logger.error('For capture only.') return self.menu = ui.Growing_Menu('Screen Tracker') self.g_pool.sidebar.append(self.menu) self.button = ui.Thumb('running',self,label='T',hotkey='t') self.button.on_color[:] = (.1,.2,1.,.8) self.g_pool.quickbar.append(self.button) self.add_button = ui.Thumb('add_surface',setter=self.add_surface,getter=lambda:False,label='A',hotkey='a') self.g_pool.quickbar.append(self.add_button) self.update_gui_markers()
def init_ui(self): self.add_menu() self.menu.label = 'Surface Tracker' self.button = ui.Thumb('running', self, label='S', hotkey='s') self.button.on_color[:] = (.1, .2, 1., .8) self.g_pool.quickbar.append(self.button) self.add_button = ui.Thumb('add_surface', setter=self.add_surface, getter=lambda: False, label='A', hotkey='a') self.g_pool.quickbar.append(self.add_button) self.update_gui_markers()
def init_ui(self): self.add_menu() self.menu.label = "HMD Calibration" self.menu.append(ui.Info_Text("Calibrate gaze parameters to map onto an HMD.")) self.calib_button = ui.Thumb( "active", self, label="C", setter=self.toggle_calibration, hotkey="c" )
def update_buttons(self): for b in self.buttons: self.g_pool.quickbar.remove(b) self.sub_menu.elements[:] = [] self.buttons = [] for e_name, hotkey in self.annotation_definitions: def make_fire(e_name, hotkey): return lambda _: self.fire_annotation(e_name) def make_remove(e_name, hotkey): return lambda: self.remove_annotation((e_name, hotkey)) thumb = ui.Thumb( e_name, setter=make_fire(e_name, hotkey), getter=lambda: False, label=hotkey, hotkey=hotkey, ) self.buttons.append(thumb) self.g_pool.quickbar.append(thumb) self.sub_menu.append( ui.Button(e_name + " <" + hotkey + ">", make_remove(e_name, hotkey)))
def init_ui(self): super().init_ui() self.menu.label = "Fingertip Calibration" self.menu.append( ui.Info_Text("Calibrate gaze parameters using your fingertip!") ) self.menu.append( ui.Info_Text( "Hold your index finger still at the center of the field of view of the world camera. " "Move your head horizontally and then vertically while gazing at your fingertip." "Then show five fingers to finish the calibration." ) ) if self.device == torch.device("cpu"): self.menu.append( ui.Info_Text( "* No GPU utilized for fingertip detection network. " "Note that the frame rate will drop during fingertip detection." ) ) else: self.menu.append( ui.Info_Text("* GPUs utilized for fingertip detection network") ) self.vis_toggle = ui.Thumb("visualize", self, label="V", hotkey="v") self.g_pool.quickbar.append(self.vis_toggle)
def init_ui(self): self.add_menu() self.button = None self.calib_button = ui.Thumb( "active", self, label="C", setter=self.toggle_calibration, hotkey="c" ) self.test_button = ui.Thumb( "active", self, label="T", setter=self.toggle_accuracy_test, hotkey="t" ) on_color = (0.3, 0.2, 1.0, 0.9) self.calib_button.on_color[:] = on_color self.test_button.on_color[:] = on_color self.g_pool.quickbar.insert(0, self.calib_button) self.g_pool.quickbar.insert(1, self.test_button)
def init_ui(self): super().init_ui() self.menu.label = 'Fingertip Calibration' self.menu.append( ui.Info_Text('Calibrate gaze parameters using your fingertip!')) self.menu.append( ui.Info_Text( 'Hold your index finger still at the center of the field of view of the world camera. ' 'Move your head horizontally and then vertically while gazing at your fingertip.' 'Then show five fingers to finish the calibration.')) if self.device == torch.device("cpu"): self.menu.append( ui.Info_Text( '* No GPU utilized for fingertip detection network. ' 'Note that the frame rate will drop during fingertip detection.' )) else: self.menu.append( ui.Info_Text( '* GPUs utilized for fingertip detection network')) self.vis_toggle = ui.Thumb('visualize', self, setter=self.toggle_vis, label='V', hotkey='v') self.g_pool.quickbar.append(self.vis_toggle)
def init_ui(self): self.add_menu() self.menu.label = "Surface Tracker" self.button = ui.Thumb("running", self, label="S", hotkey="s") self.button.on_color[:] = (0.1, 0.2, 1.0, 0.8) self.g_pool.quickbar.append(self.button) self.add_button = ui.Thumb( "add_surface", setter=self.add_surface, getter=lambda: False, label="A", hotkey="a", ) self.g_pool.quickbar.append(self.add_button) self.update_gui_markers()
def init_gui(self): self.monitor_idx = 0 self.monitor_names = [glfwGetMonitorName(m) for m in glfwGetMonitors()] #primary_monitor = glfwGetPrimaryMonitor() self.info = ui.Info_Text("Calibrate gaze parameters using a screen based animation.") self.g_pool.calibration_menu.append(self.info) self.menu = ui.Growing_Menu('Controls') self.menu.configuration = self.menu_conf self.g_pool.calibration_menu.append(self.menu) self.menu.append(ui.Selector('monitor_idx',self,selection = range(len(self.monitor_names)),labels=self.monitor_names,label='Monitor')) self.menu.append(ui.Switch('fullscreen',self,label='Use fullscreen')) self.menu.append(ui.Slider('marker_scale',self,step=0.1,min=0.5,max=2.0,label='Pattern scale')) submenu = ui.Growing_Menu('Advanced') submenu.collapsed = True self.menu.append(submenu) submenu.append(ui.Slider('sample_duration',self,step=1,min=10,max=100,label='Sample duration')) submenu.append(ui.Switch('show_edges',self,label='show edges')) submenu.append(ui.Slider('area_threshold',self,step=1,min=5,max=50,label='Area threshold')) submenu.append(ui.Slider('dist_threshold',self,step=.5,min=1,max=20,label='Eccetricity threshold')) self.button = ui.Thumb('active',self,setter=self.toggle,label='Calibrate',hotkey='c') self.button.on_color[:] = (.3,.2,1.,.9) self.g_pool.quickbar.insert(0,self.button)
def init_gui(self): self.monitor_idx = 0 self.monitor_names = [glfwGetMonitorName(m) for m in glfwGetMonitors()] #primary_monitor = glfwGetPrimaryMonitor() self.info = ui.Info_Text( "Calibrate gaze parameters using a single gae targets and active head movements." ) self.g_pool.calibration_menu.append(self.info) self.menu = ui.Growing_Menu('Controls') self.g_pool.calibration_menu.append(self.menu) self.menu.append( ui.Selector('monitor_idx', self, selection=range(len(self.monitor_names)), labels=self.monitor_names, label='Monitor')) self.menu.append(ui.Switch('fullscreen', self, label='Use fullscreen')) self.menu.append( ui.Slider('marker_scale', self, step=0.1, min=0.5, max=2.0, label='Marker size')) self.button = ui.Thumb('active', self, label='C', setter=self.toggle, hotkey='c') self.button.on_color[:] = (.3, .2, 1., .9) self.g_pool.quickbar.insert(0, self.button)
def init_gui(self): def close(): self.alive = False self.menu = ui.Growing_Menu('Remote Recorder') self.g_pool.sidebar.append(self.menu) self.menu.append(ui.Button('Close', close)) self.menu.append( ui.Info_Text( 'Starts a recording session on each connected Pupil Mobile source.' )) self.menu.append(ui.Text_Input('session_name', self)) self.menu_toggle = ui.Button('Start Recording', self.toggle_recording) # ↴: Unicode: U+21B4, UTF-8: E2 86 B4 self.quickbar_toggle = ui.Thumb('running', self, setter=self.toggle_recording, label=chr(0xf03d), label_font='fontawesome', label_offset_size=-30, hotkey='e') self.quickbar_toggle.on_color[:] = (1, .0, .0, .8) self.menu.append(self.menu_toggle) self.g_pool.quickbar.append(self.quickbar_toggle)
def init_gui(self): self.info = ui.Info_Text( "Calibrate gaze parameters using a handheld marker.") self.g_pool.calibration_menu.append(self.info) self.menu = ui.Growing_Menu('Controls') self.menu.configuration = self.menu_conf self.g_pool.calibration_menu.append(self.menu) submenu = ui.Growing_Menu('Advanced') submenu.collapsed = True self.menu.append(submenu) submenu.append( ui.Slider('aperture', self, min=3, step=2, max=11, label='filter aperture')) submenu.append(ui.Switch('show_edges', self, label='show edges')) self.button = ui.Thumb('active', self, setter=self.toggle, label='Calibrate', hotkey='c') self.button.on_color[:] = (.3, .2, 1., .9) self.g_pool.quickbar.insert(0, self.button)
def init_ui(self): self.add_menu() self.menu.label = "Offline Surface Tracker" self.add_button = ui.Thumb( "add_surface", setter=lambda x: self.add_surface(), getter=lambda: False, label="A", hotkey="a", ) self.g_pool.quickbar.append(self.add_button) self.glfont = fontstash.Context() self.glfont.add_font("opensans", ui.get_opensans_font_path()) self.glfont.set_color_float((1.0, 1.0, 1.0, 0.8)) self.glfont.set_align_string(v_align="right", h_align="top") self.timeline = ui.Timeline( "Surface Tracker", self.gl_display_cache_bars, self.draw_labels, self.timeline_line_height * (len(self.surfaces) + 1), ) self.g_pool.user_timelines.append(self.timeline) self.update_gui_markers()
def init_gui(self): monitor_names = [glfwGetMonitorName(m) for m in glfwGetMonitors()] #primary_monitor = glfwGetPrimaryMonitor() self.info = ui.Info_Text( "Estimate Camera intrinsics of the world camera. Using an 11x9 asymmetrical circle grid. Click 'C' to capture a pattern." ) self.g_pool.calibration_menu.append(self.info) self.menu = ui.Growing_Menu('Controls') self.menu.append(ui.Button('show Pattern', self.open_window)) self.menu.append( ui.Selector('monitor_idx', self, selection=range(len(monitor_names)), labels=monitor_names, label='Monitor')) self.menu.append(ui.Switch('fullscreen', self, label='Use Fullscreen')) self.g_pool.calibration_menu.append(self.menu) self.button = ui.Thumb('collect_new', self, setter=self.advance, label='Capture', hotkey='c') self.button.on_color[:] = (.3, .2, 1., .9) self.g_pool.quickbar.insert(0, self.button)
def init_gui(self): self.menu = ui.Scrolling_Menu('Offline Surface Tracker') self.g_pool.gui.append(self.menu) self.add_button = ui.Thumb('add_surface',setter=lambda x: self.add_surface(),getter=lambda:False,label='A',hotkey='a') self.g_pool.quickbar.append(self.add_button) self.update_gui_markers() self.on_window_resize(glfwGetCurrentContext(),*glfwGetWindowSize(glfwGetCurrentContext()))
def init_gui(self): self.button = ui.Thumb('running', self, setter=self.toggle, label='B', hotkey='b') self.button.on_color[:] = (1, .0, .0, .8) self.g_pool.quickbar.insert(2, self.button)
def init_gui(self): self.menu = ui.Growing_Menu('Recorder') self.menu.collapsed = True self.g_pool.sidebar.insert(3, self.menu) self.menu.append( ui.Info_Text( 'Pupil recordings are saved like this: "path_to_recordings/recording_session_name/nnn" where "nnn" is an increasing number to avoid overwrites. You can use "/" in your session name to create subdirectories.' )) self.menu.append( ui.Info_Text( 'Recordings are saved to "~/pupil_recordings". You can change the path here but note that invalid input will be ignored.' )) self.menu.append( ui.Text_Input('rec_dir', self, setter=self.set_rec_dir, label='Path to recordings')) self.menu.append( ui.Text_Input('session_name', self, setter=self.set_session_name, label='Recording session name')) self.menu.append( ui.Switch('show_info_menu', self, on_val=True, off_val=False, label='Request additional user info')) self.menu.append( ui.Selector( 'raw_jpeg', self, selection=[True, False], labels=["bigger file, less CPU", "smaller file, more CPU"], label='Compression')) self.menu.append( ui.Info_Text( 'Recording the raw eye video is optional. We use it for debugging.' )) self.menu.append( ui.Switch('record_eye', self, on_val=True, off_val=False, label='Record eye')) self.menu.append( ui.Selector('audio_src', self, selection=list(self.audio_devices_dict.keys()), label='Audio Source')) self.button = ui.Thumb('running', self, setter=self.toggle, label='R', hotkey='r') self.button.on_color[:] = (1, .0, .0, .8) self.g_pool.quickbar.insert(1, self.button)
def init_gui(self): self.monitor_idx = 0 self.monitor_names = [glfwGetMonitorName(m) for m in glfwGetMonitors()] #primary_monitor = glfwGetPrimaryMonitor() self.info = ui.Info_Text("Measure gaze mapping accuracy and percision using a screen based animation: After having calibrated on the screen run this test. To compute results set your world cam FOV and click 'calculate results'.") self.g_pool.calibration_menu.append(self.info) self.menu = ui.Growing_Menu('Controls') self.menu.configuration = self.menu_conf self.g_pool.calibration_menu.append(self.menu) self.menu.append(ui.Selector('monitor_idx',self,selection = range(len(self.monitor_names)),labels=self.monitor_names,label='Monitor')) self.menu.append(ui.Switch('fullscreen',self,label='Use Fullscreen')) submenu = ui.Growing_Menu('Error Calculation') def set_fov(val): try: self.fov = float(val) except: pass submenu.append(ui.Text_Input('diagonal camera FV',setter=set_fov,getter=lambda:str(self.fov) ) ) submenu.append(ui.Text_Input('diagonal resolution',getter=lambda:str(self.res) ) ) submenu[-1].read_only = True submenu.append(ui.Slider('outlier_thresh',self,label='outlier threshold deg',min=0,max=10)) submenu.append(ui.Button('calculate result',self.calc_result)) accuray_help ='''Accuracy is calculated as the average angular offset (distance) (in degrees of visual angle) between fixations locations and the corresponding locations of the fixation targets.'''.replace("\n"," ").replace(" ",'') percision_help = '''Precision is calculated as the Root Mean Square (RMS) of the angular distance (in degrees of visual angle) between successive samples during a fixation.'''.replace("\n"," ").replace(" ",'') submenu.append(ui.Info_Text(accuray_help)) submenu.append(ui.Text_Input('angular accuray',getter=lambda:str(self.accuray) ) ) submenu[-1].read_only = True submenu.append(ui.Info_Text(percision_help)) submenu.append(ui.Text_Input('diagonal resolution',getter=lambda:str(self.percision) ) ) submenu[-1].read_only = True self.menu.append(submenu) submenu = ui.Growing_Menu('Advanced Detector Settings') submenu.collapsed = True submenu.append(ui.Switch('show_edges',self,label='show edges')) submenu.append(ui.Slider('area_threshold',self,step=1,min=5,max=50,label='Area Threshold')) submenu.append(ui.Slider('dist_threshold',self,step=.5,min=1,max=20,label='Eccetricity Threshold')) self.menu.append(submenu) self.button = ui.Thumb('active',self,setter=self.toggle,label='Calibrate',hotkey='c') self.button.on_color[:] = (.3,.2,1.,.9) self.g_pool.quickbar.insert(0,self.button)
def init_ui(self): self.add_menu() self.menu.label = 'Offline Surface Tracker' self.add_button = ui.Thumb('add_surface', setter=lambda x: self.add_surface(), getter=lambda: False, label='A', hotkey='a') self.g_pool.quickbar.append(self.add_button) self.update_gui_markers()
def init_gui(self): def dummy(_): logger.error("HMD calibration must be initiated from the HMD client.") self.info = ui.Info_Text("Calibrate gaze parameters to map onto an HMD.") self.g_pool.calibration_menu.append(self.info) self.button = ui.Thumb('active',self,setter=dummy,label='C',hotkey='c') self.button.on_color[:] = (.3,.2,1.,.9) self.g_pool.quickbar.insert(0,self.button)
def init_ui(self): self.add_menu() self.menu.label = "Camera Intrinsics Estimation" def get_monitors_idx_list(): monitors = [glfw.get_monitor_name(m) for m in glfw.get_monitors()] return range(len(monitors)), monitors if self.monitor_idx not in get_monitors_idx_list()[0]: logger.warning( "Monitor at index %s no longer availalbe using default" % idx ) self.monitor_idx = 0 self.menu.append( ui.Info_Text( "Estimate Camera intrinsics of the world camera. Using an 11x9 asymmetrical circle grid. Click 'i' to capture a pattern." ) ) self.menu.append(ui.Button("show Pattern", self.open_window)) self.menu.append( # TODO: potential race condition through selection_getter. Should ensure # that current selection will always be present in the list returned by the # selection_getter. Highly unlikely though as this needs to happen between # having clicked the Selector and the next redraw. # See https://github.com/pupil-labs/pyglui/pull/112/commits/587818e9556f14bfedd8ff8d093107358745c29b ui.Selector( "monitor_idx", self, selection_getter=get_monitors_idx_list, label="Monitor", ) ) dist_modes = ["Fisheye", "Radial"] self.menu.append( ui.Selector( "dist_mode", self, selection=dist_modes, label="Distortion Model" ) ) self.menu.append(ui.Switch("fullscreen", self, label="Use Fullscreen")) self.show_undistortion_switch = ui.Switch( "show_undistortion", self, label="show undistorted image" ) self.menu.append(self.show_undistortion_switch) self.show_undistortion_switch.read_only = not ( hasattr(self.g_pool.capture, "intrinsics") and self.g_pool.capture.intrinsics ) self.button = ui.Thumb( "collect_new", self, setter=self.advance, label="I", hotkey="i" ) self.button.on_color[:] = (0.3, 0.2, 1.0, 0.9) self.g_pool.quickbar.insert(0, self.button)
def _create_button_quickbar(self, annotation_definition): def make_fire(_): self.fire_annotation(annotation_definition.label) return ui.Thumb( annotation_definition.label, setter=make_fire, getter=lambda: False, label=annotation_definition.hotkey, hotkey=annotation_definition.hotkey, )
def init_gui(self): ''' Inherited from base Plugin class Initialize GUI elements, and add to 'world' window Sidebar on the right: g_pool.sidebar General Window: g_pool.gui Quick bar at left: g_pool.quickbar :return: Nothing ''' # Growing Menu self.menu = ui.Growing_Menu('Example Plugin') self.g_pool.sidebar.append(self.menu) self.menu.append(ui.Info_Text('Example GUI elements in pyglui')) self.menu.append( ui.Button('Example Button', lambda: self.button_callback())) self.menu.append( ui.Button('Print Global Container', lambda: self.print_g_pool_callback())) self.menu.append( ui.Switch('switch_value', self, label='Example Switch')) self.menu.append( ui.Slider('slider_value', self, step=0.1, min=0.5, max=2.0, label='Example Slider')) self.menu.append( ui.Selector('selector_idx', self, selection=range(len(self.selector_items)), labels=self.selector_items, label='Example Selector')) self.menu.append( ui.Button('Remove Plugin', lambda: self.remove_plugin())) # Sub-Growing Menu self.growing_menu = ui.Growing_Menu('Example Growing Menu') self.growing_menu.append( ui.Info_Text('Info Text in Example Growing Menu')) self.menu.append(self.growing_menu) # Scrolling Menu self.scrolling_menu = ui.Scrolling_Menu('Example Scrolling Menu') self.scrolling_menu.append( ui.Info_Text('Info Text in Example Scrolling Menu')) self.g_pool.gui.append(self.scrolling_menu) # Add thumb to quickbar self.quickbar_thumb = ui.Thumb('thumb_active', self, label='E', setter=self.thumb_callback, hotkey='e') self.quickbar_thumb.on_color[:] = (.3, .2, 1., .9) self.g_pool.quickbar.insert(0, self.quickbar_thumb)
def init_gui(self): self.info = ui.Info_Text("Calibrate gaze parameters using a handheld marker.") self.g_pool.calibration_menu.append(self.info) self.menu = ui.Growing_Menu('Controls') self.g_pool.calibration_menu.append(self.menu) self.button = ui.Thumb('active',self,label='C',setter=self.toggle,hotkey='c') self.button.on_color[:] = (.3,.2,1.,.9) self.g_pool.quickbar.insert(0,self.button)
def init_gui(self): self.info = ui.Info_Text( "Calibrate gaze parameters using features in your environment. Ask the subject to look at objects in the scene and click on them in the world window." ) self.g_pool.calibration_menu.append(self.info) self.button = ui.Thumb('active', self, label='C', setter=self.toggle, hotkey='c') self.button.on_color[:] = (.3, .2, 1., .9) self.g_pool.quickbar.insert(0, self.button)
def init_ui(self): self.add_menu() self.menu.label = self.pretty_class_name self.add_button = ui.Thumb( "add_surface", setter=self.on_add_surface_click, getter=lambda: False, label="A", hotkey=Hotkey.SURFACE_TRACKER_ADD_SURFACE_CAPTURE_AND_PLAYER_HOTKEY(), ) self.g_pool.quickbar.append(self.add_button) self._update_ui()
def init_ui(self): self.add_menu() self.menu.label = self.pretty_class_name self.add_button = ui.Thumb( "add_surface", setter=self.on_add_surface_click, getter=lambda: False, label="A", hotkey="a", ) self.g_pool.quickbar.append(self.add_button) self._update_ui()