v1.9.27: add disconnect button in terminal + disconnect in context menu

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
chrome-storm-c442
2026-03-06 05:27:03 -05:00
parent 7522908404
commit 064de8df8d
10 changed files with 78 additions and 2 deletions

View File

@@ -163,6 +163,7 @@ class App(ctk.CTk):
self.sidebar.open_tab_callback = self._context_open_tab
self.sidebar.check_status_callback = self._context_check_status
self.sidebar.open_browser_callback = self._context_open_browser
self.sidebar.disconnect_callback = self._on_server_disconnect
# Main area
self._main_frame = ctk.CTkFrame(self._paned, fg_color="transparent")
@@ -264,6 +265,11 @@ class App(ctk.CTk):
widget.pack(fill="both", expand=True)
self._tab_instances[key] = widget
# Wire disconnect callback for terminal toolbar button
terminal = self._tab_instances.get("terminal")
if terminal and hasattr(terminal, "_on_disconnect_callback"):
terminal._on_disconnect_callback = self._on_server_disconnect
# Restore previously active tab if still available
if restore_tab_key and restore_tab_key in self._tab_keys:
try:
@@ -313,6 +319,14 @@ class App(ctk.CTk):
if hasattr(widget, "connect"):
widget.connect()
def _on_server_disconnect(self, alias: str):
"""Disconnect all sessions for a server."""
for key, widget in self._tab_instances.items():
if hasattr(widget, "disconnect"):
widget.disconnect()
self.session_pool.disconnect_session(alias)
self.after(500, self.sidebar.update_session_indicators)
def _add_server(self):
dialog = ServerDialog(self, self.store)
self.wait_window(dialog)