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=80):
"""Wait the given time.
"""
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())
def __init__(self, plugin_manager):
self._pm = plugin_manager
self.factory_pool = PicturesFactoryPool()
self.picture_destroy_timer = PoolingTimer(0)
self.second_previous_picture = None
def preview_countdown(self, timeout, alpha=80):
"""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")
shown = False
first_loop = True
timer = PoolingTimer(timeout)
while not timer.is_timeout():
remaining = int(timer.remaining() + 1)
if not self._overlay or remaining != timeout:
# Rebluid overlay only if remaining number has changed
self._show_overlay(str(remaining), alpha)
timeout = remaining
shown = False
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:
def __init__(self, plugin_manager):
self._pm = plugin_manager
self.count = 0
# Seconds to display the failed message
self.failed_view_timer = PoolingTimer(2)
# Seconds between each animated frame
self.animated_frame_timer = PoolingTimer(0)
# Seconds before going back to the start
self.choose_timer = PoolingTimer(30)
# Seconds to display the selected layout
self.layout_timer = PoolingTimer(4)
# Seconds to display the selected layout
self.print_view_timer = PoolingTimer(0)
# Seconds to display the selected layout
self.finish_timer = PoolingTimer(0.5)
def preview_countdown(self, timeout, alpha=60):
"""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")
timer = PoolingTimer(timeout)
while not timer.is_timeout():
self.preview(self._window)
remaining = int(timer.remaining() + 1)
if not self._overlay or remaining != timeout:
# Rebluid overlay only if remaining number has changed
self._show_overlay(str(remaining), alpha)
timeout = remaining
self._show_overlay(get_translated_text('smile'), alpha)
def __init__(self):
State.__init__(self, 'wait')
self.timer = PoolingTimer(self.app.config.getfloat('WINDOW', 'animate_delay'))
def __init__(self, plugin_manager):
self._pm = plugin_manager
self.count = 0
# Seconds to display the failed message
self.failed_view_timer = PoolingTimer(2)
# Seconds between each animated frame
self.animated_frame_timer = PoolingTimer(0)
# Seconds before going back to the start
self.choose_timer = PoolingTimer(30)
# Seconds to display the selected layout
self.layout_timer = PoolingTimer(4)
# Seconds to display the selected layout
self.print_view_timer = PoolingTimer(0)
# Seconds to display the selected layout
self.finish_timer = PoolingTimer(0.5)
def __init__(self, plugin_manager):
self._pm = plugin_manager
self.count = 0
# Seconds to display the failed message
self.failed_view_timer = PoolingTimer(2)
# Seconds between each animated frame
self.animated_frame_timer = PoolingTimer(0)
# Seconds before going back to the start
self.choose_timer = PoolingTimer(30)
# Seconds to display the selected layout
self.layout_timer = PoolingTimer(4)
# Seconds to display the selected layout
self.print_view_timer = PoolingTimer(0)
# Seconds to display the selected layout
self.finish_timer = PoolingTimer(0.5)
def preview_countdown(self, timeout, alpha=60):
"""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")
timer = PoolingTimer(timeout)
while not timer.is_timeout():
self.preview(self._window)
remaining = int(timer.remaining() + 1)
if not self._overlay or remaining != timeout:
# Rebluid overlay only if remaining number has changed
self._show_overlay(str(remaining), alpha)
timeout = remaining
self._show_overlay(LANGUAGES.get(PiConfigParser.language, LANGUAGES['en']).get('smile_message'), alpha)
def __init__(self, plugin_manager):
self._pm = plugin_manager
self.count = 0
# Seconds to display the failed message
self.failed_view_timer = PoolingTimer(2)
# Seconds between each animated frame
self.animated_frame_timer = PoolingTimer(0)
# Seconds before going back to the start
self.choose_timer = PoolingTimer(30)
# Seconds to display the selected layout
self.layout_timer = PoolingTimer(4)
# Seconds to display the selected layout
self.print_view_timer = PoolingTimer(0)
# Seconds to display the selected layout
self.finish_timer = PoolingTimer(0.5)