import gphoto2 as gp # def list_config(widget, indent=0): # name = widget.get_name() # label = widget.get_label() # type_name = widget.get_type() # choices = widget.get_choices() # if choices: # choices_str = ", ".join(choices) # print(" " * indent + f"{name} ({label}) type={type_name} choices=[{choices_str}]") # else: # print(" " * indent + f"{name} ({label}) type={type_name}") # for i in range(widget.count_children()): # child = widget.get_child(i) # list_config(child, indent + 1) def list_config(widget, indent=0): name = widget.get_name() label = widget.get_label() type_name = widget.get_type() line = " " * indent + f"{name} ({label}) type={type_name}" # tylko jeśli widget obsługuje choices try: choices = widget.get_choices() if choices: choices_str = ", ".join(str(c) for c in choices) line += f" choices=[{choices_str}]" except gp.GPhoto2Error: # brak choices -> ignorujemy pass print(line) # rekurencja dla dzieci for i in range(widget.count_children()): child = widget.get_child(i) list_config(child, indent + 1) camera = gp.Camera() camera.init() config = camera.get_config() list_config(config) camera.exit()