From 10b46fa168e73c213aba2f05507cac56f47a4798 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Wed, 26 Feb 2025 02:55:52 -0500 Subject: [PATCH] Only show display_text message once per session. --- __init__.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/__init__.py b/__init__.py index db9e91e..733d062 100755 --- a/__init__.py +++ b/__init__.py @@ -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.")