Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33e15827ce | ||
|
|
73bcac8a55 | ||
|
|
05706182df | ||
|
|
c4fae6a9c1 | ||
|
|
259caacb01 | ||
|
|
6c5ceead09 | ||
|
|
65c1f809b1 |
@@ -111,6 +111,7 @@ _EN = {
|
||||
"term_connecting": "Connecting to {alias}...",
|
||||
"term_connected": "Connected to {alias}",
|
||||
"term_disconnected": "Disconnected",
|
||||
"term_off": "OFFLINE",
|
||||
"ctx_disconnect": "Disconnect",
|
||||
"term_click_to_connect": "Double-click to connect to {alias}",
|
||||
"sftp_click_to_connect": "Double-click server to browse files",
|
||||
@@ -637,6 +638,7 @@ _RU = {
|
||||
"term_connecting": "Подключение к {alias}...",
|
||||
"term_connected": "Подключено к {alias}",
|
||||
"term_disconnected": "Отключено",
|
||||
"term_off": "ОТКЛЮЧЕНО",
|
||||
"ctx_disconnect": "Отключиться",
|
||||
"term_click_to_connect": "Двойной клик для подключения к {alias}",
|
||||
"sftp_click_to_connect": "Двойной клик для просмотра файлов",
|
||||
@@ -1163,6 +1165,7 @@ _ZH = {
|
||||
"term_connecting": "正在连接 {alias}...",
|
||||
"term_connected": "已连接到 {alias}",
|
||||
"term_disconnected": "已断开",
|
||||
"term_off": "未连接",
|
||||
"ctx_disconnect": "断开连接",
|
||||
"term_click_to_connect": "双击连接 {alias}",
|
||||
"sftp_click_to_connect": "双击服务器浏览文件",
|
||||
|
||||
@@ -250,7 +250,9 @@ class App(ctk.CTk):
|
||||
|
||||
# Create new tabview
|
||||
self.tabview = ctk.CTkTabview(self._main_frame, command=self._on_tab_changed)
|
||||
self.tabview.pack(fill="both", expand=True, padx=10, pady=10)
|
||||
self.tabview._outer_spacing = 0
|
||||
self.tabview._configure_grid()
|
||||
self.tabview.pack(fill="both", expand=True, padx=10, pady=(0, 10))
|
||||
|
||||
for key in self._tab_keys:
|
||||
self.tabview.add(_tab_label(key))
|
||||
|
||||
@@ -32,13 +32,14 @@ class TerminalTab(ctk.CTkFrame):
|
||||
self._toolbar = ctk.CTkFrame(self, fg_color="transparent", height=32)
|
||||
self._toolbar.pack(fill="x", padx=5, pady=(5, 0))
|
||||
self._toolbar.pack_propagate(False)
|
||||
self._disconnect_btn = ctk.CTkButton(
|
||||
self._toolbar, text=t("ctx_disconnect"), width=110, height=28,
|
||||
fg_color="#dc2626", hover_color="#b91c1c",
|
||||
self._conn_btn = ctk.CTkButton(
|
||||
self._toolbar, text=t("ctx_connect"), width=120, height=28,
|
||||
fg_color="#6b7280", hover_color="#4b5563",
|
||||
font=ctk.CTkFont(size=12), state="disabled",
|
||||
command=self._on_disconnect_click,
|
||||
command=self._on_conn_btn_click,
|
||||
)
|
||||
self._disconnect_btn.pack(side="right", padx=2)
|
||||
self._conn_btn.pack(side="right", padx=2)
|
||||
self._connected = False
|
||||
|
||||
self._terminal = TerminalWidget(
|
||||
self,
|
||||
@@ -48,6 +49,15 @@ class TerminalTab(ctk.CTkFrame):
|
||||
on_font_size_changed=self._on_font_size_changed,
|
||||
)
|
||||
self._terminal.pack(fill="both", expand=True, padx=5, pady=5)
|
||||
|
||||
# Overlay "OFF" label (shown when disconnected)
|
||||
self._overlay = ctk.CTkLabel(
|
||||
self._terminal, text=t("term_off"),
|
||||
font=ctk.CTkFont(size=72, weight="bold"),
|
||||
text_color=("#cccccc", "#333333"),
|
||||
fg_color="transparent",
|
||||
)
|
||||
self._overlay.place(relx=0.5, rely=0.45, anchor="center")
|
||||
self._terminal.set_status(t("term_disconnected"), "#888888")
|
||||
|
||||
# Thread-safe data queue
|
||||
@@ -73,9 +83,12 @@ class TerminalTab(ctk.CTkFrame):
|
||||
|
||||
self._current_alias = alias
|
||||
if alias:
|
||||
self._disconnect_btn.configure(state="disabled")
|
||||
self._set_conn_btn_disconnected()
|
||||
self._conn_btn.configure(state="normal")
|
||||
self._terminal.set_status(t("term_click_to_connect").format(alias=alias), "#f59e0b")
|
||||
else:
|
||||
self._set_conn_btn_disconnected()
|
||||
self._conn_btn.configure(state="disabled")
|
||||
self._terminal.reset()
|
||||
self._terminal.set_status(t("term_disconnected"), "#888888")
|
||||
|
||||
@@ -84,14 +97,31 @@ class TerminalTab(ctk.CTkFrame):
|
||||
if self._current_alias and not self._session:
|
||||
self._connect()
|
||||
|
||||
def _on_disconnect_click(self):
|
||||
if self._on_disconnect_callback and self._current_alias:
|
||||
self._on_disconnect_callback(self._current_alias)
|
||||
def _on_conn_btn_click(self):
|
||||
if self._connected:
|
||||
if self._on_disconnect_callback and self._current_alias:
|
||||
self._on_disconnect_callback(self._current_alias)
|
||||
else:
|
||||
self.connect()
|
||||
|
||||
def _set_conn_btn_connected(self):
|
||||
self._connected = True
|
||||
self._conn_btn.configure(
|
||||
text=t("ctx_disconnect"), fg_color="#dc2626", hover_color="#b91c1c", state="normal",
|
||||
)
|
||||
self._overlay.place_forget()
|
||||
|
||||
def _set_conn_btn_disconnected(self):
|
||||
self._connected = False
|
||||
self._conn_btn.configure(
|
||||
text=t("ctx_connect"), fg_color="#6b7280", hover_color="#4b5563",
|
||||
)
|
||||
self._overlay.place(relx=0.5, rely=0.45, anchor="center")
|
||||
|
||||
def disconnect(self):
|
||||
"""Disconnect and update UI (called by app)."""
|
||||
self._disconnect()
|
||||
self._disconnect_btn.configure(state="disabled")
|
||||
self._set_conn_btn_disconnected()
|
||||
if self._current_alias:
|
||||
self._terminal.set_status(t("term_click_to_connect").format(alias=self._current_alias), "#f59e0b")
|
||||
|
||||
@@ -164,7 +194,7 @@ class TerminalTab(ctk.CTkFrame):
|
||||
# Only grab focus if terminal tab is currently visible
|
||||
if self._terminal.winfo_ismapped():
|
||||
self._terminal.focus_terminal()
|
||||
self._disconnect_btn.configure(state="normal")
|
||||
self._set_conn_btn_connected()
|
||||
self.after(0, _set_session)
|
||||
except Exception as e:
|
||||
self.after(0, lambda: self._terminal.set_status(
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
"""Version info for ServerManager."""
|
||||
|
||||
__version__ = "1.9.27"
|
||||
__version__ = "1.9.35"
|
||||
__app_name__ = "ServerManager"
|
||||
__author__ = "aibot777"
|
||||
__description__ = "Desktop GUI for managing remote servers"
|
||||
|
||||
Reference in New Issue
Block a user