diff --git a/howdy-gtk/debian/howdy-gtk.links b/howdy-gtk/debian/howdy-gtk.links index 07963da..a5a7a74 100644 --- a/howdy-gtk/debian/howdy-gtk.links +++ b/howdy-gtk/debian/howdy-gtk.links @@ -1 +1 @@ -/usr/lib/howdy-gtk/authsticky.py /usr/bin/howdy-gtk-auth +/usr/lib/howdy-gtk/init.py /usr/bin/howdy-gtk diff --git a/howdy-gtk/src/authsticky.py b/howdy-gtk/src/authsticky.py old mode 100755 new mode 100644 index 4d36059..8c4d964 --- a/howdy-gtk/src/authsticky.py +++ b/howdy-gtk/src/authsticky.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 - # Shows a floating window when authenticating import cairo import gi @@ -72,8 +70,6 @@ class StickyWindow(gtk.Window): self.show_all() self.resize(windowWidth, windowHeight) - print("init") - # Add a timeout to catch input passed from compare.py gobject.timeout_add(100, self.catch_stdin) diff --git a/howdy-gtk/src/init.py b/howdy-gtk/src/init.py new file mode 100755 index 0000000..01a7bb3 --- /dev/null +++ b/howdy-gtk/src/init.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python3 +# Opens auth ui if requested, otherwise starts normal ui +import sys + +if "--start-auth-ui" in sys.argv: + import authsticky +else: + import window diff --git a/howdy-gtk/src/ui.glade b/howdy-gtk/src/ui.glade new file mode 100644 index 0000000..29df8f1 --- /dev/null +++ b/howdy-gtk/src/ui.glade @@ -0,0 +1,264 @@ + + + + + + False + Howdy Configuration + center + logo.png + + + True + True + + + True + True + vertical + + + True + False + 5 + 10 + + + True + False + center + 10 + Active user: + + + False + False + 0 + + + + + True + False + + + False + False + 1 + + + + + Add new model + True + True + True + 10 + 0.46000000834465027 + + + False + False + end + 2 + + + + + Add new user + True + True + True + bottom + + + False + False + end + 3 + + + + + False + True + + + + + True + False + vertical + + + True + False + 5 + + + False + True + 0 + + + + + True + True + + + + + + False + True + 1 + + + + + True + True + + + + + True + + + + + True + False + Models + + + 1 + False + + + + + True + False + vertical + + + True + False + label + + + False + True + 0 + + + + + + + + + + + 1 + + + + + True + False + Video + + + 1 + False + + + + + + + + + + + + + True + False + 10 + 10 + 5 + 5 + vertical + 5 + + + True + False + + + True + False + vertical + + + True + False + label + 3 + + + + + + False + True + 0 + + + + + True + False + label + + + False + True + 1 + + + + + False + True + 0 + + + + + Delete + True + True + True + True + + + False + True + end + 1 + + + + + False + True + 0 + + + + diff --git a/howdy-gtk/src/window.py b/howdy-gtk/src/window.py new file mode 100644 index 0000000..a6d780f --- /dev/null +++ b/howdy-gtk/src/window.py @@ -0,0 +1,80 @@ +# Opens and controls main ui window +import cairo +import gi +import signal +import sys +import os +import subprocess + +# Make sure we have the libs we need +gi.require_version("Gtk", "3.0") +gi.require_version("Gdk", "3.0") + +# Import them +from gi.repository import Gtk as gtk +from gi.repository import Gdk as gdk + + +class MainWindow(gtk.Window): + def __init__(self): + """Initialize the sticky window""" + # Make the class a GTK window + gtk.Window.__init__(self) + + self.connect("destroy", self.exit) + + self.builder = gtk.Builder() + self.builder.add_from_file("./ui.glade") + self.builder.connect_signals(self) + + self.window = self.builder.get_object("mainwindow") + self.userlist = self.builder.get_object("userlist") + self.modellistbox = self.builder.get_object("modellistbox") + + filelist = os.listdir("/lib/security/howdy/models") + self.active_user = "" + + for file in filelist: + self.userlist.append_text(file[:-4]) + + if not self.active_user: + self.active_user = file[:-4] + + self.userlist.set_active(0) + + self.load_model_list() + + self.window.show_all() + # self.resize(300, 300) + + # Start GTK main loop + gtk.main() + + def load_model_list(self): + output = subprocess.check_output(["howdy", "list", "-U", self.active_user]) + + lines = output.decode("utf-8") .split("\n")[3:-2] + print(lines) + + newrow = self.builder.get_object("modelrow") + + print(newrow.set_name("wat")) + + self.modellistbox.add(newrow) + newrow2 = self.builder.get_object("modelrow") + + # print(newrow.get_object("modelrowname")) + + self.modellistbox.add(newrow2) + + def exit(self, widget, context): + """Cleanly exit""" + gtk.main_quit() + sys.exit() + + +# Make sure we quit on a SIGINT +signal.signal(signal.SIGINT, signal.SIG_DFL) + +# Open the GTK window +window = MainWindow() diff --git a/src/compare.py b/src/compare.py index f766bde..770b75a 100644 --- a/src/compare.py +++ b/src/compare.py @@ -122,7 +122,7 @@ face_encoder = None # Start the auth ui try: - gtk_proc = subprocess.Popen(["python3", "-u", "../howdy-gtk/src/authsticky.py"], stdin=subprocess.PIPE, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + gtk_proc = subprocess.Popen(["howdy-gtk", "--start-auth-ui"], stdin=subprocess.PIPE, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) except FileNotFoundError as err: pass