From fc3c8746c8fb735fe3d9d153d1139f5da4c641f4 Mon Sep 17 00:00:00 2001 From: Adam Saudagar Date: Thu, 3 Feb 2022 03:57:22 +0530 Subject: [PATCH] update in file menu not showing on first launch removed feature: hide update in file menu if dont ask is not checked --- fishy/gui/main_gui.py | 8 ++++++-- fishy/gui/update_dialog.py | 4 +++- fishy/helper/__init__.py | 2 +- fishy/helper/helper.py | 7 ------- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/fishy/gui/main_gui.py b/fishy/gui/main_gui.py index 2cf9b2c..cce29c4 100644 --- a/fishy/gui/main_gui.py +++ b/fishy/gui/main_gui.py @@ -4,6 +4,7 @@ import tkinter as tk import tkinter.ttk as ttk import typing +from fishy.gui import update_dialog from ttkthemes import ThemedTk from fishy import helper @@ -56,8 +57,11 @@ def _create(gui: 'GUI'): dark_mode_var.set(int(config.get('dark_mode', True))) filemenu.add_checkbutton(label="Dark Mode", command=_toggle_mode, variable=dark_mode_var) - if config.get("dont_ask_update", False): - filemenu.add_command(label="Update", command=lambda: helper.update(gui)) + + def update(): + config.delete("dont_ask_update") + update_dialog.check_update(gui, True) + filemenu.add_command(label="Update", command=update) def installer(): if filemenu.entrycget(4, 'label') == "Remove FishyQR": diff --git a/fishy/gui/update_dialog.py b/fishy/gui/update_dialog.py index 1798810..ecf9b8e 100644 --- a/fishy/gui/update_dialog.py +++ b/fishy/gui/update_dialog.py @@ -43,8 +43,10 @@ def _show(gui, currentversion, newversion, returns): top.start() -def check_update(gui): +def check_update(gui, manual_check=False): if not auto_update.upgrade_avail() or config.get("dont_ask_update", False): + if manual_check: + logging.info("No update is available.") return cv, hv = auto_update.versions() diff --git a/fishy/helper/__init__.py b/fishy/helper/__init__.py index 6e852ce..686e1a3 100644 --- a/fishy/helper/__init__.py +++ b/fishy/helper/__init__.py @@ -4,5 +4,5 @@ from .helper import (addon_exists, create_shortcut, create_shortcut_first, install_addon, install_thread_excepthook, manifest_file, not_implemented, open_web, playsound_multiple, remove_addon, unhandled_exception_logging, - update, install_required_addons) + install_required_addons) from .luaparser import sv_color_extract diff --git a/fishy/helper/helper.py b/fishy/helper/helper.py index 9369723..a1eac7a 100644 --- a/fishy/helper/helper.py +++ b/fishy/helper/helper.py @@ -232,13 +232,6 @@ def log_raise(msg): raise Exception(msg) -def update(gui): - from .config import config - - config.delete("dont_ask_update") - update_dialog.check_update(gui) - - def is_eso_active(): return GetWindowText(GetForegroundWindow()) == "Elder Scrolls Online"