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.
This commit is contained in:
2025-08-13 19:52:51 +02:00
parent 13f5f1f4fd
commit b44c7b96d3

View File

@@ -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)