add update installer on custom_file_dialog
This commit is contained in:
@@ -471,10 +471,17 @@ class AnimatedIcon(tk.Canvas):
|
||||
return
|
||||
|
||||
# Do not animate if a grab is active on a different window.
|
||||
toplevel = self.winfo_toplevel()
|
||||
grab_widget = toplevel.grab_current()
|
||||
if grab_widget is not None and grab_widget != toplevel:
|
||||
self.after(100, self._animate) # Check again after a short delay
|
||||
try:
|
||||
toplevel = self.winfo_toplevel()
|
||||
grab_widget = toplevel.grab_current()
|
||||
if grab_widget is not None and grab_widget != toplevel:
|
||||
self.after(100, self._animate) # Check again after a short delay
|
||||
return
|
||||
except Exception:
|
||||
# This can happen if a grabbed widget (like a combobox dropdown)
|
||||
# is destroyed at the exact moment this check runs.
|
||||
# It's safest to just skip this animation frame.
|
||||
self.after(30, self._animate)
|
||||
return
|
||||
|
||||
self.angle += 0.1
|
||||
|
@@ -231,6 +231,21 @@ class CustomFileDialog(tk.Toplevel):
|
||||
except Exception:
|
||||
self.after(0, self.update_ui_for_update, "ERROR")
|
||||
|
||||
def _run_installer(self, event: Optional[tk.Event] = None) -> None:
|
||||
"""Runs the LxTools installer if it exists."""
|
||||
installer_path = '/usr/local/bin/lxtools_installer'
|
||||
if os.path.exists(installer_path):
|
||||
try:
|
||||
subprocess.Popen([installer_path])
|
||||
self.widget_manager.search_status_label.config(
|
||||
text="Installer started...")
|
||||
except OSError as e:
|
||||
self.widget_manager.search_status_label.config(
|
||||
text=f"Error starting installer: {e}")
|
||||
else:
|
||||
self.widget_manager.search_status_label.config(
|
||||
text=f"Installer not found at {installer_path}")
|
||||
|
||||
def update_ui_for_update(self, new_version: Optional[str]) -> None:
|
||||
"""
|
||||
Updates the UI based on the result of the library update check.
|
||||
@@ -243,11 +258,12 @@ class CustomFileDialog(tk.Toplevel):
|
||||
if new_version is None or new_version == "ERROR":
|
||||
return
|
||||
|
||||
icon.grid()
|
||||
icon.grid(row=0, column=2, sticky='e', padx=(10, 5)) # Added padding
|
||||
tooltip_msg = LocaleStrings.UI["install_new_version"].format(
|
||||
version=new_version)
|
||||
icon.start()
|
||||
|
||||
icon.bind("<Button-1>", self._run_installer)
|
||||
Tooltip(icon, tooltip_msg)
|
||||
|
||||
def get_file_icon(self, filename: str, size: str = 'large') -> tk.PhotoImage:
|
||||
|
Reference in New Issue
Block a user