Completed another major overhaul - hopefully
This commit is contained in:
parent
ac050d6627
commit
6b6cacbecd
2 changed files with 13 additions and 16 deletions
|
|
@ -23,7 +23,7 @@ import pygame
|
||||||
shutdown_event = threading.Event()
|
shutdown_event = threading.Event()
|
||||||
|
|
||||||
# ========================= CONFIG =========================
|
# ========================= 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 paths (used if not in debug mode)
|
||||||
DEFAULT_WIN_GAME_EXE = r"./qgame.dll"
|
DEFAULT_WIN_GAME_EXE = r"./qgame.dll"
|
||||||
|
|
@ -621,11 +621,11 @@ def game_launch(gameargs):
|
||||||
pygame.mixer.init()
|
pygame.mixer.init()
|
||||||
|
|
||||||
# Start playlist watcher thread
|
# 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()
|
playlist_thread.start()
|
||||||
|
|
||||||
# Start track watcher thread
|
# Start track watcher thread
|
||||||
watcher_thread = threading.Thread(target=track_watcher, daemon=False)
|
watcher_thread = threading.Thread(target=track_watcher)
|
||||||
watcher_thread.start()
|
watcher_thread.start()
|
||||||
|
|
||||||
chosen_mod = None
|
chosen_mod = None
|
||||||
|
|
@ -646,11 +646,11 @@ def game_launch(gameargs):
|
||||||
master_fd = None
|
master_fd = None
|
||||||
|
|
||||||
# Start monitoring in background thread
|
# 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()
|
monitor_thread.start()
|
||||||
|
|
||||||
else:
|
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()
|
master_fd, slave_fd = pty.openpty()
|
||||||
|
|
||||||
pty_proc = subprocess.Popen(
|
pty_proc = subprocess.Popen(
|
||||||
|
|
@ -664,7 +664,7 @@ def game_launch(gameargs):
|
||||||
os.close(slave_fd)
|
os.close(slave_fd)
|
||||||
|
|
||||||
# Start monitoring in background thread
|
# 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_thread.start()
|
||||||
|
|
||||||
# Monitor the game output
|
# Monitor the game output
|
||||||
|
|
@ -677,10 +677,7 @@ def game_launch(gameargs):
|
||||||
|
|
||||||
# Small sleep to prevent busy waiting
|
# Small sleep to prevent busy waiting
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
# if os.name == "nt":
|
|
||||||
# monitor_game(pty_proc)
|
|
||||||
# else:
|
|
||||||
# monitor_game_pty(master_fd)
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("Exiting...")
|
print("Exiting...")
|
||||||
finally:
|
finally:
|
||||||
|
|
|
||||||
12
textmenu.py
12
textmenu.py
|
|
@ -204,6 +204,12 @@ class TextMenu:
|
||||||
# Pack with fill and expand to take up available space
|
# Pack with fill and expand to take up available space
|
||||||
self.listbox.pack(fill=tk.BOTH, expand=True, padx=5, pady=5)
|
self.listbox.pack(fill=tk.BOTH, expand=True, padx=5, pady=5)
|
||||||
scrollbar.config(command=self.listbox.yview)
|
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
|
# Create timer frame at the bottom using border_bg
|
||||||
self.timer_frame = tk.Frame(main_frame, bg=self.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-4>', lambda e: self._on_mousewheel_linux(-1)) # Scroll up
|
||||||
self.root.bind('<Button-5>', lambda e: self._on_mousewheel_linux(1)) # Scroll down
|
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):
|
def _on_mousewheel_linux(self, direction):
|
||||||
"""Handle Linux mouse wheel events"""
|
"""Handle Linux mouse wheel events"""
|
||||||
self._cancel_timeout()
|
self._cancel_timeout()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue