Files
server-manager/core/icons.py
chrome-storm-c442 4959004a3f v1.8.52: icons module, Windows SSH sanitization, embedded RDP improvements, UI polish
- Add core/icons.py — centralized icon text helper with emoji/symbol support
- Add Windows SSH command sanitization in ssh.py (Linux→Windows auto-translation)
- Improve embedded RDP: launch tab connect/disconnect, fullscreen toggle
- Refactor sidebar: cleaner server type badges
- Update server_dialog: adaptive fields per server type
- Add setup_openssh.bat tool
- Update skill-ssh.md and CLAUDE.md docs for Windows SSH support
- Cleanup old releases, add v1.8.48-v1.8.52

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 14:37:37 -05:00

177 lines
4.4 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", # 🔐
# 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",
}
# 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", # 🔥
}
# 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",
}
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",
}
# 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",
}