UI/UX: Improved mouse hiding logic, overlay controls, and robust player integration

This commit is contained in:
2025-08-25 16:37:54 +03:00
parent 1ea2ee584c
commit 0c162bb0c8
5 changed files with 148 additions and 15 deletions

View File

@@ -79,9 +79,13 @@ class SimpleTkPlayer:
def hide_mouse(self):
self.root.config(cursor='none')
if hasattr(self, 'controls_win'):
self.controls_win.config(cursor='none')
def show_mouse(self):
self.root.config(cursor='arrow')
if hasattr(self, 'controls_win'):
self.controls_win.config(cursor='arrow')
def move_mouse_to_corner(self):
try:
@@ -232,20 +236,18 @@ class SimpleTkPlayer:
if self.paused is not True:
self.paused = True
self.pause_btn.config(text='▶ Resume')
settings_win = tk.Toplevel(self.root)
settings_win.title('Settings')
settings_win.geometry('400x300+100+100')
settings_win.transient(self.root)
settings_win.grab_set()
tk.Label(settings_win, text='Settings', font=('Arial', 18)).pack(pady=10)
# Example setting: close button
tk.Button(settings_win, text='Close', command=settings_win.destroy).pack(pady=20)
def on_close():
settings_win.grab_release()
settings_win.destroy()
import subprocess, sys
settings_path = os.path.join(os.path.dirname(__file__), 'appsettings.py')
# Open settings in a new process so it doesn't block the main player
proc = subprocess.Popen([sys.executable, settings_path])
# Wait for the settings window to close, then resume
self.root.after(1000, lambda: self.check_settings_closed(proc))
def check_settings_closed(self, proc):
if proc.poll() is not None:
self.resume_play()
settings_win.protocol('WM_DELETE_WINDOW', on_close)
settings_win.bind('<Destroy>', lambda e: self.resume_play() if not settings_win.winfo_exists() else None)
else:
self.root.after(1000, lambda: self.check_settings_closed(proc))
def main_start(self):
self.play_intro_video()