01234567890123456789012345678901234567890123456789012345678901234567890123456789
643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474 |
<----SKIPPED LINES---->
message_queue: FIFO list of message tuples of (message type,
message string).
next_message_time: epoch at which next message should be displayed
configuration: dictionary of configuration attributes.
screens: List of past screens displayed to splitflap screen.
Returns:
Next_message_time, potentially updated if a message has been displayed,
or unchanged if no message was displayed.
"""
if message_queue and (time.time() >= next_message_time or SIMULATION):
if SIMULATION: # drain the queue because the messages come so fast
messages_to_display = list(message_queue)
# passed by reference, so clear it out since we drained it to the display
del message_queue[:]
else: # display only one message, being mindful of the display timing
messages_to_display = [message_queue.pop(0)]
for message in messages_to_display:
Log(message)
message_type, message_text = message
# There may be one or several insight messages that were added to the
# message queue along with the flight at a time when the screen was
# enabled, but by the time it comes to display them, the screen is now
# disabled. These should not be displayed. Note that this check only
# needs to be done for insight messages because other message types
# are user initiated and so presumably should be displayed irrespective
# of when the user triggered it to be displayed.
if message_type == FLAG_MSG_INSIGHT and not MessageMeetsDisplayCriteria(
configuration):
Log('Message %s purged')
else:
if isinstance(message_text, str):
message_text = textwrap.wrap(
message_text,
width=SPLITFLAP_CHARS_PER_LINE)
display_message = Screenify(message_text, False)
Log(display_message, file=ALL_MESSAGE_FILE)
<----SKIPPED LINES---->
|
01234567890123456789012345678901234567890123456789012345678901234567890123456789
643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474 |
<----SKIPPED LINES---->
message_queue: FIFO list of message tuples of (message type,
message string).
next_message_time: epoch at which next message should be displayed
configuration: dictionary of configuration attributes.
screens: List of past screens displayed to splitflap screen.
Returns:
Next_message_time, potentially updated if a message has been displayed,
or unchanged if no message was displayed.
"""
if message_queue and (time.time() >= next_message_time or SIMULATION):
if SIMULATION: # drain the queue because the messages come so fast
messages_to_display = list(message_queue)
# passed by reference, so clear it out since we drained it to the display
del message_queue[:]
else: # display only one message, being mindful of the display timing
messages_to_display = [message_queue.pop(0)]
for message in messages_to_display:
message_type = message[0]
message_text = message[1]
# There may be one or several insight messages that were added to the
# message queue along with the flight at a time when the screen was
# enabled, but by the time it comes to display them, the screen is now
# disabled. These should not be displayed. Note that this check only
# needs to be done for insight messages because other message types
# are user initiated and so presumably should be displayed irrespective
# of when the user triggered it to be displayed.
if message_type == FLAG_MSG_INSIGHT and not MessageMeetsDisplayCriteria(
configuration):
Log('Message %s purged')
else:
if isinstance(message_text, str):
message_text = textwrap.wrap(
message_text,
width=SPLITFLAP_CHARS_PER_LINE)
display_message = Screenify(message_text, False)
Log(display_message, file=ALL_MESSAGE_FILE)
<----SKIPPED LINES---->
|