Completed another major overhaul - hopefully

This commit is contained in:
edschuy95 2026-01-22 22:05:31 -05:00
parent ac050d6627
commit 6b6cacbecd
2 changed files with 13 additions and 16 deletions

View file

@ -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:

View file

@ -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('<Button-4>', lambda e: self._on_mousewheel_linux(-1)) # Scroll up
self.root.bind('<Button-5>', 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()