Example #1
0
def show_alert(message, image_name):
	logging.info("Show the break screen")
	notification.close()
	plugins_data = plugins.pre_break(context)
	break_screen.show_message(message, Utility.get_resource_path(image_name), plugins_data)
	if config['strict_break'] and is_active:
		Utility.execute_main_thread(tray_icon.unlock_menu)
Example #2
0
def play_sound(resource_name):
    """Play the audio resource.

    Arguments:
        resource_name {string} -- name of the wav file resource
    """
    logging.info('Playing audible alert %s', resource_name)
    try:
        # Open the sound file
        path = Utility.get_resource_path(resource_name)
        if path is None:
            return
        Utility.execute_command('aplay', ['-q', path])

    except BaseException:
        logging.error('Failed to play audible alert %s', resource_name)
Example #3
0
def on_stop_break():
    """
    After the break, play the alert sound
    """
    # Do not play if the break is skipped or postponed
    if context['skipped'] or context['postponed']:
        return

    logging.info('Playing audible alert')
    try:
        # Open the sound file
        path = Utility.get_resource_path('alert.wav')
        if path is None:
            return
        Utility.execute_command('aplay', ['-q', path])

    except BaseException:
        logging.error('Failed to play audible alert')