mirror of
https://github.com/boltgolt/howdy.git
synced 2024-09-19 09:51:19 +02:00
Fix segfault when adding a model via howdy-gtk
On all test machines available to me (3), the "map" event was apparently fired before the "Please look directly into the camera" dialog was finally created. Therefore, the dialog was not displayed at all when scanning a face, and a segfault occurred when calling destroy(). Copied the code from onboarding.py, it works well there.
This commit is contained in:
parent
c5b17665d5
commit
05b8cb5b9e
1 changed files with 4 additions and 3 deletions
|
@ -3,6 +3,7 @@ import time
|
||||||
|
|
||||||
from i18n import _
|
from i18n import _
|
||||||
from gi.repository import Gtk as gtk
|
from gi.repository import Gtk as gtk
|
||||||
|
from gi.repository import GObject as gobject
|
||||||
|
|
||||||
|
|
||||||
def on_user_change(self, select):
|
def on_user_change(self, select):
|
||||||
|
@ -71,13 +72,13 @@ def on_model_add(self, button):
|
||||||
dialog = gtk.MessageDialog(parent=self, flags=gtk.DialogFlags.MODAL, buttons=gtk.ButtonsType.NONE)
|
dialog = gtk.MessageDialog(parent=self, flags=gtk.DialogFlags.MODAL, buttons=gtk.ButtonsType.NONE)
|
||||||
dialog.set_title(_("Creating Model"))
|
dialog.set_title(_("Creating Model"))
|
||||||
dialog.props.text = _("Please look directly into the camera")
|
dialog.props.text = _("Please look directly into the camera")
|
||||||
dialog.get_child().connect("map", lambda w: execute_add(self, dialog, entered_name, self.active_user))
|
|
||||||
dialog.show_all()
|
dialog.show_all()
|
||||||
|
|
||||||
|
# Wait a bit to allow the user to read the dialog
|
||||||
|
gobject.timeout_add(600, lambda: execute_add(self, dialog, entered_name))
|
||||||
|
|
||||||
def execute_add(box, dialog, entered_name, user):
|
|
||||||
|
|
||||||
time.sleep(1)
|
def execute_add(box, dialog, entered_name):
|
||||||
|
|
||||||
status, output = subprocess.getstatusoutput(["howdy add '" + entered_name + "' -y -U " + box.active_user])
|
status, output = subprocess.getstatusoutput(["howdy add '" + entered_name + "' -y -U " + box.active_user])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue