How to use the pibooth.utils.LOGGER.debug function in pibooth

To help you get started, we’ve selected a few pibooth examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github werdeil / pibooth / pibooth / booth.py View on Github external
def _on_button_printer_held(self):
        """Called when the printer button is pressed.
        """
        if all(self.buttons.value):
            # printer was held while capture was pressed
            # but don't do anything here, let capture_held handle it instead
            pass
        else:
            # printer was held but capture not pressed
            if self._menu and self._menu.is_shown():
                # Convert HW button events to keyboard events for menu
                event = self._menu.create_click_event()
                LOGGER.debug("BUTTONDOWN: generate MENU-APPLY event")
            else:
                event = pygame.event.Event(BUTTONDOWN, capture=0, printer=1,
                                           button=self.buttons.printer)
                LOGGER.debug("BUTTONDOWN: generate PRINTER event")
            pygame.event.post(event)
github werdeil / pibooth / pibooth / controls / gpio.py View on Github external
def cleanup(self):
        LOGGER.debug("GPIO Mock: quit")
github werdeil / pibooth / pibooth / camera / gphoto.py View on Github external
def set_config_value(self, section, option, value):
        """Set camera configuration. This method don't send the updated
        configuration to the camera (avoid connection flooding if several
        values have to be changed)
        """
        try:
            LOGGER.debug('Setting option %s/%s=%s', section, option, value)
            config = self._cam.get_config()
            child = config.get_child_by_name(section).get_child_by_name(option)
            if child.get_type() == gp.GP_WIDGET_RADIO:
                choices = [c for c in child.get_choices()]
            else:
                choices = None
            data_type = type(child.get_value())
            value = data_type(value)  # Cast value
            if choices and value not in choices:
                LOGGER.warning(
                    "Invalid value '%s' for option %s (possible choices: %s), trying to set it anyway", value, option, choices)
            child.set_value(value)
            self._cam.set_config(config)
        except gp.GPhoto2Error as ex:
            LOGGER.error('Unsupported option %s/%s=%s (%s), configure your DSLR manually', section, option, value, ex)
github werdeil / pibooth / pibooth / controls / camera.py View on Github external
def gp_set_config_value(config, section, option, value):
    """Set camera configuration. This method don't send the updated
    configuration to the camera (avoid connection flooding if several
    values have to be changed)
    """
    try:
        value = GP_PARAMS.get(PiConfigParser.language, GP_PARAMS['en']).get(value, value)
        LOGGER.debug('Setting option %s/%s=%s', section, option, value)
        child = config.get_child_by_name(section).get_child_by_name(option)
        choices = [c for c in child.get_choices()]
        if value not in choices:
            LOGGER.warning(
                "Invalid value '%s' for option %s (possible choices: %s), still trying to set it", value, option, choices)
            child.set_value(str(value))
        else:
            child.set_value(str(value))
    except gp.GPhoto2Error:
        raise ValueError('Unsupported setting {}/{}={}'.format(section, option, value))
github werdeil / pibooth / pibooth / controls / __init__.py View on Github external
# -*- coding: utf-8 -*-

from pibooth.utils import LOGGER
from gpiozero import Device, LEDBoard
try:
    from RPi import GPIO
    LOGGER.debug("Start on Raspberry pi")
except ImportError:
    # GPIO library only existes on Raspberry Pi
    # Set the default pin factory to a mock factory
    from gpiozero.pins.mock import MockFactory
    Device.pin_factory = MockFactory()
    LOGGER.debug("Programme not start on Raspberry pi use MockFactory() mode")
github werdeil / pibooth / pibooth / controls / button.py View on Github external
def on_button_down(self, pin):
        """Post a pygame event when the button is pressed.
        """
        LOGGER.debug('Hardware button (pin %s) triggered', pin)
        event = pygame.event.Event(BUTTON_DOWN, pin=pin)
        pygame.event.post(event)
github werdeil / pibooth / pibooth / language.py View on Github external
fp.write("\n\n")

    PARSER.read(PARSER.filename, encoding='utf-8')

    # Update the current file with missing language(s) and key(s)
    changed = False
    for section, options in DEFAULT.items():
        if not PARSER.has_section(section):
            changed = True
            LOGGER.debug("Add [%s] to available language list", section)
            PARSER.add_section(section)

        for option, value in options.items():
            if not PARSER.has_option(section, option):
                changed = True
                LOGGER.debug("Add [%s][%s] to available translations", section, option)
                PARSER.set(section, option, value)

    if changed:
        with io.open(PARSER.filename, 'w', encoding="utf-8") as fp:
            PARSER.write(fp)
github werdeil / pibooth / pibooth / controls / gpio.py View on Github external
def setup(self, pin, direction, **kwargs):
        LOGGER.debug("GPIO Mock: setup pin %s to %s", pin, direction)