From aa782f3080f1c4129c838a31ee04237027d33256 Mon Sep 17 00:00:00 2001 From: edschuy95 Date: Wed, 21 Jan 2026 22:06:07 -0500 Subject: [PATCH] saving before having gemini take a crack at fixing things. --- RA3MP3Playback.py | 47 ++++++++--- RA3MP3Playback.pyproj | 1 + textmenu.py | 188 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 224 insertions(+), 12 deletions(-) create mode 100644 textmenu.py diff --git a/RA3MP3Playback.py b/RA3MP3Playback.py index b83308a..9b96512 100644 --- a/RA3MP3Playback.py +++ b/RA3MP3Playback.py @@ -1,4 +1,5 @@ from pathlib import Path +from textmenu import TextMenu import threading import time import os @@ -92,19 +93,23 @@ ANSI_ESCAPE_RE = re.compile( # ========================================================== # ===================== UTILITY FUNCTIONS ================= -# def apply_backspaces(s): -# # Ensure we are working with str -# if isinstance(s, bytes): -# s = s.decode(errors="ignore") +def find_pk3_subfolders(base_path): + """ + Returns a list of subfolder names under base_path that contain + at least one .pk3 file. + """ + base = Path(base_path) + matches = [] -# buf = [] -# for c in s: -# if c == "\x08": -# if buf: -# buf.pop() -# else: -# buf.append(c) -# return "".join(buf) + if not base.is_dir(): + return matches + + for entry in base.iterdir(): + if entry.is_dir(): + if any(f.is_file() and f.suffix.lower() == ".pk3" for f in entry.iterdir()): + matches.append(entry.name) + + return matches def acquire_single_instance(lockfile_base: str): """ @@ -583,6 +588,24 @@ def main(): # bufsize=0, # unbuffered # universal_newlines=False) + items = ["Pee pee","Poo poo","Stinky caca peepee poopoo pants.","a","b","c","d"] + menu = TextMenu( + items, + width=30, + height=5, + title="Choose your stink", + border_fg="dark gray", + border_bg="dark red", + inside_fg="dark red", + inside_bg="black", + selected_fg="black", + selected_bg="dark red", + timeout=10 + ) + choice=menu.show() + + print(f"You selected: {choice}") + if os.name == "nt": pty_proc = subprocess.Popen( [game_exe, "+set", "ttycon", "1"] + sys.argv[1:], diff --git a/RA3MP3Playback.pyproj b/RA3MP3Playback.pyproj index 96fae7c..989e8b7 100644 --- a/RA3MP3Playback.pyproj +++ b/RA3MP3Playback.pyproj @@ -25,6 +25,7 @@ +