mirror of
https://github.com/EyeTrackVR/EyeTrackVR.git
synced 2025-11-04 14:39:42 +08:00
Initial UI Implementation
Adds UI module, no actual logic implemented yet.
This commit is contained in:
parent
59f2aa14ec
commit
5221fd3109
1
.gitignore
vendored
1
.gitignore
vendored
@ -23,3 +23,4 @@ EyeTrackApp/IBO_RIGHT.png
|
||||
/IBO_LEFT.png
|
||||
/eyetrack_settings.backup
|
||||
/eyetrack_settings.json
|
||||
zBuild.bat
|
||||
|
||||
@ -217,6 +217,11 @@ class EyeTrackSettingsConfig(BaseModel):
|
||||
gui_OutputMultiplier: float = 1
|
||||
gui_use_module: bool = False
|
||||
|
||||
#SmartInversionTracking
|
||||
gui_smartinversion_enabled: bool = False
|
||||
gui_smartinversion_select_right: bool = True
|
||||
gui_smartinversion_thresh: float = 0.5
|
||||
|
||||
|
||||
class EyeTrackConfig(BaseModel):
|
||||
version: int = 1
|
||||
|
||||
@ -31,6 +31,7 @@ from settings.BaseSettings import BaseSettingsWidget
|
||||
from settings.modules.GeneralSettingsModule import GeneralSettingsModule
|
||||
from settings.modules.OneEuroSettingsModule import OneEuroSettingsModule
|
||||
from settings.modules.OSCSettingsModule import OSCSettingsModule
|
||||
from settings.modules.SmartInversionTrackingSettingsModule import SmartInversionSettingsModule
|
||||
|
||||
|
||||
class SettingsWidget(BaseSettingsWidget):
|
||||
@ -38,6 +39,7 @@ class SettingsWidget(BaseSettingsWidget):
|
||||
settings_modules = [
|
||||
GeneralSettingsModule,
|
||||
OneEuroSettingsModule,
|
||||
SmartInversionSettingsModule,
|
||||
OSCSettingsModule,
|
||||
]
|
||||
super().__init__(widget_id, main_config, settings_modules)
|
||||
|
||||
@ -0,0 +1,63 @@
|
||||
from pydantic import AfterValidator
|
||||
from typing_extensions import Annotated
|
||||
|
||||
from settings.modules.BaseModule import BaseSettingsModule, BaseValidationModel
|
||||
from settings.constants import BACKGROUND_COLOR
|
||||
import PySimpleGUI as sg
|
||||
|
||||
from settings.modules.CommonFieldValidators import try_convert_to_float
|
||||
|
||||
|
||||
class SmartInversionValidationModule(BaseValidationModel):
|
||||
gui_smartinversion_enabled: bool
|
||||
gui_smartinversion_select_right: bool
|
||||
gui_smartinversion_thresh: Annotated[str, AfterValidator(try_convert_to_float)]
|
||||
|
||||
|
||||
class SmartInversionSettingsModule(BaseSettingsModule):
|
||||
def __init__(self, config, widget_id, **kwargs):
|
||||
super().__init__(config=config, widget_id=widget_id, **kwargs)
|
||||
self.gui_smartinversion_enabled = f"-gui_smartinversion_enabled{widget_id}-"
|
||||
self.gui_smartinversion_select_right = f"-gui_smartinversion_select_right{widget_id}-"
|
||||
self.gui_smartinversion_thresh = f"-gui_smartinversion_thresh{widget_id}-"
|
||||
|
||||
def get_layout(self):
|
||||
return [
|
||||
[
|
||||
sg.Text("Smart Inversion Tracking System:", background_color='#242224'),
|
||||
],
|
||||
[
|
||||
sg.Checkbox(
|
||||
"Enable:",
|
||||
default=self.config.gui_smartinversion_enabled,
|
||||
key=self.gui_smartinversion_enabled,
|
||||
background_color="#424042",
|
||||
tooltip="Enables Smart Inversion Tracking System",
|
||||
),
|
||||
|
||||
sg.Text("Max. X-Axis Difference", background_color=BACKGROUND_COLOR),
|
||||
sg.InputText(
|
||||
self.config.gui_smartinversion_thresh,
|
||||
key=self.gui_smartinversion_thresh,
|
||||
size=(0, 10),
|
||||
tooltip="Sets the maximum allowed difference in eye position (x-axis) to determine if the eyes are inverted or not."
|
||||
),
|
||||
],
|
||||
[
|
||||
sg.Radio(
|
||||
"Use Left Eye",
|
||||
"smartinversion_selectedeye",
|
||||
background_color="#424042",
|
||||
tooltip="Uses the left eye as the tracked eye.",
|
||||
),
|
||||
|
||||
sg.Radio(
|
||||
"Use Right Eye",
|
||||
"smartinversion_selectedeye",
|
||||
default=self.config.gui_smartinversion_select_right,
|
||||
key=self.gui_smartinversion_select_right,
|
||||
background_color="#424042",
|
||||
tooltip="Uses the right eye as the tracked eye.",
|
||||
)
|
||||
]
|
||||
]
|
||||
@ -74,6 +74,11 @@ def eyetrack_settings_config():
|
||||
gui_osc_vrcft_v2=False,
|
||||
gui_vrc_native=False,
|
||||
gui_pupil_dilation=True,
|
||||
|
||||
#Smart Inversion Tracking
|
||||
gui_smartinversion_enabled=False,
|
||||
gui_smartinversion_select_right=True,
|
||||
gui_smartinversion_thresh=0.5,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user