Skip to content

Commit

Permalink
the app should no longer crash if it can't check for udpates
Browse files Browse the repository at this point in the history
  • Loading branch information
drewc5131 committed Nov 24, 2020
1 parent 984dc79 commit 948f806
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions ttle.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,18 @@ def __init__(self):
async def checkUpdates(self):
import aiohttp
async with aiohttp.ClientSession() as session:
async with session.get("https://raw.githubusercontent.com/OpenToontownTools/TTOpenLevelEditor/master/ver") as resp:
ver = await resp.text()
ver = ver.splitlines()[0]
if ver != self.APP_VERSION:
self.notify.info(f"Client is out of date! Latest: {ver} | Client: {self.APP_VERSION}")
if messagebox.askokcancel("Error", f"Client is out of date!\nLatest: {ver} | Client: {self.APP_VERSION}. Press OK to be taken to the download page."):
webbrowser.open("https://github.com/OpenToontownTools/TTOpenLevelEditor/releases/latest")
else:
self.notify.info("Client is up to date!")
try:
async with session.get("https://raw.githubusercontent.com/OpenToontownTools/OpenLevelEditor/master/ver") as resp:
ver = await resp.text()
ver = ver.splitlines()[0]
if ver != self.APP_VERSION:
self.notify.info(f"Client is out of date! Latest: {ver} | Client: {self.APP_VERSION}")
if messagebox.askokcancel("Error", f"Client is out of date!\nLatest: {ver} | Client: {self.APP_VERSION}. Press OK to be taken to the download page."):
webbrowser.open("https://github.com/OpenToontownTools/OpenLevelEditor/releases/latest")
else:
self.notify.info("Client is up to date!")
except:
messagebox.showerror(message = "There was an error checking for updates! This is likely an issue with your connection. Press OK to continue using the application.")

# Run it
ToontownLevelEditor().run()

0 comments on commit 948f806

Please sign in to comment.