qr timeout - cancel in IDLE mode
This commit is contained in:
parent
11701f58b8
commit
0a2770351d
22
Fotobox.py
22
Fotobox.py
@ -97,16 +97,16 @@ class Fotobox:
|
||||
camera.hflip = True
|
||||
camera.resolution = (2592, 1944)
|
||||
camera.rotation = 270
|
||||
|
||||
|
||||
camera.preview_configuration.main.size = res
|
||||
camera.preview_configuration.main.format = 'BGR888'
|
||||
camera.configure("preview")
|
||||
|
||||
|
||||
self._capture_config = camera.create_still_configuration()
|
||||
camera.still_configuration.main.size = (2592, 1944)
|
||||
|
||||
|
||||
camera.start()
|
||||
|
||||
|
||||
self._camera = camera
|
||||
self._running: bool = True
|
||||
self._state: State = State.IDLE
|
||||
@ -144,16 +144,16 @@ class Fotobox:
|
||||
|
||||
def _shooting_callback(self):
|
||||
print("SHOT: %d/%d" % (self._shooting_timer.current(), SHOOTING_COUNT))
|
||||
|
||||
|
||||
screen.fill((255, 255, 255))
|
||||
pygame.display.flip()
|
||||
if not DEBUG:
|
||||
time.sleep(0.5)
|
||||
|
||||
|
||||
frame = self._camera.switch_mode_and_capture_array(self._capture_config, "main")
|
||||
image = Image.fromarray(frame)
|
||||
self._photos.append(Photo(self._shooting_timer.current(), image))
|
||||
|
||||
|
||||
screen.fill((0, 0, 0))
|
||||
pygame.display.flip()
|
||||
|
||||
@ -268,7 +268,7 @@ class Fotobox:
|
||||
screen.blit(PRINT_SURFACE, PRINT_RECT)
|
||||
screen.blit(DONE_SURFACE, DONE_RECT)
|
||||
pygame.display.flip()
|
||||
|
||||
|
||||
def _draw_live_frame(self):
|
||||
array = self._camera.capture_array()
|
||||
img = pygame.image.frombuffer(array.data, res, 'RGB')
|
||||
@ -277,7 +277,9 @@ class Fotobox:
|
||||
def _set_state(self, new_state: State):
|
||||
print(new_state)
|
||||
self._state = new_state
|
||||
if new_state == State.COUNTDOWN:
|
||||
if new_state == State.IDLE:
|
||||
self._qr_timer.cancel()
|
||||
elif new_state == State.COUNTDOWN:
|
||||
led_border(True)
|
||||
self._countdown_timer.restart()
|
||||
elif new_state == State.SHOOTING:
|
||||
@ -349,5 +351,5 @@ class Fotobox:
|
||||
os.link(path, upload)
|
||||
os.chmod(upload, 0o777)
|
||||
print("Photo saved: %s" % path.absolute())
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user