Files
server-manager/core/icons.py
chrome-storm-c442 9b0e4c76a3 v1.9.0: S3 server type — bucket/object browser, drag-and-drop upload, resilient transfers
New server type: S3 (MinIO, AWS, any S3-compatible storage)
- core/s3_client.py: boto3 client with auto-reconnect, 10 retries, exponential backoff, multipart upload/download, tcp_keepalive
- gui/tabs/s3_tab.py: object browser (Treeview), bucket selector, folder navigation, drag-and-drop upload from Explorer (windnd), progress bar with %, multi-file upload
- CLI: --s3-buckets, --s3-ls, --s3-upload, --s3-download, --s3-delete with retry
- ServerDialog: access_key, secret_key, bucket fields
- Registration: server_store, connection_factory, status_checker, icons, app, i18n (EN/RU/ZH)
- Fix: build.py cleanup_old_releases now sorts by semver (was lexicographic, broke v1.8.100+)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 06:32:03 -05:00

182 lines
4.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
Icon registry — semantic Unicode symbols for all GUI elements.
Centralized icon management for buttons, tabs, menus, and type badges.
"""
# Semantic icon mapping
ICONS = {
# Navigation
"back": "\u2190", # ←
"up": "\u2191", # ↑
"refresh": "\u21bb", # ↻
# CRUD
"add": "\uff0b", #
"edit": "\u270e", # ✎
"delete": "\u2715", # ✕
"confirm": "\u2713", # ✓
# Transfer
"upload": "\u2b06", # ⬆
"download": "\u2b07", # ⬇
# Actions
"execute": "\u25b6", # ▶
"info": "\u2139", #
"clear": "\u232b", # ⌫
"search": "\U0001f50d", # 🔍
"hash": "#",
# Files
"folder": "\U0001f4c1", # 📁
"folder_open": "\U0001f4c2", # 📂
"save": "\U0001f4be", # 💾
# Keys & security
"key": "\U0001f511", # 🔑
"lock": "\U0001f510", # 🔐
"eye": "\U0001f441", # 👁
# Clipboard
"copy": "\U0001f4cb", # 📋
# Settings
"gear": "\u2699", # ⚙
"globe": "\U0001f310", # 🌐
# Status
"online": "\u25cf", # ●
"checking": "\u25d0", # ◐
"offline": "\u2014", # —
# Tabs
"terminal": "\u2328", # ⌨
"query": "\u25b6", # ▶
"dashboards": "\U0001f4ca", # 📊
"metrics": "\U0001f4c8", # 📈
"powershell": "\u2328", # ⌨
"launch": "\U0001f5a5", # 🖥
"totp": "\U0001f510", # 🔐
"objects": "\U0001faa3", # 🪣
# Context menu
"connect": "\u25b6", # ▶
"browser": "\U0001f310", # 🌐
"status_check": "\u25cf",# ●
}
def icon(name: str) -> str:
"""Get icon symbol by semantic name."""
return ICONS.get(name, "")
def icon_text(name: str, label: str) -> str:
"""Format 'icon label' string for buttons/menus."""
sym = ICONS.get(name, "")
if sym:
return f"{sym} {label}"
return label
# Server type colors
TYPE_COLORS = {
"ssh": "#22c55e",
"telnet": "#a855f7",
"rdp": "#3b82f6",
"vnc": "#6366f1",
"winrm": "#0ea5e9",
"mariadb": "#f59e0b",
"mssql": "#ef4444",
"postgresql": "#3b82f6",
"redis": "#dc2626",
"grafana": "#f97316",
"prometheus": "#e11d48",
"s3": "#16a34a",
}
# Unicode symbols for each server type (reliable, no PIL needed)
TYPE_SYMBOLS = {
"ssh": "\U0001f5a5", # 🖥
"telnet": "\U0001f4df", # 📟
"rdp": "\U0001f5b5", # 🖵
"vnc": "\U0001f5b5", # 🖵
"winrm": "\u229e", # ⊞
"mariadb": "\U0001f4be", # 💾
"mssql": "\U0001f4be", # 💾
"postgresql": "\U0001f418",# 🐘
"redis": "\u25c6", # ◆
"grafana": "\U0001f4ca", # 📊
"prometheus": "\U0001f525", # 🔥
"s3": "\U0001faa3", # 🪣
}
# Short text labels for sidebar badge
TYPE_LABELS = {
"ssh": "SSH",
"telnet": "TEL",
"rdp": "RDP",
"vnc": "VNC",
"winrm": "PS",
"mariadb": "MDB",
"mssql": "SQL",
"postgresql": "PG",
"redis": "RDS",
"grafana": "GRF",
"prometheus": "PRM",
"s3": "S3",
}
def type_display(server_type: str) -> str:
"""Return 'symbol type' for dropdown display, e.g. '🖥 ssh'."""
sym = TYPE_SYMBOLS.get(server_type, "")
if sym:
return f"{sym} {server_type}"
return server_type
def type_from_display(display: str) -> str:
"""Extract raw type from display string, e.g. '🖥 ssh' -> 'ssh'."""
# Strip the leading symbol + space
for stype in TYPE_SYMBOLS:
suffix = f" {stype}"
if display.endswith(suffix) and len(display) == len(suffix) + len(TYPE_SYMBOLS.get(stype, "")):
return stype
# Fallback: return as-is (might already be raw type)
return display.strip()
# Tab icon mapping (tab_key -> icon_name)
TAB_ICONS = {
"terminal": "terminal",
"files": "folder",
"info": "info",
"keys": "key",
"totp": "totp",
"setup": "gear",
"query": "query",
"console": "terminal",
"dashboards": "dashboards",
"metrics": "metrics",
"powershell": "powershell",
"launch": "launch",
"objects": "objects",
}
# Context menu icon mapping (i18n_key -> icon_name)
CTX_ICONS = {
"ctx_open_terminal": "terminal",
"ctx_browse_files": "folder",
"ctx_install_key": "key",
"ctx_open_powershell": "powershell",
"ctx_open_query": "query",
"ctx_open_console": "terminal",
"ctx_connect": "connect",
"ctx_open_browser": "browser",
"ctx_check_status": "status_check",
"ctx_copy_alias": "copy",
"edit": "edit",
"delete": "delete",
}