mirror of
https://github.com/EyeTrackVR/EyeTrackVR.git
synced 2025-11-04 14:39:42 +08:00
Added code to determine if the OS is Win or Linux.
Changed so that if Linux, PlaySound does nothing when executed.
This commit is contained in:
parent
5428ef6d53
commit
adf3d86401
@ -9,8 +9,7 @@ from camera import Camera, CameraState
|
|||||||
from osc import EyeId
|
from osc import EyeId
|
||||||
import cv2
|
import cv2
|
||||||
import sys
|
import sys
|
||||||
if sys.platform.startswith("win"):
|
from utils.misc_utils import PlaySound,SND_FILENAME,SND_ASYNC
|
||||||
from winsound import PlaySound, SND_FILENAME, SND_ASYNC
|
|
||||||
import traceback
|
import traceback
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
@ -243,8 +242,7 @@ class CameraWidget:
|
|||||||
|
|
||||||
if event == self.gui_restart_calibration:
|
if event == self.gui_restart_calibration:
|
||||||
self.ransac.calibration_frame_counter = 300
|
self.ransac.calibration_frame_counter = 300
|
||||||
if sys.platform.startswith("win"):
|
PlaySound('Audio/start.wav', SND_FILENAME | SND_ASYNC)
|
||||||
PlaySound('Audio/start.wav', SND_FILENAME | SND_ASYNC)
|
|
||||||
|
|
||||||
if event == self.gui_recenter_eyes:
|
if event == self.gui_recenter_eyes:
|
||||||
self.settings.gui_recenter_eyes = True
|
self.settings.gui_recenter_eyes = True
|
||||||
|
|||||||
@ -46,9 +46,7 @@ import numpy as np
|
|||||||
import cv2
|
import cv2
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from one_euro_filter import OneEuroFilter
|
from one_euro_filter import OneEuroFilter
|
||||||
if sys.platform.startswith("win"):
|
from utils.misc_utils import PlaySound, SND_FILENAME, SND_ASYNC
|
||||||
from winsound import PlaySound, SND_FILENAME, SND_ASYNC
|
|
||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
from osc_calibrate_filter import *
|
from osc_calibrate_filter import *
|
||||||
from haar_surround_feature import External_Run_HSF
|
from haar_surround_feature import External_Run_HSF
|
||||||
@ -93,8 +91,7 @@ def run_once(f):
|
|||||||
async def delayed_setting_change(setting, value):
|
async def delayed_setting_change(setting, value):
|
||||||
await asyncio.sleep(5)
|
await asyncio.sleep(5)
|
||||||
setting = value
|
setting = value
|
||||||
if sys.platform.startswith("win"):
|
PlaySound('Audio/compleated.wav', SND_FILENAME | SND_ASYNC)
|
||||||
PlaySound('Audio/compleated.wav', SND_FILENAME | SND_ASYNC)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
import os
|
import os
|
||||||
|
from utils.misc_utils import is_nt
|
||||||
from osc import VRChatOSCReceiver, VRChatOSC, EyeId
|
from osc import VRChatOSCReceiver, VRChatOSC, EyeId
|
||||||
from config import EyeTrackConfig
|
from config import EyeTrackConfig
|
||||||
from camera_widget import CameraWidget
|
from camera_widget import CameraWidget
|
||||||
from settings_widget import SettingsWidget
|
from settings_widget import SettingsWidget
|
||||||
|
|
||||||
import queue
|
import queue
|
||||||
import threading
|
import threading
|
||||||
import PySimpleGUI as sg
|
import PySimpleGUI as sg
|
||||||
@ -11,8 +13,7 @@ import urllib.request
|
|||||||
|
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
|
||||||
if sys.platform.startswith("win"):
|
|
||||||
from win10toast_click import ToastNotifier
|
|
||||||
|
|
||||||
# Random environment variable to speed up webcam opening on the MSMF backend.
|
# Random environment variable to speed up webcam opening on the MSMF backend.
|
||||||
# https://github.com/opencv/opencv/issues/17687
|
# https://github.com/opencv/opencv/issues/17687
|
||||||
@ -68,7 +69,8 @@ def main():
|
|||||||
else:
|
else:
|
||||||
print(
|
print(
|
||||||
f"\033[93m[INFO] You have app version [{appversion}] installed. Please update to [{latestversion}] for the newest features.\033[0m")
|
f"\033[93m[INFO] You have app version [{appversion}] installed. Please update to [{latestversion}] for the newest features.\033[0m")
|
||||||
if sys.platform.startswith("win"):
|
if is_nt:
|
||||||
|
from win10toast_click import ToastNotifier
|
||||||
toaster = ToastNotifier()
|
toaster = ToastNotifier()
|
||||||
toaster.show_toast( # show windows toast
|
toaster.show_toast( # show windows toast
|
||||||
"EyeTrackVR has an update.",
|
"EyeTrackVR has an update.",
|
||||||
|
|||||||
@ -3,8 +3,7 @@ from pythonosc import udp_client
|
|||||||
from pythonosc import osc_server
|
from pythonosc import osc_server
|
||||||
from pythonosc import dispatcher
|
from pythonosc import dispatcher
|
||||||
import sys
|
import sys
|
||||||
if sys.platform.startswith("win"):
|
from utils.misc_utils import PlaySound,SND_FILENAME,SND_ASYNC
|
||||||
from winsound import PlaySound, SND_FILENAME, SND_ASYNC
|
|
||||||
import queue
|
import queue
|
||||||
import threading
|
import threading
|
||||||
from enum import IntEnum
|
from enum import IntEnum
|
||||||
@ -179,8 +178,7 @@ class VRChatOSCReceiver:
|
|||||||
if osc_value:
|
if osc_value:
|
||||||
for eye in self.eyes:
|
for eye in self.eyes:
|
||||||
eye.ransac.calibration_frame_counter = 300
|
eye.ransac.calibration_frame_counter = 300
|
||||||
if sys.platform.startswith("win"):
|
PlaySound('Audio/start.wav', SND_FILENAME | SND_ASYNC)
|
||||||
PlaySound('Audio/start.wav', SND_FILENAME | SND_ASYNC)
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import sys
|
import sys
|
||||||
if sys.platform.startswith("win"):
|
from utils.misc_utils import PlaySound, SND_FILENAME, SND_ASYNC
|
||||||
from winsound import PlaySound, SND_FILENAME, SND_ASYNC
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
def cal_osc(self, cx, cy):
|
def cal_osc(self, cx, cy):
|
||||||
@ -12,8 +11,7 @@ def cal_osc(self, cx, cy):
|
|||||||
self.calibration_frame_counter = None
|
self.calibration_frame_counter = None
|
||||||
self.xoff = cx
|
self.xoff = cx
|
||||||
self.yoff = cy
|
self.yoff = cy
|
||||||
if sys.platform.startswith("win"):
|
PlaySound('Audio/compleated.wav', SND_FILENAME | SND_ASYNC)
|
||||||
PlaySound('Audio/compleated.wav', SND_FILENAME | SND_ASYNC)
|
|
||||||
elif self.calibration_frame_counter != None:
|
elif self.calibration_frame_counter != None:
|
||||||
self.settings.gui_recenter_eyes = False
|
self.settings.gui_recenter_eyes = False
|
||||||
if cx > self.xmax:
|
if cx > self.xmax:
|
||||||
@ -30,8 +28,7 @@ def cal_osc(self, cx, cy):
|
|||||||
self.yoff = cy
|
self.yoff = cy
|
||||||
if self.ts == 0:
|
if self.ts == 0:
|
||||||
self.settings.gui_recenter_eyes = False
|
self.settings.gui_recenter_eyes = False
|
||||||
if sys.platform.startswith("win"):
|
PlaySound('Audio/compleated.wav', SND_FILENAME | SND_ASYNC)
|
||||||
PlaySound('Audio/compleated.wav', SND_FILENAME | SND_ASYNC)
|
|
||||||
else:
|
else:
|
||||||
self.ts = self.ts - 1
|
self.ts = self.ts - 1
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -1,2 +1,14 @@
|
|||||||
|
import os
|
||||||
|
is_nt = True if os.name == "nt" else False
|
||||||
|
|
||||||
|
def PlaySound(*args, **kwargs): pass
|
||||||
|
SND_FILENAME = SND_ASYNC = 1
|
||||||
|
|
||||||
|
if is_nt:
|
||||||
|
import winsound
|
||||||
|
PlaySound = winsound.PlaySound
|
||||||
|
SND_FILENAME = winsound.SND_FILENAME
|
||||||
|
SND_ASYNC = winsound.SND_ASYNC
|
||||||
|
|
||||||
def clamp(x, low, high):
|
def clamp(x, low, high):
|
||||||
return max(low, min(x, high))
|
return max(low, min(x, high))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user