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

Method get_selected_host

src/ui/host_list.py:308–319  ·  view source on GitHub ↗

Get the currently selected host.

(self)

Source from the content-addressed store, hash-verified

306 break
307
308 def get_selected_host(self) -> SSHHost | None:
309 """Get the currently selected host."""
310 if hasattr(self, "tree_view") and self.tree_view is not None:
311 selection = self.tree_view.get_selection()
312 model, tree_iter = selection.get_selected()
313 if tree_iter is not None:
314 return model[tree_iter][5]
315 elif hasattr(self, "list_box") and self.list_box is not None:
316 selected_row = self.list_box.get_selected_row()
317 if selected_row is not None and hasattr(selected_row, "_host_ref"):
318 return selected_row._host_ref
319 return None
320
321 def navigate_with_key(self, keyval, state):
322 """Handle keyboard navigation in the host list."""

Callers 3

_on_key_pressedMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected