diff --git a/gui.py b/gui.py index e41ed72..a96b6a1 100644 --- a/gui.py +++ b/gui.py @@ -8,7 +8,7 @@ import webbrowser import tkinter as tk from tk import tk_code -from utils import extract_figma_id, check_for_updates +from utils import extract_figma_id, has_update from tkinter import filedialog, messagebox def load_asset(path): @@ -273,10 +273,9 @@ def select_outpath(): donate_button.place(x=371, y=446, width=343, height=34) -try: - exec(check_for_updates()) -except: - print("No updates!") +update = has_update() +if update == True: + messagebox.showinfo('New update!', "Update your version of TkForge to get the latest features! https://github.com/axorax/tkforge/releases") root.resizable(False, False) root.mainloop() diff --git a/info.py b/info.py deleted file mode 100644 index 79e1960..0000000 --- a/info.py +++ /dev/null @@ -1 +0,0 @@ -messagebox.showinfo('New update!', "Update your version of TkForge to get the latest features! https://github.com/axorax/tkforge/releases") diff --git a/info_cli.py b/info_cli.py deleted file mode 100644 index 6d069d2..0000000 --- a/info_cli.py +++ /dev/null @@ -1,3 +0,0 @@ -print("New update!") -print("Update your version of TkForge to get the latest features!") -print("https://github.com/axorax/tkforge/releases") \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 29ea4f0..6198c5b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,10 +5,6 @@ colorama==0.4.6 idna==3.7 packaging==24.1 pefile==2024.8.26 -<<<<<<< HEAD -pillow==10.4.0 -======= ->>>>>>> 250f915 (fix: Include pyinstaller) pyinstaller==6.10.0 pyinstaller-hooks-contrib==2024.8 pywin32-ctypes==0.2.3 diff --git a/tkforge.py b/tkforge.py index 96c494f..db79c83 100644 --- a/tkforge.py +++ b/tkforge.py @@ -2,7 +2,7 @@ import argparse from tk import tk_code from colorama import Fore, init -from utils import extract_figma_id, check_for_updates, VERSION +from utils import extract_figma_id, has_update, VERSION init(autoreset=True) @@ -37,11 +37,11 @@ def main(): if args.update: try: - update = check_for_updates(False) - if update == "": + update = has_update() + if update == False: print(Fore.GREEN + "No updates!") else: - exec(update) + print("New update!\nUpdate your version of TkForge to get the latest features!\nhttps://github.com/axorax/tkforge/releases") except: print(Fore.RED + "Update check failed!") return diff --git a/utils.py b/utils.py index 6e13b7e..5323e51 100644 --- a/utils.py +++ b/utils.py @@ -5,7 +5,7 @@ VERSION = "2.1.1" BASE_URL = "https://raw.githubusercontent.com/Axorax/tkforge/refs/heads/main/" -def check_for_updates(gui_info = True): +def has_update(): try: global VERSION response = requests.get(f"{BASE_URL}VERSION.txt") @@ -14,11 +14,9 @@ def check_for_updates(gui_info = True): version_tuple = tuple(map(int, VERSION.split('.'))) online_version_tuple = tuple(map(int, online_version.split('.'))) if online_version_tuple > version_tuple: - response = requests.get(f"{BASE_URL}{"info" if gui_info else "info_cli"}.py") - response.raise_for_status() - return response.text + return True else: - return "" + return False except requests.RequestException as e: return ""