Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def preview_wait(self, timeout, alpha=60):
"""Wait the given time.
"""
time.sleep(timeout)
self._show_overlay(get_translated_text('smile'), alpha)
def preview_wait(self, timeout, alpha=80):
"""Wait the given time.
"""
timeout = int(timeout)
if timeout < 1:
raise ValueError("Start time shall be greater than 0")
timer = PoolingTimer(timeout)
while not timer.is_timeout():
updated_rect = self._window.show_image(self._get_preview_image())
pygame.event.pump()
if updated_rect:
pygame.display.update(updated_rect)
self._show_overlay(get_translated_text('smile'), alpha)
self._window.show_image(self._get_preview_image())
def preview_wait(self, timeout, alpha=60):
"""Wait the given time.
"""
time.sleep(timeout)
self._show_overlay(get_translated_text('smile'), alpha)
updated_rect = None
if self._preview_compatible:
updated_rect = self._window.show_image(self._get_preview_image())
elif not shown:
updated_rect = self._window.show_image(self._get_preview_image())
shown = True # Do not update dummy preview until next overlay update
if first_loop:
timer.start() # Because first preview capture is longer than others
first_loop = False
pygame.event.pump()
if updated_rect:
pygame.display.update(updated_rect)
self._show_overlay(get_translated_text('smile'), alpha)
self._window.show_image(self._get_preview_image())
def resize_texts(self, rect=None, align='center'):
"""Update text surfaces.
"""
self._texts = []
text = get_translated_text(self._name)
if text:
self._write_text(text, rect, align)
"""Show a countdown of `timeout` seconds on the preview.
Returns when the countdown is finished.
"""
timeout = int(timeout)
if timeout < 1:
raise ValueError("Start time shall be greater than 0")
if not self._cam.preview:
raise EnvironmentError("Preview shall be started first")
while timeout > 0:
self._show_overlay(timeout, alpha)
time.sleep(1)
timeout -= 1
self._hide_overlay()
self._show_overlay(get_translated_text('smile'), alpha)
"""
timeout = int(timeout)
if timeout < 1:
raise ValueError("Start time shall be greater than 0")
timer = PoolingTimer(timeout)
if self._preview_compatible:
while not timer.is_timeout():
updated_rect = self._window.show_image(self._get_preview_image())
pygame.event.pump()
if updated_rect:
pygame.display.update(updated_rect)
else:
time.sleep(timer.remaining())
self._show_overlay(get_translated_text('smile'), alpha)
self._window.show_image(self._get_preview_image())