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:
@@ -13,7 +13,7 @@ from tkinter import messagebox, filedialog
|
||||
import customtkinter as ctk
|
||||
|
||||
from core.i18n import t
|
||||
from core.icons import icon_text
|
||||
from core.icons import icon_text, ctk_icon, make_icon_button
|
||||
from core.ssh_client import SFTPSession
|
||||
from gui.widgets.file_list import FileListWidget
|
||||
|
||||
@@ -90,28 +90,34 @@ class FilesTab(ctk.CTkFrame):
|
||||
ctk.CTkLabel(left_header, text=t("local_files"),
|
||||
font=ctk.CTkFont(size=13, weight="bold")).pack(side="left")
|
||||
|
||||
_back_img = ctk_icon("back", 16)
|
||||
self._local_back_btn = ctk.CTkButton(
|
||||
left_header, text="\u2190", width=30, height=28,
|
||||
left_header, text="" if _back_img else "\u2190",
|
||||
image=_back_img, width=30, height=28,
|
||||
command=self._local_go_back,
|
||||
)
|
||||
self._local_back_btn.pack(side="left", padx=(8, 2))
|
||||
|
||||
_up_img = ctk_icon("up", 16)
|
||||
self._local_up_btn = ctk.CTkButton(
|
||||
left_header, text="\u2191", width=30, height=28,
|
||||
left_header, text="" if _up_img else "\u2191",
|
||||
image=_up_img, width=30, height=28,
|
||||
command=self._local_go_up,
|
||||
)
|
||||
self._local_up_btn.pack(side="left", padx=2)
|
||||
|
||||
# Local refresh button
|
||||
_ref_img = ctk_icon("refresh", 16)
|
||||
self._local_refresh_btn = ctk.CTkButton(
|
||||
left_header, text="\u21BB", width=30, height=28,
|
||||
left_header, text="" if _ref_img else "\u21BB",
|
||||
image=_ref_img, width=30, height=28,
|
||||
command=self._refresh_local,
|
||||
)
|
||||
self._local_refresh_btn.pack(side="left", padx=2)
|
||||
|
||||
# Browse button
|
||||
self._browse_btn = ctk.CTkButton(
|
||||
left_header, text=icon_text("folder_open", t("browse")), width=75, height=28,
|
||||
self._browse_btn = make_icon_button(
|
||||
left_header, "folder_open", t("browse"), width=75, height=28,
|
||||
command=self._browse_local,
|
||||
)
|
||||
self._browse_btn.pack(side="left", padx=2)
|
||||
@@ -158,19 +164,22 @@ class FilesTab(ctk.CTkFrame):
|
||||
font=ctk.CTkFont(size=13, weight="bold")).pack(side="left")
|
||||
|
||||
self._remote_back_btn = ctk.CTkButton(
|
||||
right_header, text="\u2190", width=30, height=28,
|
||||
right_header, text="" if _back_img else "\u2190",
|
||||
image=_back_img, width=30, height=28,
|
||||
command=self._remote_go_back,
|
||||
)
|
||||
self._remote_back_btn.pack(side="left", padx=(8, 2))
|
||||
|
||||
self._remote_up_btn = ctk.CTkButton(
|
||||
right_header, text="\u2191", width=30, height=28,
|
||||
right_header, text="" if _up_img else "\u2191",
|
||||
image=_up_img, width=30, height=28,
|
||||
command=self._remote_go_up,
|
||||
)
|
||||
self._remote_up_btn.pack(side="left", padx=2)
|
||||
|
||||
self._remote_refresh_btn = ctk.CTkButton(
|
||||
right_header, text="\u21BB", width=30, height=28,
|
||||
right_header, text="" if _ref_img else "\u21BB",
|
||||
image=_ref_img, width=30, height=28,
|
||||
command=self._refresh_remote,
|
||||
)
|
||||
self._remote_refresh_btn.pack(side="left", padx=2)
|
||||
@@ -204,14 +213,14 @@ class FilesTab(ctk.CTkFrame):
|
||||
toolbar = ctk.CTkFrame(self, fg_color="transparent")
|
||||
toolbar.pack(fill="x", padx=10, pady=4)
|
||||
|
||||
self._upload_btn = ctk.CTkButton(
|
||||
toolbar, text=icon_text("upload", t("upload")), width=110, height=30,
|
||||
self._upload_btn = make_icon_button(
|
||||
toolbar, "upload", t("upload"), width=110, height=30,
|
||||
command=self._upload_selected,
|
||||
)
|
||||
self._upload_btn.pack(side="left", padx=(0, 4))
|
||||
|
||||
self._download_btn = ctk.CTkButton(
|
||||
toolbar, text=icon_text("download", t("download")), width=110, height=30,
|
||||
self._download_btn = make_icon_button(
|
||||
toolbar, "download", t("download"), width=110, height=30,
|
||||
command=self._download_selected,
|
||||
)
|
||||
self._download_btn.pack(side="left", padx=4)
|
||||
@@ -219,21 +228,21 @@ class FilesTab(ctk.CTkFrame):
|
||||
sep = ctk.CTkFrame(toolbar, width=2, height=24, fg_color="gray40")
|
||||
sep.pack(side="left", padx=8)
|
||||
|
||||
self._mkdir_btn = ctk.CTkButton(
|
||||
toolbar, text=icon_text("folder", t("new_folder")), width=110, height=30,
|
||||
self._mkdir_btn = make_icon_button(
|
||||
toolbar, "folder", t("new_folder"), width=110, height=30,
|
||||
command=self._mkdir_remote,
|
||||
)
|
||||
self._mkdir_btn.pack(side="left", padx=4)
|
||||
|
||||
self._delete_btn = ctk.CTkButton(
|
||||
toolbar, text=icon_text("delete", t("delete_files")), width=90, height=30,
|
||||
self._delete_btn = make_icon_button(
|
||||
toolbar, "delete", t("delete_files"), width=90, height=30,
|
||||
fg_color="#dc2626", hover_color="#b91c1c",
|
||||
command=self._delete_remote,
|
||||
)
|
||||
self._delete_btn.pack(side="left", padx=4)
|
||||
|
||||
self._rename_btn = ctk.CTkButton(
|
||||
toolbar, text=icon_text("edit", t("rename_file")), width=110, height=30,
|
||||
self._rename_btn = make_icon_button(
|
||||
toolbar, "edit", t("rename_file"), width=110, height=30,
|
||||
command=self._rename_remote,
|
||||
)
|
||||
self._rename_btn.pack(side="left", padx=4)
|
||||
|
||||
Reference in New Issue
Block a user