better cross platform support

This commit is contained in:
Prohurtz 2022-11-22 14:54:04 -08:00
parent 9c7ce288c1
commit 6ca561e6b5
2 changed files with 26 additions and 17 deletions

View File

@ -17,7 +17,8 @@ import time
import statistics
from one_euro_filter import OneEuroFilter
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
@ -52,7 +53,8 @@ def run_once(f):
async def delayed_setting_change(setting, value):
await asyncio.sleep(5)
setting = value
PlaySound('Audio/compleated.wav', SND_FILENAME | SND_ASYNC)
if sys.platform.startswith("win"):
PlaySound('Audio/compleated.wav', SND_FILENAME | SND_ASYNC)
def fit_rotated_ellipse_ransac(
@ -345,7 +347,8 @@ class EyeProcessor:
self.calibration_frame_counter = None
self.xoff = cx
self.yoff = cy
PlaySound('Audio/compleated.wav', SND_FILENAME | SND_ASYNC)
if sys.platform.startswith("win"):
PlaySound('Audio/compleated.wav', SND_FILENAME | SND_ASYNC)
elif self.calibration_frame_counter != None:
self.settings.gui_recenter_eyes = False
if cx > self.xmax:
@ -362,7 +365,8 @@ class EyeProcessor:
self.yoff = cy
if self.ts == 0:
self.settings.gui_recenter_eyes = False
PlaySound('Audio/compleated.wav', SND_FILENAME | SND_ASYNC)
if sys.platform.startswith("win"):
PlaySound('Audio/compleated.wav', SND_FILENAME | SND_ASYNC)
else:
self.ts = self.ts - 1
else:
@ -604,7 +608,8 @@ class EyeProcessor:
self.calibration_frame_counter = None
self.xoff = cx
self.yoff = cy
PlaySound('Audio/compleated.wav', SND_FILENAME | SND_ASYNC)
if sys.platform.startswith("win"):
PlaySound('Audio/compleated.wav', SND_FILENAME | SND_ASYNC)
elif self.calibration_frame_counter != None: # TODO reset calibration values on button press
if exm > self.xmax:
self.xmax = exm
@ -620,7 +625,8 @@ class EyeProcessor:
self.yoff = cy
if self.ts == 0:
self.settings.gui_recenter_eyes = False
PlaySound('Audio/compleated.wav', SND_FILENAME | SND_ASYNC)
if sys.platform.startswith("win"):
PlaySound('Audio/compleated.wav', SND_FILENAME | SND_ASYNC)
else:
self.ts = self.ts - 1
else:

View File

@ -6,12 +6,14 @@ from settings_widget import SettingsWidget
import queue
import threading
import PySimpleGUI as sg
import sys
from urllib.request import urlopen
from bs4 import BeautifulSoup
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.
# https://github.com/opencv/opencv/issues/17687
@ -67,15 +69,16 @@ def main():
print(f"[INFO] App is up to date! {latestversion}")
else:
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
toaster.show_toast( #show windows toast
"EyeTrackVR has an update.",
"Click to go to the latest version.",
icon_path= "Images/logo.ico",
duration=5,
threaded=True,
callback_on_click=open_url
)
if sys.platform.startswith("win"):
toaster = ToastNotifier()
toaster.show_toast( #show windows toast
"EyeTrackVR has an update.",
"Click to go to the latest version.",
icon_path= "Images/logo.ico",
duration=5,
threaded=True,
callback_on_click=open_url
)
# Check to see if we have an ROI. If not, bring up ROI finder GUI.