From b44c7b96d3ec2094c8d2d16645b131f70d6e9732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A9sir=C3=A9=20Werner=20Menrath?= Date: Wed, 13 Aug 2025 19:52:51 +0200 Subject: [PATCH] Fix: Improve update button and animation behavior in MenuBar - Ensured the update toggle button remains active regardless of update status. - Implemented state management for the animated update icon, making it clickable only when a new version is available. - Corrected tooltip synchronization with the animated icon's state. - Removed redundant update status check in the updater method, as UI state now controls interaction. --- menu_bar.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/menu_bar.py b/menu_bar.py index 50f6e74..14abeaf 100644 --- a/menu_bar.py +++ b/menu_bar.py @@ -124,7 +124,8 @@ class MenuBar(ttk.Frame): command=toggle_log_window, ) self.log_btn.grid(column=2, row=0, sticky="e") - Tooltip(self.log_btn, self.msg_config.TTIP["show_log"], state_var=self.tooltip_state) + Tooltip(self.log_btn, + self.msg_config.TTIP["show_log"], state_var=self.tooltip_state) # --- About Button --- self.about_btn = ttk.Button( @@ -222,29 +223,35 @@ class MenuBar(ttk.Frame): self.animated_icon_frame.grid() tooltip_msg = "" + animated_icon_frame_state = "normal" # Default to normal if new_version == "DISABLED": tooltip_msg = self.msg_config.TTIP["updates_disabled"] self.animated_icon.stop() + animated_icon_frame_state = "disabled" elif new_version == "ERROR": tooltip_msg = self.msg_config.TTIP["no_server_conn_tt"] self.animated_icon.stop(status="DISABLE") + animated_icon_frame_state = "disabled" elif new_version is None: tooltip_msg = self.msg_config.TTIP["up_to_date"] self.animated_icon.stop() + animated_icon_frame_state = "disabled" else: # A new version string is returned, meaning an update is available tooltip_msg = self.msg_config.TTIP["install_new_version"].format(version=new_version) self.animated_icon.start() + animated_icon_frame_state = "normal" + # The update_btn (toggle updates on/off) should always be active + self.update_btn.config(state="normal") + self.animated_icon_frame.config(state=animated_icon_frame_state, + cursor="arrow" if animated_icon_frame_state == "disabled" else "hand2") Tooltip(self.update_btn, tooltip_msg, state_var=self.tooltip_state) Tooltip(self.animated_icon_frame, tooltip_msg, state_var=self.tooltip_state) def updater(self) -> None: """Runs the external installer script for updating the application.""" - if self.update_status in ["False", "No Internet Connection!", "No Updates"]: - return - tmp_dir = Path("/tmp/lxtools") Path.mkdir(tmp_dir, exist_ok=True) os.chdir(tmp_dir)