diff --git a/howdy-gtk/src/main.glade b/howdy-gtk/src/main.glade index 7cb12e7..cab1959 100644 --- a/howdy-gtk/src/main.glade +++ b/howdy-gtk/src/main.glade @@ -355,14 +355,11 @@ - False + True True 1 - - - 1 diff --git a/howdy-gtk/src/onboarding.py b/howdy-gtk/src/onboarding.py index e6a4aa7..de72991 100644 --- a/howdy-gtk/src/onboarding.py +++ b/howdy-gtk/src/onboarding.py @@ -27,6 +27,7 @@ class OnboardingWindow(gtk.Window): self.builder.connect_signals(self) self.window = self.builder.get_object("onboardingwindow") + self.slidecontainer = self.builder.get_object("slidecontainer") self.nextbutton = self.builder.get_object("nextbutton") self.slides = [ @@ -53,6 +54,8 @@ class OnboardingWindow(gtk.Window): self.slides[self.window.current_slide].hide() self.slides[self.window.current_slide + 1].show() self.window.current_slide += 1 + # the shown child may have zero/wrong dimensions + self.slidecontainer.queue_resize() if self.window.current_slide == 1: self.execute_slide1() @@ -119,10 +122,10 @@ class OnboardingWindow(gtk.Window): except Exception: self.show_error(_("Error while importing OpenCV2"), _("Try reinstalling cv2")) - device_ids = os.listdir("/dev/v4l/by-path") device_rows = [] - - if not device_ids: + try: + device_ids = os.listdir("/dev/v4l/by-path") + except Exception: self.show_error(_("No webcams found on system"), _("Please configure your camera yourself if you are sure a compatible camera is connected")) # Loop though all devices diff --git a/howdy-gtk/src/tab_models.py b/howdy-gtk/src/tab_models.py index 01dcf21..9e5c315 100644 --- a/howdy-gtk/src/tab_models.py +++ b/howdy-gtk/src/tab_models.py @@ -44,6 +44,8 @@ def on_user_add(self, button): def on_model_add(self, button): + if self.userlist.items == 0: + return # Open question dialog dialog = gtk.MessageDialog(parent=self, flags=gtk.DialogFlags.MODAL, type=gtk.MessageType.QUESTION, buttons=gtk.ButtonsType.OK_CANCEL) dialog.set_title(_("Confirm Model Creation")) diff --git a/howdy-gtk/src/tab_video.py b/howdy-gtk/src/tab_video.py index 4f151b2..e194a15 100644 --- a/howdy-gtk/src/tab_video.py +++ b/howdy-gtk/src/tab_video.py @@ -14,7 +14,6 @@ MAX_WIDTH = 300 def on_page_switch(self, notebook, page, page_num): if page_num == 1: - path = "/dev/video1" try: self.config = configparser.ConfigParser() @@ -22,6 +21,8 @@ def on_page_switch(self, notebook, page, page_num): except Exception: print(_("Can't open camera")) + path = self.config.get("video", "device_path") + try: # if not self.cv2: import cv2 @@ -30,7 +31,7 @@ def on_page_switch(self, notebook, page, page_num): print(_("Can't import OpenCV2")) try: - self.capture = cv2.VideoCapture(self.config.get("video", "device_path")) + self.capture = cv2.VideoCapture(path) except Exception: print(_("Can't open camera")) diff --git a/howdy/src/autocomplete/howdy.in b/howdy/src/autocomplete/howdy.in index 38d4fed..778e528 100755 --- a/howdy/src/autocomplete/howdy.in +++ b/howdy/src/autocomplete/howdy.in @@ -5,7 +5,6 @@ _howdy() { local cur prev opts local config_path="@config_path@" - source _variables COMPREPLY=() # The argument typed so far cur="${COMP_WORDS[COMP_CWORD]}" diff --git a/howdy/src/cli.py b/howdy/src/cli.py index 78212cc..f923cb5 100755 --- a/howdy/src/cli.py +++ b/howdy/src/cli.py @@ -4,6 +4,7 @@ # Import required modules import sys import os +import pwd import getpass import argparse import builtins @@ -13,8 +14,10 @@ from i18n import _ # Try to get the original username (not "root") from shell sudo_user = os.environ.get("SUDO_USER") doas_user = os.environ.get("DOAS_USER") +pkexec_uid = os.environ.get("PKEXEC_UID") +pkexec_user = pwd.getpwuid(int(pkexec_uid))[0] if pkexec_uid else "" env_user = getpass.getuser() -user = next((u for u in [sudo_user, doas_user, env_user] if u), "") +user = next((u for u in [sudo_user, doas_user, pkexec_user, env_user] if u), "") # If that fails, error out if user == "":