1
1
import os
2
- import os
3
2
import PySimpleGUI as sg
4
3
import queue
5
4
import requests
6
5
import threading
7
6
from babble_model_loader import *
8
7
from camera_widget import CameraWidget
9
8
from config import BabbleConfig
10
- from eye import CamInfo , Tab
9
+ from tab import CamInfo , Tab
11
10
from osc import VRChatOSCReceiver , VRChatOSC
12
11
from general_settings_widget import SettingsWidget
13
12
from algo_settings_widget import AlgoSettingsWidget
22
21
# https://github.com/opencv/opencv/issues/17687
23
22
os .environ ["OPENCV_VIDEOIO_MSMF_ENABLE_HW_TRANSFORMS" ] = "0"
24
23
25
- WINDOW_NAME = "EyeTrackApp"
26
- RIGHT_EYE_NAME = "-RIGHTEYEWIDGET-"
27
- LEFT_EYE_NAME = "-LEFTEYEWIDGET-"
24
+ WINDOW_NAME = "Babble sApp"
25
+ CAM_NAME = "-CAMWIDGET-"
28
26
SETTINGS_NAME = "-SETTINGSWIDGET-"
29
27
ALGO_SETTINGS_NAME = "-ALGOSETTINGSWIDGET-"
30
-
31
- LEFT_EYE_RADIO_NAME = "-LEFTEYERADIO-"
32
- RIGHT_EYE_RADIO_NAME = "-RIGHTEYERADIO-"
33
- BOTH_EYE_RADIO_NAME = "-BOTHEYERADIO-"
28
+ CAM_RADIO_NAME = "-CAMRADIO-"
34
29
SETTINGS_RADIO_NAME = "-SETTINGSRADIO-"
35
30
ALGO_SETTINGS_RADIO_NAME = "-ALGOSETTINGSRADIO-"
36
31
@@ -90,7 +85,7 @@ def main():
90
85
# start worker threads
91
86
osc_thread .start ()
92
87
93
- eyes = [
88
+ cams = [
94
89
CameraWidget (Tab .CAM , config , osc_queue ),
95
90
]
96
91
@@ -103,63 +98,62 @@ def main():
103
98
[
104
99
sg .Radio (
105
100
"Cam" ,
106
- "EYESELECTRADIO " ,
101
+ "TABSELECTRADIO " ,
107
102
background_color = "#292929" ,
108
- default = (config .eye_display_id == Tab .CAM ),
109
- key = RIGHT_EYE_RADIO_NAME ,
103
+ default = (config .cam_display_id == Tab .CAM ),
104
+ key = CAM_RADIO_NAME ,
110
105
),
111
106
sg .Radio (
112
107
"Settings" ,
113
- "EYESELECTRADIO " ,
108
+ "TABSELECTRADIO " ,
114
109
background_color = "#292929" ,
115
- default = (config .eye_display_id == Tab .SETTINGS ),
110
+ default = (config .cam_display_id == Tab .SETTINGS ),
116
111
key = SETTINGS_RADIO_NAME ,
117
112
),
118
113
sg .Radio (
119
114
"Algo Settings" ,
120
- "EYESELECTRADIO " ,
115
+ "TABSELECTRADIO " ,
121
116
background_color = "#292929" ,
122
- default = (config .eye_display_id == Tab .ALGOSETTINGS ),
117
+ default = (config .cam_display_id == Tab .ALGOSETTINGS ),
123
118
key = ALGO_SETTINGS_RADIO_NAME ,
124
119
),
125
120
],
126
121
[
127
122
sg .Column (
128
- eyes [0 ].widget_layout ,
123
+ cams [0 ].widget_layout ,
129
124
vertical_alignment = "top" ,
130
- key = RIGHT_EYE_NAME ,
131
- visible = (config .eye_display_id in [Tab .CAM ]),
125
+ key = CAM_NAME ,
126
+ visible = (config .cam_display_id in [Tab .CAM ]),
132
127
background_color = "#424042" ,
133
128
),
134
129
sg .Column (
135
130
settings [0 ].widget_layout ,
136
131
vertical_alignment = "top" ,
137
132
key = SETTINGS_NAME ,
138
- visible = (config .eye_display_id in [Tab .SETTINGS ]),
133
+ visible = (config .cam_display_id in [Tab .SETTINGS ]),
139
134
background_color = "#424042" ,
140
135
),
141
136
sg .Column (
142
137
settings [1 ].widget_layout ,
143
138
vertical_alignment = "top" ,
144
139
key = ALGO_SETTINGS_NAME ,
145
- visible = (config .eye_display_id in [Tab .ALGOSETTINGS ]),
140
+ visible = (config .cam_display_id in [Tab .ALGOSETTINGS ]),
146
141
background_color = "#424042" ,
147
142
),
148
143
],
149
144
]
150
145
151
146
152
- if config .eye_display_id in [Tab .CAM ]:
153
- eyes [0 ].start ()
154
- if config .eye_display_id in [Tab .SETTINGS ]:
147
+ if config .cam_display_id in [Tab .CAM ]:
148
+ cams [0 ].start ()
149
+ if config .cam_display_id in [Tab .SETTINGS ]:
155
150
settings [0 ].start ()
156
- if config .eye_display_id in [Tab .ALGOSETTINGS ]:
151
+ if config .cam_display_id in [Tab .ALGOSETTINGS ]:
157
152
settings [1 ].start ()
158
- # self.main_config.eye_display_id
159
153
160
- # the eye's needs to be running before it is passed to the OSC
154
+ # the cam needs to be running before it is passed to the OSC
161
155
if config .settings .gui_ROSC :
162
- osc_receiver = VRChatOSCReceiver (cancellation_event , config , eyes )
156
+ osc_receiver = VRChatOSCReceiver (cancellation_event , config , cams )
163
157
osc_receiver_thread = threading .Thread (target = osc_receiver .run )
164
158
osc_receiver_thread .start ()
165
159
ROSC = True
@@ -176,8 +170,8 @@ def main():
176
170
177
171
# If we're in either mode and someone hits q, quit immediately
178
172
if event == "Exit" or event == sg .WIN_CLOSED :
179
- for eye in eyes :
180
- eye .stop ()
173
+ for cam in cams : #yes we only have one cam page but im just gonna leave this incase
174
+ cam .stop ()
181
175
cancellation_event .set ()
182
176
# shut down worker threads
183
177
osc_thread .join ()
@@ -188,46 +182,46 @@ def main():
188
182
if ROSC :
189
183
osc_receiver .shutdown ()
190
184
osc_receiver_thread .join ()
191
- print ("\033 [94m[INFO] Exiting EyeTrackApp \033 [0m" )
185
+ print ("\033 [94m[INFO] Exiting BabbleApp \033 [0m" )
192
186
return
193
187
194
- if values [RIGHT_EYE_RADIO_NAME ] and config .eye_display_id != Tab .CAM :
195
- eyes [0 ].start ()
188
+ if values [CAM_RADIO_NAME ] and config .cam_display_id != Tab .CAM :
189
+ cams [0 ].start ()
196
190
settings [0 ].stop ()
197
191
settings [1 ].stop ()
198
- window [RIGHT_EYE_NAME ].update (visible = True )
192
+ window [CAM_NAME ].update (visible = True )
199
193
window [SETTINGS_NAME ].update (visible = False )
200
194
window [ALGO_SETTINGS_NAME ].update (visible = False )
201
- config .eye_display_id = Tab .CAM
195
+ config .cam_display_id = Tab .CAM
202
196
config .save ()
203
197
204
198
205
199
206
- elif values [SETTINGS_RADIO_NAME ] and config .eye_display_id != Tab .SETTINGS :
207
- eyes [0 ].stop ()
200
+ elif values [SETTINGS_RADIO_NAME ] and config .cam_display_id != Tab .SETTINGS :
201
+ cams [0 ].stop ()
208
202
settings [1 ].stop ()
209
203
settings [0 ].start ()
210
- window [RIGHT_EYE_NAME ].update (visible = False )
204
+ window [CAM_NAME ].update (visible = False )
211
205
window [SETTINGS_NAME ].update (visible = True )
212
206
window [ALGO_SETTINGS_NAME ].update (visible = False )
213
- config .eye_display_id = Tab .SETTINGS
207
+ config .cam_display_id = Tab .SETTINGS
214
208
config .save ()
215
209
216
210
217
- elif values [ALGO_SETTINGS_RADIO_NAME ] and config .eye_display_id != Tab .ALGOSETTINGS :
218
- eyes [0 ].stop ()
211
+ elif values [ALGO_SETTINGS_RADIO_NAME ] and config .cam_display_id != Tab .ALGOSETTINGS :
212
+ cams [0 ].stop ()
219
213
settings [0 ].stop ()
220
214
settings [1 ].start ()
221
- window [RIGHT_EYE_NAME ].update (visible = False )
215
+ window [CAM_NAME ].update (visible = False )
222
216
window [SETTINGS_NAME ].update (visible = False )
223
217
window [ALGO_SETTINGS_NAME ].update (visible = True )
224
- config .eye_display_id = Tab .ALGOSETTINGS
218
+ config .cam_display_id = Tab .ALGOSETTINGS
225
219
config .save ()
226
220
227
221
# Otherwise, render all
228
- for eye in eyes :
229
- if eye .started ():
230
- eye .render (window , event , values )
222
+ for cam in cams :
223
+ if cam .started ():
224
+ cam .render (window , event , values )
231
225
for setting in settings :
232
226
if setting .started ():
233
227
setting .render (window , event , values )
0 commit comments