eculocate

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

commit b7da1ba2f5615f3127adc498c55ea101c3a3fe49
parent be599129baafc4e86576fc56ae5f977816e3124a
Author: Daniel Barlow <dan@telent.net>
Date:   Fri, 27 Feb 2026 20:56:05 +0000

hook up start button to start/stop recording

Diffstat:
Mclient/eculocate-gtk | 60+++++++++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 47 insertions(+), 13 deletions(-)

diff --git a/client/eculocate-gtk b/client/eculocate-gtk @@ -3,6 +3,9 @@ import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk +import threading +import time + import eculocate from nacl.signing import SigningKey @@ -18,40 +21,71 @@ class MyWindow(Gtk.Window): self.hosts_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) main.add(self.hosts_box) - status = Gtk.Label(label = "initializing") - main.add(status) + self.status = Gtk.Label(label = "initializing") + main.add(self.status) - start = Gtk.Button(label="Start") - start.connect("clicked", self.on_button_clicked) + start = Gtk.ToggleButton(label="Start") main.add(start) + self.start_button = start self.add(main) - 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 update_host(self, name): + if name in self.host_buttons: + print(f"already seen {name}") + else: + group = self.hosts_box.get_children() + print(f"group {group}") + if group: + n = Gtk.RadioButton.new_with_label_from_widget(group[0], name) + else: + n = Gtk.RadioButton.new_with_label(None, name) + n.set_mode(False) + n.connect("clicked", self.choose_service, name) + print(f"service {n}") + self.host_buttons[name] = n + self.hosts_box.add(n) + self.hosts_box.show_all() + + def choose_service(self, e, name): + print(f"clikec {name}") + self.selected_service_name = name def __init__(self): super().__init__(title="Eculocate") + self.host_buttons = {} self.widgets() - - def on_button_clicked(self, widget): - print("Hello World") + self.selected_service_name = None + self.update_host("othher.host.local") class GtkClient(eculocate.Client): def __init__(self, signing_key, window): super().__init__(signing_key) print("hre") self.window = window + window.start_button.connect("clicked", self.on_start_button_clicked) + + def on_start_button_clicked(self, widget): + print("Hello World") + if self.window.selected_service_name: + self.select_service_name(self.window.selected_service_name) + print(f"toggle record for {self.selected_service_name}") + if self.started: + self.stop_recording() + widget.set_label("start") + else: + self.start_recording() + widget.set_label("stop") def on_services_changed(self): for name, service in self.host_addresses.items(): - self.window.add_host(name) + print(f"updating {name}") + self.window.update_host(name) if __name__ == '__main__': import pprint + + with open("../privkey.bin", "rb") as f: signing_key = SigningKey(f.read(), encoder=RawEncoder)