mirror of
https://github.com/EyeTrackVR/EyeTrackVR.git
synced 2025-11-04 14:39:42 +08:00
fix update check, replace win10toast with winotify
This commit is contained in:
parent
137f3004f7
commit
f6905c48eb
@ -9,9 +9,11 @@ import queue
|
|||||||
import threading
|
import threading
|
||||||
import PySimpleGUI as sg
|
import PySimpleGUI as sg
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
import requests
|
||||||
|
from winotify import Notification
|
||||||
os.system('color') # init ANSI color
|
os.system('color') # init ANSI color
|
||||||
|
|
||||||
# Random environment variable to speed up webcam opening on the MSMF backend.
|
# Random environment variable to speed up webcam opening on the MSMF backend.
|
||||||
@ -30,7 +32,7 @@ SETTINGS_RADIO_NAME = '-SETTINGSRADIO-'
|
|||||||
|
|
||||||
|
|
||||||
page_url = 'https://github.com/RedHawk989/EyeTrackVR/releases/latest'
|
page_url = 'https://github.com/RedHawk989/EyeTrackVR/releases/latest'
|
||||||
appversion = "0.2.0 BETA 1"
|
appversion = "EyeTrackApp 0.2.0 BETA 1"
|
||||||
|
|
||||||
def open_url():
|
def open_url():
|
||||||
try:
|
try:
|
||||||
@ -49,36 +51,29 @@ def main():
|
|||||||
ROSC = False
|
ROSC = False
|
||||||
# Check to see if we can connect to our video source first. If not, bring up camera finding
|
# Check to see if we can connect to our video source first. If not, bring up camera finding
|
||||||
# dialog.
|
# dialog.
|
||||||
|
|
||||||
|
|
||||||
if config.settings.gui_update_check:
|
if config.settings.gui_update_check:
|
||||||
print("\033[95m[INFO] Checking for updates...\033[0m")
|
response = requests.get("https://api.github.com/repos/RedHawk989/EyeTrackVR/releases/latest")
|
||||||
url = "https://raw.githubusercontent.com/RedHawk989/EyeTrackVR-Installer/master/Version-Data/Version_Num.txt"
|
latestversion = response.json()["name"]
|
||||||
req = urllib.request.Request(url)
|
|
||||||
try:
|
|
||||||
with urllib.request.urlopen(req, timeout=10) as res:
|
|
||||||
latestversion = res.read().decode("utf-8").strip()
|
|
||||||
except urllib.error.HTTPError as err:
|
|
||||||
print("Failed to check latest version.")
|
|
||||||
print("{} : {}".format(err.code,err.reason))
|
|
||||||
except urllib.error.URLError as err:
|
|
||||||
print("Failed to check latest version.")
|
|
||||||
print(err.reason)
|
|
||||||
else:
|
|
||||||
if appversion == latestversion: # If what we scraped and hardcoded versions are same, assume we are up to date.
|
if appversion == latestversion: # If what we scraped and hardcoded versions are same, assume we are up to date.
|
||||||
print(f"\033[92m[INFO] App is up to date! [{latestversion}]\033[0m")
|
print(f"\033[92m[INFO] App is up to date! [{latestversion}]\033[0m")
|
||||||
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 is_nt:
|
if is_nt:
|
||||||
from win10toast_click import ToastNotifier
|
cwd = os.getcwd()
|
||||||
toaster = ToastNotifier()
|
icon = cwd + "\Images\logo.ico"
|
||||||
toaster.show_toast( # show windows toast
|
toast = Notification(app_id="EyeTrackApp",
|
||||||
"EyeTrackVR has an update.",
|
title="New Update Available!",
|
||||||
"Click to go to the latest version.",
|
msg=f"Please update to {latestversion}",
|
||||||
icon_path="Images/logo.ico",
|
icon=r"{}".format(icon))
|
||||||
duration=5,
|
toast.add_actions(label="Download Page",
|
||||||
threaded=True,
|
launch="https://github.com/RedHawk989/EyeTrackVR/releases/latest")
|
||||||
callback_on_click=open_url
|
toast.show()
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Check to see if we have an ROI. If not, bring up ROI finder GUI.
|
# Check to see if we have an ROI. If not, bring up ROI finder GUI.
|
||||||
|
|
||||||
@ -169,7 +164,7 @@ def main():
|
|||||||
ROSC = True
|
ROSC = True
|
||||||
|
|
||||||
# Create the window
|
# Create the window
|
||||||
window = sg.Window(f"EyeTrackVR {appversion}" , layout, icon='Images/logo.ico', background_color='#292929')
|
window = sg.Window(f"{appversion}" , layout, icon='Images/logo.ico', background_color='#292929')
|
||||||
|
|
||||||
# GUI Render loop
|
# GUI Render loop
|
||||||
while True:
|
while True:
|
||||||
|
|||||||
@ -14,8 +14,8 @@ numpy = "~1.23.5"
|
|||||||
pye3d = "^0.3.1.post1"
|
pye3d = "^0.3.1.post1"
|
||||||
pysimplegui = "^4.60.4"
|
pysimplegui = "^4.60.4"
|
||||||
pydantic = "^1.10.2"
|
pydantic = "^1.10.2"
|
||||||
win10toast_click = [
|
winotify = [
|
||||||
{ version = "^0.1.2", platform = 'win32' }
|
{ version = "^1.1.0", platform = 'win32' }
|
||||||
]
|
]
|
||||||
onnxruntime = "^1.13.1"
|
onnxruntime = "^1.13.1"
|
||||||
serial = "~0.0.97"
|
serial = "~0.0.97"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user