MCPcopy Create free account
hub / github.com/BuddySirJava/SSH-Studio / _show_undo_toast

Method _show_undo_toast

src/ui/main_window.py:127–146  ·  view source on GitHub ↗

Show a toast with an Undo action; executes on_undo when clicked.

(self, message: str, on_undo)

Source from the content-addressed store, hash-verified

125 pass
126
127 def _show_undo_toast(self, message: str, on_undo):
128 """Show a toast with an Undo action; executes on_undo when clicked."""
129 try:
130 toast = Adw.Toast.new(message)
131 if hasattr(toast, "set_button_label"):
132 try:
133 toast.set_button_label(_("Undo"))
134 except Exception:
135 pass
136 if hasattr(toast, "connect"):
137 try:
138 toast.connect("button-clicked", lambda t: on_undo())
139 except Exception:
140 pass
141 if hasattr(self, "toast_overlay") and self.toast_overlay is not None:
142 self.toast_overlay.add_toast(toast)
143 else:
144 self.show_toast(message)
145 except Exception:
146 self.show_toast(message)
147
148 def _setup_split_view(self):
149 """Set up the split view between host list and editor."""

Callers 2

_on_host_addedMethod · 0.95
_on_host_deletedMethod · 0.95

Calls 1

show_toastMethod · 0.95

Tested by

no test coverage detected