Esempio n. 1
0
    def __init__(self, display_size, picture_basename, picture_size, pose_time,
                 display_time, trigger_channel, shutdown_channel, lamp_channel,
                 idle_slideshow, slideshow_display_time):
        self.display = GuiModule('Photobooth', display_size)
        self.pictures = PictureList(picture_basename)
        self.camera = CameraModule(picture_size)

        self.pic_size = picture_size
        self.pose_time = pose_time
        self.display_time = display_time

        self.trigger_channel = trigger_channel
        self.shutdown_channel = shutdown_channel
        self.lamp_channel = lamp_channel

        self.idle_slideshow = idle_slideshow
        if self.idle_slideshow:
            self.slideshow_display_time = slideshow_display_time
            self.slideshow = Slideshow(
                display_size, display_time,
                os.path.dirname(os.path.realpath(picture_basename)))

        input_channels = [trigger_channel, shutdown_channel]
        output_channels = [lamp_channel]
        self.gpio = GPIO(self.handle_gpio, input_channels, output_channels)
Esempio n. 2
0
 def __init__(self, display_size, display_time, directory, recursive=True):
     self.directory = directory
     self.recursive = recursive
     self.filelist = []
     self.display = GuiModule("Slideshow", display_size)
     self.display_time = display_time
     self.next = 0
Esempio n. 3
0
    def __init__(self, display_size, display_rotate, picture_basename,
                 picture_size, pose_time, display_time, trigger_channel,
                 shutdown_channel, lamp_channel, idle_slideshow,
                 slideshow_display_time):
        self.display = GuiModule('Photobooth', display_size)
        if (display_size == (0, 0)):  # Detect actual resolution
            display_size = self.display.get_size()
        self.display_rotate = display_rotate
        if (display_rotate):
            self.display.set_rotate(True)

        self.pictures = PictureList(picture_basename)
        self.camera = CameraModule((picture_size[0] / 2, picture_size[1] / 2),
                                   camera_rotate=camera_rotate)
        self.camera_rotate = camera_rotate

        self.pic_size = picture_size
        self.pose_time = pose_time
        self.display_time = display_time

        self.trigger_channel = trigger_channel
        self.shutdown_channel = shutdown_channel
        self.lamp_channel = lamp_channel

        self.idle_slideshow = idle_slideshow
        if self.idle_slideshow:
            self.slideshow_display_time = slideshow_display_time
            self.slideshow = Slideshow(
                display_size, display_time,
                os.path.dirname(os.path.realpath(picture_basename)))
            if (display_rotate):
                self.slideshow.display.set_rotate(True)

        input_channels = [trigger_channel, shutdown_channel]
        output_channels = [lamp_channel]
        self.gpio = GPIO(self.handle_gpio, input_channels, output_channels)

        self.printer_module = PrinterModule()
        try:
            pygame.mixer.init(buffer=1024)
            self.shutter = pygame.mixer.Sound(shutter_sound)
            self.bip1 = pygame.mixer.Sound(bip1_sound)
            self.bip2 = pygame.mixer.Sound(bip2_sound)
            self.bip2.play()
        except pygame.error:
            self.shutter = None
            pass
