From 6b6cacbecd1dbea90c93a3368f06e52ccf323d09 Mon Sep 17 00:00:00 2001 From: edschuy95 Date: Thu, 22 Jan 2026 22:05:31 -0500 Subject: [PATCH] Completed another major overhaul - hopefully --- RA3MP3Playback.pyw | 17 +++++++---------- textmenu.py | 12 ++++++------ 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/RA3MP3Playback.pyw b/RA3MP3Playback.pyw index 262e100..69d5f0b 100644 --- a/RA3MP3Playback.pyw +++ b/RA3MP3Playback.pyw @@ -23,7 +23,7 @@ import pygame shutdown_event = threading.Event() # ========================= CONFIG ========================= -DEBUG = False # Set True to enable debug overrides +DEBUG = True # Set True to enable debug overrides # Default paths (used if not in debug mode) DEFAULT_WIN_GAME_EXE = r"./qgame.dll" @@ -621,11 +621,11 @@ def game_launch(gameargs): pygame.mixer.init() # Start playlist watcher thread - playlist_thread = threading.Thread(target=playlist_watcher,args=(playlist_path,), daemon=False) + playlist_thread = threading.Thread(target=playlist_watcher,args=(playlist_path,)) playlist_thread.start() # Start track watcher thread - watcher_thread = threading.Thread(target=track_watcher, daemon=False) + watcher_thread = threading.Thread(target=track_watcher) watcher_thread.start() chosen_mod = None @@ -646,11 +646,11 @@ def game_launch(gameargs): master_fd = None # Start monitoring in background thread - monitor_thread = threading.Thread(target=monitor_game, args=(pty_proc,), daemon=False) + monitor_thread = threading.Thread(target=monitor_game, args=(pty_proc,)) monitor_thread.start() else: - os.environ['TERM'] = 'xterm' + os.environ['TERM'] = 'xterm' # I can't believe this fixed tty console output in linux master_fd, slave_fd = pty.openpty() pty_proc = subprocess.Popen( @@ -664,7 +664,7 @@ def game_launch(gameargs): os.close(slave_fd) # Start monitoring in background thread - monitor_thread = threading.Thread(target=monitor_game_pty, args=(master_fd,), daemon=False) + monitor_thread = threading.Thread(target=monitor_game_pty, args=(master_fd,)) monitor_thread.start() # Monitor the game output @@ -677,10 +677,7 @@ def game_launch(gameargs): # Small sleep to prevent busy waiting time.sleep(0.1) - # if os.name == "nt": - # monitor_game(pty_proc) - # else: - # monitor_game_pty(master_fd) + except KeyboardInterrupt: print("Exiting...") finally: diff --git a/textmenu.py b/textmenu.py index b3e1e80..ccd121c 100644 --- a/textmenu.py +++ b/textmenu.py @@ -204,6 +204,12 @@ class TextMenu: # Pack with fill and expand to take up available space self.listbox.pack(fill=tk.BOTH, expand=True, padx=5, pady=5) scrollbar.config(command=self.listbox.yview) + + # Set first item as active + if self.choices: + self.listbox.selection_set(0) + self.listbox.activate(0) + self.listbox.focus_set() # This ensures the listbox has keyboard focus # Create timer frame at the bottom using border_bg self.timer_frame = tk.Frame(main_frame, bg=self.border_bg) @@ -232,12 +238,6 @@ class TextMenu: self.root.bind('', lambda e: self._on_mousewheel_linux(-1)) # Scroll up self.root.bind('', lambda e: self._on_mousewheel_linux(1)) # Scroll down - # Set first item as active - if self.choices: - self.listbox.selection_set(0) - self.listbox.activate(0) - self.listbox.focus_set() # This ensures the listbox has keyboard focus - def _on_mousewheel_linux(self, direction): """Handle Linux mouse wheel events""" self._cancel_timeout()