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

Class HostList

src/ui/host_list.py:15–730  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13
14@Gtk.Template(resource_path="/io/github/BuddySirJava/SSH-Studio/ui/host_list.ui")
15class HostList(Gtk.Box):
16
17 __gtype_name__ = "HostList"
18
19 list_box = Gtk.Template.Child()
20 host_stack = Gtk.Template.Child()
21 empty_page = Gtk.Template.Child()
22 add_bottom_button = Gtk.Template.Child()
23 search_button = Gtk.Template.Child()
24 undo_button = Gtk.Template.Child()
25 search_bar = Gtk.Template.Child()
26 search_entry = Gtk.Template.Child()
27
28 __gsignals__ = {
29 "host-selected": (GObject.SignalFlags.RUN_LAST, None, (object,)),
30 "host-added": (GObject.SignalFlags.RUN_LAST, None, (object,)),
31 "host-deleted": (GObject.SignalFlags.RUN_LAST, None, (object,)),
32 "hosts-reordered": (GObject.SignalFlags.RUN_LAST, None, (object,)),
33 "undo-clicked": (GObject.SignalFlags.RUN_LAST, None, ()),
34 }
35
36 def __init__(self):
37 super().__init__()
38
39 self.hosts = []
40 self.filtered_hosts = []
41 self.current_filter = ""
42 self._selected_host = None
43 self._dragging_host = None
44 self._order_before_drag = None
45 self._dnd_hover_row = None
46
47 self._connect_signals()
48
49 self.list_store = Gtk.ListStore(str, str, str, str, str, object)
50 if hasattr(self, "tree_view") and self.tree_view is not None:
51 self.tree_view.set_model(self.list_store)
52 self._setup_columns()
53 self._rebuild_listbox_rows()
54
55 self._update_bottom_toolbar_sensitivity()
56
57 def _setup_columns(self):
58 def add_text_column(
59 title: str,
60 col_index: int,
61 expand: bool = False,
62 min_width: int | None = None,
63 ):
64 renderer = Gtk.CellRendererText()
65 renderer.set_property("ypad", 6)
66 renderer.set_property("xpad", 8)
67 column = Gtk.TreeViewColumn(title, renderer, text=col_index)
68 if expand:
69 column.set_expand(True)
70 if min_width is not None:
71 column.set_min_width(min_width)
72 self.tree_view.append_column(column)

Callers 1

_setup_split_viewMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected