commit e512961a921390ca3bf4656b8eba7504679fbbc2
parent 207d44712301eb3ef2387ddd057dfe9e8c2cf636
Author: Daniel Barlow <dan@telent.net>
Date: Fri, 6 Mar 2026 19:45:19 +0000
support config file in eculocate-gtk
Diffstat:
1 file changed, 15 insertions(+), 18 deletions(-)
diff --git a/client/eculocate-gtk b/client/eculocate-gtk
@@ -5,12 +5,10 @@ gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GLib
import threading
import time
-
+import sys
+import os
import eculocate
-from nacl.signing import SigningKey
-from nacl.encoding import RawEncoder
-
class MyWindow(Gtk.Window):
def widgets(self):
@@ -85,21 +83,20 @@ class GtkClient(eculocate.Client):
if __name__ == '__main__':
import pprint
+ conf_file = os.getenv("ECULOCATE_CONFIG") or "/etc/eculocate.conf"
+ config = eculocate.Config(conf_file)
- with open("../privkey.bin", "rb") as f:
- signing_key = SigningKey(f.read(), encoder=RawEncoder)
-
- win = MyWindow()
- client = GtkClient(signing_key, win)
- win.connect("destroy", Gtk.main_quit)
- win.show_all()
+ win = MyWindow()
+ client = GtkClient(config, win)
+ win.connect("destroy", Gtk.main_quit)
+ win.show_all()
- def update_byte_counter():
- label = f"recorded {client.bytes_recorded} bytes" if client.started else "not recording"
- if win.status:
- win.status.set_text(label)
- return True
+ def update_byte_counter():
+ label = f"recorded {client.bytes_recorded} bytes" if client.started else "not recording"
+ if win.status:
+ win.status.set_text(label)
+ return True
- GLib.timeout_add_seconds(1, update_byte_counter)
+ GLib.timeout_add_seconds(1, update_byte_counter)
- Gtk.main()
+ Gtk.main()