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

Method select_host

src/ui/host_list.py:286–306  ·  view source on GitHub ↗
(self, host: SSHHost)

Source from the content-addressed store, hash-verified

284 return duplicated_host
285
286 def select_host(self, host: SSHHost):
287 for index, row in enumerate(self.list_store):
288 if row[5] == host:
289 if hasattr(self, "tree_view") and self.tree_view is not None:
290 tree_iter = self.list_store.iter_nth_child(None, index)
291 if tree_iter is None:
292 return
293 selection = self.tree_view.get_selection()
294 selection.select_iter(tree_iter)
295 path = self.list_store.get_path(tree_iter)
296 if path is not None:
297 self.tree_view.scroll_to_cell(path, None, False, 0, 0)
298 elif hasattr(self, "list_box") and self.list_box is not None:
299 row_widget = self.list_box.get_row_at_index(index)
300 if row_widget is not None:
301 self.list_box.select_row(row_widget)
302 try:
303 row_widget.grab_focus()
304 except Exception:
305 pass
306 break
307
308 def get_selected_host(self) -> SSHHost | None:
309 """Get the currently selected host."""

Callers 8

_refresh_viewMethod · 0.95
add_hostMethod · 0.95
duplicate_hostMethod · 0.95
navigate_with_keyMethod · 0.95
_on_listbox_dropMethod · 0.95
undo_deleteMethod · 0.80
_on_host_deletedMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected