Only show display_text message once per session.

This commit is contained in:
Storm Dragon 2025-02-26 02:55:52 -05:00
parent e7d5b03e55
commit 10b46fa168

View File

@ -31,6 +31,9 @@ import numpy as np
import time import time
import wx import wx
# Keep track if the instructions for navigating display_text has been shown
displayTextUsageInstructions = False
# Global variable for speech provider # Global variable for speech provider
try: try:
import speechd import speechd
@ -164,13 +167,13 @@ def write_config(write_global=False):
with open(globalPath + "/config.ini", 'w') as configfile: with open(globalPath + "/config.ini", 'w') as configfile:
globalConfig.write(configfile) globalConfig.write(configfile)
def read_config(read_global=False): def read_config(readGlobal=False):
"""Read configuration from file. """Read configuration from file.
Args: Args:
read_global (bool): If True, read global config, otherwise local (default: False) readGlobal (bool): If True, read global config, otherwise local (default: False)
""" """
if not read_global: if not readGlobal:
try: try:
with open(gamePath + "/config.ini", 'r') as configfile: with open(gamePath + "/config.ini", 'r') as configfile:
localConfig.read_file(configfile) localConfig.read_file(configfile)
@ -760,11 +763,14 @@ def display_text(text):
# Create navigation text by filtering out blank lines # Create navigation text by filtering out blank lines
navText = [line for line in text if line.strip()] navText = [line for line in text if line.strip()]
# Add instructions at the start # Add instructions at the start on the first display
global displayTextUsageInstructions
if not displayTextUsageInstructions:
instructions = ("Press space to read the whole text. Use up and down arrows to navigate " instructions = ("Press space to read the whole text. Use up and down arrows to navigate "
"the text line by line. Press c to copy the current line to the clipboard " "the text line by line. Press c to copy the current line to the clipboard "
"or t to copy the entire text. Press enter or escape when you are done reading.") "or t to copy the entire text. Press enter or escape when you are done reading.")
navText.insert(0, instructions) navText.insert(0, instructions)
displayTextUsageInstructions = True
# Add end marker # Add end marker
navText.append("End of text.") navText.append("End of text.")