v1.9.1: PNG Material Design icons — 28 icons, dark/light theme, HiDPI, graceful Unicode fallback
- 56 PNG icons (28 unique × 2 color variants) from Material Design Icons (round style, 96×96px) - core/icons.py: ctk_icon(), make_icon_button(), reconfigure_icon_button() with CTkImage cache - Updated 15 GUI files: app.py, sidebar.py, server_dialog.py, all tabs - build.py: auto-include assets/icons/ in PyInstaller bundle, patch rollover at 99→minor+1 - tools/download_icons.py: icon download script - Automatic dark↔light theme switching via CTkImage dual-image support Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,7 @@ Live countdown, one-click copy, per-server secrets.
|
||||
import threading
|
||||
import customtkinter as ctk
|
||||
from core.i18n import t
|
||||
from core.icons import icon_text
|
||||
from core.icons import icon_text, make_icon_button, reconfigure_icon_button
|
||||
|
||||
|
||||
class TOTPTab(ctk.CTkFrame):
|
||||
@@ -81,8 +81,8 @@ class TOTPTab(ctk.CTkFrame):
|
||||
widget.bind("<Button-1>", lambda e: self._copy_code())
|
||||
|
||||
# Copy button
|
||||
self.copy_btn = ctk.CTkButton(
|
||||
self, text=icon_text("copy", t("totp_copy")), width=200, height=40,
|
||||
self.copy_btn = make_icon_button(
|
||||
self, "copy", t("totp_copy"), width=200, height=40,
|
||||
font=ctk.CTkFont(size=14),
|
||||
fg_color="#22c55e", hover_color="#16a34a",
|
||||
command=self._copy_code
|
||||
@@ -108,30 +108,30 @@ class TOTPTab(ctk.CTkFrame):
|
||||
)
|
||||
self.secret_entry.pack(side="left", fill="x", expand=True, padx=(0, 5))
|
||||
|
||||
self.show_secret_btn = ctk.CTkButton(
|
||||
entry_row, text=icon_text("eye", t("show")), width=80,
|
||||
self.show_secret_btn = make_icon_button(
|
||||
entry_row, "eye", t("show"), width=80,
|
||||
fg_color="#6b7280", hover_color="#4b5563",
|
||||
command=self._toggle_secret
|
||||
)
|
||||
self.show_secret_btn.pack(side="left", padx=(0, 5))
|
||||
self._secret_visible = False
|
||||
|
||||
self.save_secret_btn = ctk.CTkButton(
|
||||
entry_row, text=icon_text("confirm", t("totp_save_secret")), width=110,
|
||||
self.save_secret_btn = make_icon_button(
|
||||
entry_row, "confirm", t("totp_save_secret"), width=110,
|
||||
command=self._save_secret
|
||||
)
|
||||
self.save_secret_btn.pack(side="left", padx=(0, 5))
|
||||
|
||||
self.remove_secret_btn = ctk.CTkButton(
|
||||
entry_row, text=icon_text("delete", t("totp_remove_secret")), width=110,
|
||||
self.remove_secret_btn = make_icon_button(
|
||||
entry_row, "delete", t("totp_remove_secret"), width=110,
|
||||
fg_color="#ef4444", hover_color="#dc2626",
|
||||
command=self._remove_secret
|
||||
)
|
||||
self.remove_secret_btn.pack(side="left")
|
||||
|
||||
# Generate random secret button
|
||||
self.gen_secret_btn = ctk.CTkButton(
|
||||
secret_frame, text=icon_text("key", t("totp_generate_secret")), width=200,
|
||||
self.gen_secret_btn = make_icon_button(
|
||||
secret_frame, "key", t("totp_generate_secret"), width=200,
|
||||
fg_color="#6b7280", hover_color="#4b5563",
|
||||
command=self._generate_secret
|
||||
)
|
||||
@@ -267,8 +267,8 @@ class TOTPTab(ctk.CTkFrame):
|
||||
def _toggle_secret(self):
|
||||
self._secret_visible = not self._secret_visible
|
||||
self.secret_entry.configure(show="" if self._secret_visible else "*")
|
||||
self.show_secret_btn.configure(
|
||||
text=icon_text("eye", t("hide") if self._secret_visible else t("show"))
|
||||
reconfigure_icon_button(
|
||||
self.show_secret_btn, "eye", t("hide") if self._secret_visible else t("show")
|
||||
)
|
||||
|
||||
def _save_secret(self):
|
||||
@@ -331,12 +331,12 @@ class TOTPTab(ctk.CTkFrame):
|
||||
def update_language(self):
|
||||
self.title_label.configure(text=t("totp_title"))
|
||||
self.desc_label.configure(text=t("totp_desc"))
|
||||
self.copy_btn.configure(text=icon_text("copy", t("totp_copy")))
|
||||
self.save_secret_btn.configure(text=icon_text("confirm", t("totp_save_secret")))
|
||||
self.remove_secret_btn.configure(text=icon_text("delete", t("totp_remove_secret")))
|
||||
self.gen_secret_btn.configure(text=icon_text("key", t("totp_generate_secret")))
|
||||
self.show_secret_btn.configure(
|
||||
text=icon_text("eye", t("hide") if self._secret_visible else t("show"))
|
||||
reconfigure_icon_button(self.copy_btn, "copy", t("totp_copy"))
|
||||
reconfigure_icon_button(self.save_secret_btn, "confirm", t("totp_save_secret"))
|
||||
reconfigure_icon_button(self.remove_secret_btn, "delete", t("totp_remove_secret"))
|
||||
reconfigure_icon_button(self.gen_secret_btn, "key", t("totp_generate_secret"))
|
||||
reconfigure_icon_button(
|
||||
self.show_secret_btn, "eye", t("hide") if self._secret_visible else t("show")
|
||||
)
|
||||
if not self._current_alias:
|
||||
self.server_label.configure(text=t("no_server_selected"))
|
||||
|
||||
Reference in New Issue
Block a user