Esempio n. 4
0
    def __init__(self, display_size, display_rotate, picture_size, pose_time,
                 display_time, idle_slideshow, slideshow_display_time):
        self.display = GuiModule('Photobooth', display_size)
        if display_size == (0, 0):  # Detect actual resolution
            display_size = self.display.get_size()
        self.display_rotate = display_rotate
        if display_rotate:
            self.display.set_rotate(True)
        # Image basename
        picture_basename = datetime.now().strftime("%Y-%m-%d/pic")
        assembled_picture_basename = datetime.now().strftime(
            "%Y-%m-%d/assembled/pic")

        self.pictures = PictureList(picture_basename)
        self.assembled_pictures = PictureList(assembled_picture_basename)
        self.taking_picture = Lock()
        self.arduino = ArduinoSerial()
        self.camera = CameraModule((picture_size[0] / 2, picture_size[1] / 2),
                                   camera_rotate=camera_rotate)
        self.camera_rotate = camera_rotate

        self.picture_size = picture_size
        self.pose_time = pose_time
        self.display_time = display_time

        self.idle_slideshow = idle_slideshow
        if self.idle_slideshow:
            self.slideshow_display_time = slideshow_display_time
            self.slideshow = Slideshow(display_size,
                                       display_time,
                                       os.path.dirname(
                                           os.path.realpath(picture_basename)),
                                       recursive=False)
            if display_rotate:
                self.slideshow.display.set_rotate(True)

        self.printer_module = PrinterModule()
        try:
            pygame.mixer.init(buffer=1024)
            self.shutter = pygame.mixer.Sound(shutter_sound)
            self.bip1 = pygame.mixer.Sound(bip1_sound)
            self.bip2 = pygame.mixer.Sound(bip2_sound)
            self.bip2.play()
        except pygame.error:
            self.shutter = None
            pass
        self.arduino.start()
Esempio n. 5
0
    def __init__(self, display_size, picture_basename, picture_size, pose_time, display_time,
                 trigger_channel, shutdown_channel, lamp_channel):
        self.display      = GuiModule('Photobooth', display_size)
        self.pictures     = PictureList(picture_basename)
        self.camera       = CameraModule(picture_size)

        self.pic_size     = picture_size
        self.pose_time    = pose_time
        self.display_time = display_time

        self.trigger_channel  = trigger_channel
        self.shutdown_channel = shutdown_channel
        self.lamp_channel     = lamp_channel

        input_channels    = [ trigger_channel, shutdown_channel ]
        output_channels   = [ lamp_channel ]
        self.gpio         = GPIO(self.handle_gpio, input_channels, output_channels)
Esempio n. 6
0
def main():
    display = GuiModule('set-time', display_size, hide_mouse=False)

    for digit in range(len(date_digits)):
        display.clear()

        show_numpad(display, numpad, button_size)
        display.show_button('Date:', (400, 100), outline=(0, 0, 0))
        show_digits(display, date_digits, button_size)

        display.apply()

        digit_done = False
        while not digit_done:
            r, e = check_for_event()
            while r:
                digit_done = handle_event(e, digit, date_digits, numpad)
                r, e = check_for_event()

    for digit in range(len(time_digits)):
        display.clear()

        show_numpad(display, numpad, button_size)
        display.show_button('Time:', (400, 100), outline=(0, 0, 0))
        show_digits(display, time_digits, button_size)

        display.apply()

        digit_done = False
        while not digit_done:
            event = wait_for_event()
            digit_done = handle_event(event, digit, time_digits, numpad)

    # YYYY-MM-DD HH:mm
    date_str = (date_digits[4] + date_digits[5] + date_digits[6] + date_digits[7] + '-' +
                date_digits[2] + date_digits[3] + '-' +
                date_digits[0] + date_digits[1] + ' ' +
                time_digits[0] + time_digits[1] + ':' + time_digits[2] + time_digits[3])

    subprocess.check_call(['date', '-s', date_str])

    display.teardown()
    return 0
Esempio n. 7
0
    def __init__(self, display_size, picture_basename, picture_size, pose_time,
                 display_time, SWITCH, SHUTDOWN, POSE_LED, ON_LED,
                 idle_slideshow, slideshow_display_time):
        self.display = GuiModule('Photobooth', display_size)
        self.pictures = PictureList(picture_basename)
        self.camera = CameraModule(picture_size)

        self.pic_size = picture_size
        self.pose_time = pose_time
        self.display_time = display_time

        #  self.SWITCH       = SWITCH
        #  self.SHUTDOWN     = SHUTDWON
        #  self.POSE_LED     = POSE_LED
        #  self.ON_LED       = ON_LED

        self.idle_slideshow = idle_slideshow
        if self.idle_slideshow:
            self.slideshow_display_time = slideshow_display_time
            self.slideshow = Slideshow(
                display_size, display_time,
                os.path.dirname(os.path.realpath(picture_basename)))