mirror of
https://github.com/boltgolt/howdy.git
synced 2024-09-19 09:51:19 +02:00
commit
aaaabae394
1 changed files with 23 additions and 20 deletions
|
@ -68,12 +68,22 @@ class OnboardingWindow(gtk.Window):
|
||||||
eventbox = self.builder.get_object("downloadeventbox")
|
eventbox = self.builder.get_object("downloadeventbox")
|
||||||
eventbox.modify_bg(gtk.StateType.NORMAL, gdk.Color(red=0, green=0, blue=0))
|
eventbox.modify_bg(gtk.StateType.NORMAL, gdk.Color(red=0, green=0, blue=0))
|
||||||
|
|
||||||
if os.path.exists("/lib/security/howdy/dlib-data/shape_predictor_5_face_landmarks.dat"):
|
for lib_site in ("/lib", "/usr/lib", "/lib64", "/usr/lib64"):
|
||||||
|
if os.path.exists(lib_site + "/security/howdy/"):
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
lib_site = None
|
||||||
|
|
||||||
|
if lib_site is None:
|
||||||
|
self.downloadoutputlabel.set_text(_("Unable to find Howdy's installation location"))
|
||||||
|
return
|
||||||
|
|
||||||
|
if os.path.exists(lib_site + "/security/howdy/dlib-data/shape_predictor_5_face_landmarks.dat"):
|
||||||
self.downloadoutputlabel.set_text(_("Datafiles have already been downloaded!\nClick Next to continue"))
|
self.downloadoutputlabel.set_text(_("Datafiles have already been downloaded!\nClick Next to continue"))
|
||||||
self.enable_next()
|
self.enable_next()
|
||||||
return
|
return
|
||||||
|
|
||||||
self.proc = subprocess.Popen("./install.sh", stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True, cwd="/lib/security/howdy/dlib-data")
|
self.proc = subprocess.Popen("./install.sh", stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True, cwd=lib_site + "/security/howdy/dlib-data")
|
||||||
|
|
||||||
self.download_lines = []
|
self.download_lines = []
|
||||||
self.read_download_line()
|
self.read_download_line()
|
||||||
|
@ -138,28 +148,21 @@ class OnboardingWindow(gtk.Window):
|
||||||
if re_name:
|
if re_name:
|
||||||
device_name = re_name.group(1)
|
device_name = re_name.group(1)
|
||||||
|
|
||||||
|
capture = cv2.VideoCapture(device_path)
|
||||||
|
is_open, frame = capture.read()
|
||||||
|
if not is_open:
|
||||||
|
device_rows.append([device_name, device_path, -9, _("No, not an infrared camera")])
|
||||||
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
capture = cv2.VideoCapture(device_path)
|
if not is_gray(frame):
|
||||||
capture.grab()
|
raise Exception()
|
||||||
ret, frame = capture.read()
|
|
||||||
except Exception:
|
except Exception:
|
||||||
device_rows.append([device_name, device_path, -9, _("No, camera can't be opened")])
|
device_rows.append([device_name, device_path, -5, _("No, camera can't be opened")])
|
||||||
continue
|
capture.release()
|
||||||
|
|
||||||
if not is_gray(frame):
|
|
||||||
device_rows.append([device_name, device_path, -5, _("No, not an infrared camera")])
|
|
||||||
continue
|
|
||||||
|
|
||||||
time.sleep(.2)
|
|
||||||
|
|
||||||
ret, frame = capture.read()
|
|
||||||
|
|
||||||
if not is_gray(frame):
|
|
||||||
device_rows.append([device_name, device_path, -5, _("No, not an infrared camera")])
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
device_rows.append([device_name, device_path, 5, _("Yes, compatible infrared camera")])
|
device_rows.append([device_name, device_path, 5, _("Yes, compatible infrared camera")])
|
||||||
|
|
||||||
capture.release()
|
capture.release()
|
||||||
|
|
||||||
device_rows = sorted(device_rows, key=lambda k: -k[2])
|
device_rows = sorted(device_rows, key=lambda k: -k[2])
|
||||||
|
@ -189,8 +192,8 @@ class OnboardingWindow(gtk.Window):
|
||||||
self.treeview.set_model(self.listmodel)
|
self.treeview.set_model(self.listmodel)
|
||||||
self.treeview.set_cursor(0)
|
self.treeview.set_cursor(0)
|
||||||
|
|
||||||
self.loadinglabel.hide()
|
|
||||||
self.treeview.show()
|
self.treeview.show()
|
||||||
|
self.loadinglabel.hide()
|
||||||
self.enable_next()
|
self.enable_next()
|
||||||
|
|
||||||
def execute_slide3(self):
|
def execute_slide3(self):
|
||||||
|
|
Loading…
Reference in a new issue