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 wx
# Keep track if the instructions for navigating display_text has been shown
displayTextUsageInstructions = False
# Global variable for speech provider
try:
import speechd
@ -164,13 +167,13 @@ def write_config(write_global=False):
with open(globalPath + "/config.ini", 'w') as configfile:
globalConfig.write(configfile)
def read_config(read_global=False):
def read_config(readGlobal=False):
"""Read configuration from file.
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:
with open(gamePath + "/config.ini", 'r') as configfile:
localConfig.read_file(configfile)
@ -760,11 +763,14 @@ def display_text(text):
# Create navigation text by filtering out blank lines
navText = [line for line in text if line.strip()]
# Add instructions at the start
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 "
"or t to copy the entire text. Press enter or escape when you are done reading.")
navText.insert(0, instructions)
# 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 "
"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.")
navText.insert(0, instructions)
displayTextUsageInstructions = True
# Add end marker
navText.append("End of text.")