mirror of
https://github.com/EyeTrackVR/EyeTrackVR.git
synced 2025-11-04 14:39:42 +08:00
better cross platform support
This commit is contained in:
parent
9c7ce288c1
commit
6ca561e6b5
@ -17,7 +17,8 @@ import time
|
|||||||
import statistics
|
import statistics
|
||||||
from one_euro_filter import OneEuroFilter
|
from one_euro_filter import OneEuroFilter
|
||||||
from sympy import symbols, Eq, solve
|
from sympy import symbols, Eq, solve
|
||||||
from winsound import PlaySound, SND_FILENAME, SND_ASYNC
|
if sys.platform.startswith("win"):
|
||||||
|
from winsound import PlaySound, SND_FILENAME, SND_ASYNC
|
||||||
import scipy.signal as sp
|
import scipy.signal as sp
|
||||||
|
|
||||||
|
|
||||||
@ -52,6 +53,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)
|
||||||
|
|
||||||
|
|
||||||
@ -345,6 +347,7 @@ class EyeProcessor:
|
|||||||
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
|
||||||
@ -362,6 +365,7 @@ class EyeProcessor:
|
|||||||
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
|
||||||
@ -604,6 +608,7 @@ class EyeProcessor:
|
|||||||
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: # TODO reset calibration values on button press
|
elif self.calibration_frame_counter != None: # TODO reset calibration values on button press
|
||||||
if exm > self.xmax:
|
if exm > self.xmax:
|
||||||
@ -620,6 +625,7 @@ class EyeProcessor:
|
|||||||
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
|
||||||
|
|||||||
@ -6,12 +6,14 @@ from settings_widget import SettingsWidget
|
|||||||
import queue
|
import queue
|
||||||
import threading
|
import threading
|
||||||
import PySimpleGUI as sg
|
import PySimpleGUI as sg
|
||||||
|
import sys
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
import webbrowser
|
import webbrowser
|
||||||
from win10toast_click import ToastNotifier ## REMOVE FOR LINUX COMPATIBILITY
|
|
||||||
|
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
|
||||||
@ -67,7 +69,8 @@ def main():
|
|||||||
print(f"[INFO] App is up to date! {latestversion}")
|
print(f"[INFO] App is up to date! {latestversion}")
|
||||||
else:
|
else:
|
||||||
print(f"[INFO] You have app version {appversion} installed. Please update to {latestversion} for the newest fixes.")
|
print(f"[INFO] You have app version {appversion} installed. Please update to {latestversion} for the newest fixes.")
|
||||||
toaster = ToastNotifier() ## REMOVE THIS AND NEXT 8 LINES FOR LINUX COMPATIBILITY
|
if sys.platform.startswith("win"):
|
||||||
|
toaster = ToastNotifier()
|
||||||
toaster.show_toast( #show windows toast
|
toaster.show_toast( #show windows toast
|
||||||
"EyeTrackVR has an update.",
|
"EyeTrackVR has an update.",
|
||||||
"Click to go to the latest version.",
|
"Click to go to the latest version.",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user