return and back to back

This commit is contained in:
2025-05-24 18:12:05 +02:00
parent b764547d16
commit 68580d0ded
3 changed files with 47 additions and 71 deletions

@ -400,7 +400,7 @@ class FrameWidgets(ttk.Frame):
# Update the labels based on the result
def update_ui_for_update(self, res):
"""Update UI elements based on update check result"""
"""Update UI elements based on an update check result"""
# First, remove the update button if it exists to avoid conflicts
if hasattr(self, "update_btn"):
self.update_btn.grid_forget()
@ -412,13 +412,13 @@ class FrameWidgets(ttk.Frame):
self.update_tooltip.set(_("Updates you have disabled"))
# Clear the foreground color as requested
self.update_foreground.set("")
# Set tooltip for the label
# Set the tooltip for the label
Tooltip(self.updates_lb, self.update_tooltip.get(), self.tooltip_state)
elif res == "No Internet Connection!":
self.update_label.set(_("No Server Connection!"))
self.update_foreground.set("red")
# Set tooltip for "No Server Connection"
# Set the tooltip for "No Server Connection"
Tooltip(
self.updates_lb,
_("Could not connect to update server"),
@ -429,7 +429,7 @@ class FrameWidgets(ttk.Frame):
self.update_label.set(_("No Updates"))
self.update_tooltip.set(_("Congratulations! Wire-Py is up to date"))
self.update_foreground.set("")
# Set tooltip for the label
# Set the tooltip for the label
Tooltip(self.updates_lb, self.update_tooltip.get(), self.tooltip_state)
else:
@ -505,7 +505,7 @@ class FrameWidgets(ttk.Frame):
AppConfig.UPDATE_URL, AppConfig.VERSION, "on"
)
# Make sure UI is updated regardless of previous state
# Make sure the UI is updated regardless of the previous state
if hasattr(self, "update_btn"):
self.update_btn.grid_forget()
if hasattr(self, "updates_lb"):
@ -550,8 +550,8 @@ class FrameWidgets(ttk.Frame):
# This assumes it's the third item (index 2) in your menu
self.settings.entryconfigure(1, label=self.tooltip_label.get())
def update_theme_label(self) -> str:
"""Update the theme label based on current theme"""
def update_theme_label(self) -> None:
"""Update the theme label based on the current theme"""
current_theme = ConfigManager.get("theme")
if current_theme == "light":
self.theme_label.set(_("Dark"))
@ -751,14 +751,10 @@ class FrameWidgets(ttk.Frame):
Msg.STR["imp_err"],
Msg.STR["no_valid_file"],
)
except IsADirectoryError:
except (IsADirectoryError, TypeError, FileNotFoundError):
print("File import: abort by user...")
except EOFError as e:
print(e)
except TypeError:
print("File import: abort by user...")
except FileNotFoundError:
print("File import: abort by user...")
def delete(self) -> None:
"""