0
0
Fork 0
mirror of https://github.com/boltgolt/howdy.git synced 2024-09-19 09:51:19 +02:00

Onboarding is done

This commit is contained in:
boltgolt 2021-01-08 16:02:38 +01:00
parent 9f4c1a7fe6
commit 181318d201
No known key found for this signature in database
GPG key ID: BECEC9937E1AAE26
3 changed files with 272 additions and 13 deletions

View file

@ -42,7 +42,7 @@
<property name="resize_mode">immediate</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="slide4">
<object class="GtkBox" id="slide5">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="orientation">vertical</property>
@ -72,7 +72,7 @@
<property name="margin_bottom">20</property>
<property name="label" translatable="yes">We're done! Howdy is now active on this computer. Try doing anything you would normally have to type your password for to authenticate, like running a command with sudo.
You can open the Howdy Configurator later on to change more advanced settings or add additional models. Press Finish below to close this window. </property>
You can open the Howdy Configurator later on to change more advanced settings or add additional models. Press Finish below to close this window and open the Howdy Configurator. </property>
<property name="justify">center</property>
<property name="wrap">True</property>
</object>
@ -89,6 +89,233 @@ You can open the Howdy Configurator later on to change more advanced settings or
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="slide4">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label11">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">20</property>
<property name="label" translatable="yes">Setting a certainty policy</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label12">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">10</property>
<property name="margin_right">10</property>
<property name="margin_top">10</property>
<property name="margin_bottom">40</property>
<property name="label" translatable="yes">Because of changes in angles, distance, and other factors a face match is never exactly the same as the stored face model. On this page you can set how strict Howdy should be.</property>
<property name="justify">center</property>
<property name="wrap">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">60</property>
<property name="margin_right">60</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkRadioButton" id="radiofast">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="margin_bottom">10</property>
<property name="xalign">0</property>
<property name="yalign">0.50999999046325684</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">radiobalanced</property>
<child>
<object class="GtkBox" id="box3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label13">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Fast</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label14">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Allows more fuzzy matches,
but speeds up the scanning process greatly.</property>
<property name="wrap">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="radiobalanced">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="margin_bottom">10</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<child>
<object class="GtkBox" id="box4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label15">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Balanced</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label16">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Still relatively quick detection,
but might not log you in when further away.</property>
<property name="wrap">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="radiosecure">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">radiobalanced</property>
<child>
<object class="GtkBox" id="box5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label17">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Secure</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label18">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">The slightly safer option,
but will take much longer to authenticate you</property>
<property name="wrap">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="slide3">
<property name="can_focus">False</property>
@ -171,7 +398,7 @@ You can open the Howdy Configurator later on to change more advanced settings or
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
<child>
@ -387,7 +614,7 @@ You can open the Howdy Configurator later on to change more advanced settings or
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">6</property>
<property name="position">5</property>
</packing>
</child>
<child>
@ -461,7 +688,7 @@ You can open the Howdy Configurator later on to change more advanced settings or
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">7</property>
<property name="position">8</property>
</packing>
</child>
</object>

View file

@ -15,7 +15,6 @@ from gi.repository import Pango as pango
class OnboardingWindow(gtk.Window):
def __init__(self):
"""Initialize the sticky window"""
print("create")
# Make the class a GTK window
gtk.Window.__init__(self)
@ -34,7 +33,8 @@ class OnboardingWindow(gtk.Window):
self.builder.get_object("slide1"),
self.builder.get_object("slide2"),
self.builder.get_object("slide3"),
self.builder.get_object("slide4")
self.builder.get_object("slide4"),
self.builder.get_object("slide5")
]
self.window.show_all()
@ -49,7 +49,6 @@ class OnboardingWindow(gtk.Window):
self.nextbutton.set_sensitive(False)
self.slides[self.window.current_slide].hide()
# self.window.current_slide += 1
self.slides[self.window.current_slide + 1].show()
self.window.current_slide += 1
@ -61,6 +60,8 @@ class OnboardingWindow(gtk.Window):
self.execute_slide3()
elif self.window.current_slide == 4:
self.execute_slide4()
elif self.window.current_slide == 5:
self.execute_slide5()
def execute_slide1(self):
self.downloadoutputlabel = self.builder.get_object("downloadoutputlabel")
@ -79,9 +80,11 @@ class OnboardingWindow(gtk.Window):
def read_download_line(self):
line = self.proc.stdout.readline()
print(line)
self.download_lines.append(line.decode("utf-8"))
print("install.sh output:")
print(line.decode("utf-8"))
if len(self.download_lines) > 10:
self.download_lines.pop(0)
@ -205,8 +208,8 @@ class OnboardingWindow(gtk.Window):
def on_scanbutton_click(self, button):
status = self.proc.wait(2)
if status != 0:
self.show_error(_("Error setting camera path"), _("Please set the camera path manually"))
# if status != 0:
# self.show_error(_("Error setting camera path"), _("Please set the camera path manually"))
self.dialog = gtk.MessageDialog(parent=self, flags=gtk.DialogFlags.MODAL)
self.dialog.set_title(_("Creating Model"))
@ -218,6 +221,8 @@ class OnboardingWindow(gtk.Window):
def run_add(self):
status, output = subprocess.getstatusoutput(["howdy add -y"])
print("howdy add output:")
print(output)
self.dialog.destroy()
@ -228,6 +233,28 @@ class OnboardingWindow(gtk.Window):
gobject.timeout_add(10, self.go_next_slide)
def execute_slide4(self):
self.enable_next()
def execute_slide5(self):
radio_buttons = self.builder.get_object("radiobalanced").get_group()
radio_selected = False
radio_certanty = 5.0
for button in radio_buttons:
if button.get_active():
radio_selected = gtk.Buildable.get_name(button)
if not radio_selected:
self.show_error(_("Error reading radio buttons"))
elif radio_selected == "radiofast":
radio_certanty = 4.2
elif radio_selected == "radiobalanced":
radio_certanty = 3.5
elif radio_selected == "radiosecure":
radio_certanty = 2.2
self.proc = subprocess.Popen("howdy set certainty " + str(radio_certanty), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
self.nextbutton.hide()
self.builder.get_object("cancelbutton").hide()
@ -235,6 +262,11 @@ class OnboardingWindow(gtk.Window):
finishbutton.show()
self.window.set_focus(finishbutton)
status = self.proc.wait(2)
if status != 0:
self.show_error(_("Error setting certainty"), _("Certainty is set to the default value, Howdy setup is complete"))
def enable_next(self):
self.nextbutton.set_sensitive(True)
self.window.set_focus(self.nextbutton)

View file

@ -112,8 +112,8 @@ signal.signal(signal.SIGINT, signal.SIG_DFL)
# Make sure we run as sudo
elevate.elevate()
# If no models have been created yet, start the onboarding
if os.path.exists("/lib/security/howdy/models"):
# If no models have been created yet or when it is forced, start the onboarding
if "--force-onboarding" in sys.argv or not os.path.exists("/lib/security/howdy/models"):
import onboarding
onboarding.OnboardingWindow()