From 0e4aaa0c47ed0a90831fc071ced6de890128c29c Mon Sep 17 00:00:00 2001 From: EmixamPP Date: Sat, 30 Oct 2021 13:57:16 +0200 Subject: [PATCH 1/3] many lib dir --- howdy-gtk/src/onboarding.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/howdy-gtk/src/onboarding.py b/howdy-gtk/src/onboarding.py index affa4fa..124a663 100644 --- a/howdy-gtk/src/onboarding.py +++ b/howdy-gtk/src/onboarding.py @@ -68,12 +68,22 @@ class OnboardingWindow(gtk.Window): eventbox = self.builder.get_object("downloadeventbox") 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.enable_next() 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.read_download_line() From 2e2c1ac1969e65c6ca992bb43e7233c2733d8d38 Mon Sep 17 00:00:00 2001 From: EmixamPP Date: Sat, 30 Oct 2021 13:58:36 +0200 Subject: [PATCH 2/3] check camera opening (fix is_gray(None)) --- howdy-gtk/src/onboarding.py | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/howdy-gtk/src/onboarding.py b/howdy-gtk/src/onboarding.py index 124a663..301ea09 100644 --- a/howdy-gtk/src/onboarding.py +++ b/howdy-gtk/src/onboarding.py @@ -148,28 +148,21 @@ class OnboardingWindow(gtk.Window): if re_name: 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: - capture = cv2.VideoCapture(device_path) - capture.grab() - ret, frame = capture.read() + if not is_gray(frame): + raise Exception() except Exception: - device_rows.append([device_name, device_path, -9, _("No, camera can't be opened")]) - continue - - 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")]) + device_rows.append([device_name, device_path, -5, _("No, camera can't be opened")]) + capture.release() continue device_rows.append([device_name, device_path, 5, _("Yes, compatible infrared camera")]) - capture.release() device_rows = sorted(device_rows, key=lambda k: -k[2]) From 4f7c65615c4043df2245bd49162fef0e163f7bad Mon Sep 17 00:00:00 2001 From: EmixamPP Date: Sat, 30 Oct 2021 14:00:50 +0200 Subject: [PATCH 3/3] fix camera list not always displayed (gi bug) --- howdy-gtk/src/onboarding.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/howdy-gtk/src/onboarding.py b/howdy-gtk/src/onboarding.py index 301ea09..e97cf27 100644 --- a/howdy-gtk/src/onboarding.py +++ b/howdy-gtk/src/onboarding.py @@ -192,8 +192,8 @@ class OnboardingWindow(gtk.Window): self.treeview.set_model(self.listmodel) self.treeview.set_cursor(0) - self.loadinglabel.hide() self.treeview.show() + self.loadinglabel.hide() self.enable_next() def execute_slide3(self):