eculocate

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 4081780bf6d1a3898864d45516b786739f0a1c7e
parent b8a381879e0016e7920cd4583ca9ed8ae291e986
Author: Daniel Barlow <dan@telent.net>
Date:   Fri, 27 Feb 2026 17:20:10 +0000

instantiate eculocate and show discovered services

Diffstat:
Mclient/eculocate-gtk | 56++++++++++++++++++++++++++++++++++++++++++++++----------
1 file changed, 46 insertions(+), 10 deletions(-)

diff --git a/client/eculocate-gtk b/client/eculocate-gtk @@ -5,22 +5,58 @@ gi.require_version("Gtk", "3.0") from gi.repository import Gtk import eculocate - +from nacl.signing import SigningKey +from nacl.encoding import RawEncoder class MyWindow(Gtk.Window): - def __init__(self): - super().__init__(title="Hello World") + def widgets(self): + main = Gtk.VBox() + + main.add(Gtk.Label(label = "Services")) + + self.hosts_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) + main.add(self.hosts_box) + + status = Gtk.Label(label = "initializing") + main.add(status) + + start = Gtk.Button(label="Start") + start.connect("clicked", self.on_button_clicked) + main.add(start) + self.add(main) - self.button = Gtk.Button(label="Click Here") - self.button.connect("clicked", self.on_button_clicked) - self.add(self.button) + def add_host(self, name): + n = Gtk.Button(label = name) + print(f"service {n}") + self.hosts_box.add(n) + self.hosts_box.show_all() + + def __init__(self): + super().__init__(title="Eculocate") + self.widgets() def on_button_clicked(self, widget): print("Hello World") +class GtkClient(eculocate.Client): + def __init__(self, signing_key, window): + super().__init__(signing_key) + print("hre") + self.window = window + + def on_services_changed(self): + for name, service in self.host_addresses.items(): + self.window.add_host(name) + + +if __name__ == '__main__': + import pprint + with open("../privkey.bin", "rb") as f: + signing_key = SigningKey(f.read(), encoder=RawEncoder) -win = MyWindow() -win.connect("destroy", Gtk.main_quit) -win.show_all() -Gtk.main() + win = MyWindow() + client = GtkClient(signing_key, win) + win.connect("destroy", Gtk.main_quit) + win.show_all() + Gtk.main()