Final project update: all fixes, endpoint corrections, and production-ready state
This commit is contained in:
@@ -1,143 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""
|
|
||||||
Test script to verify window centering functionality
|
|
||||||
"""
|
|
||||||
import tkinter as tk
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
sys.path.append('tkinter_app/src')
|
|
||||||
from tkinter_simple_player import SettingsWindow, SimpleMediaPlayerApp
|
|
||||||
|
|
||||||
def test_settings_centering():
|
|
||||||
"""Test settings window centering"""
|
|
||||||
root = tk.Tk()
|
|
||||||
root.withdraw() # Hide main window
|
|
||||||
|
|
||||||
# Create a mock app object
|
|
||||||
class MockApp:
|
|
||||||
def __init__(self):
|
|
||||||
self.playlist = []
|
|
||||||
self.current_index = 0
|
|
||||||
|
|
||||||
def play_current_media(self):
|
|
||||||
print('play_current_media called')
|
|
||||||
|
|
||||||
app = MockApp()
|
|
||||||
|
|
||||||
# Test settings window centering
|
|
||||||
try:
|
|
||||||
print("Testing settings window centering...")
|
|
||||||
settings = SettingsWindow(root, app)
|
|
||||||
|
|
||||||
# Get screen dimensions
|
|
||||||
screen_width = settings.window.winfo_screenwidth()
|
|
||||||
screen_height = settings.window.winfo_screenheight()
|
|
||||||
|
|
||||||
# Get window position
|
|
||||||
settings.window.update_idletasks()
|
|
||||||
window_x = settings.window.winfo_x()
|
|
||||||
window_y = settings.window.winfo_y()
|
|
||||||
window_width = 900
|
|
||||||
window_height = 700
|
|
||||||
|
|
||||||
# Calculate expected center position
|
|
||||||
expected_x = (screen_width - window_width) // 2
|
|
||||||
expected_y = (screen_height - window_height) // 2
|
|
||||||
|
|
||||||
print(f"Screen size: {screen_width}x{screen_height}")
|
|
||||||
print(f"Window position: {window_x}, {window_y}")
|
|
||||||
print(f"Expected center: {expected_x}, {expected_y}")
|
|
||||||
print(f"Window size: {window_width}x{window_height}")
|
|
||||||
|
|
||||||
# Check if window is roughly centered (allow some margin for window decorations)
|
|
||||||
margin = 50
|
|
||||||
is_centered_x = abs(window_x - expected_x) <= margin
|
|
||||||
is_centered_y = abs(window_y - expected_y) <= margin
|
|
||||||
|
|
||||||
if is_centered_x and is_centered_y:
|
|
||||||
print("✅ Settings window is properly centered!")
|
|
||||||
else:
|
|
||||||
print("❌ Settings window centering needs adjustment")
|
|
||||||
|
|
||||||
# Keep window open for 3 seconds to visually verify
|
|
||||||
root.after(3000, root.quit)
|
|
||||||
root.mainloop()
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(f"❌ Error testing settings window: {e}")
|
|
||||||
|
|
||||||
def test_exit_dialog_centering():
|
|
||||||
"""Test exit dialog centering"""
|
|
||||||
print("\nTesting exit dialog centering...")
|
|
||||||
|
|
||||||
# Create a simple test for the centering function
|
|
||||||
root = tk.Tk()
|
|
||||||
root.withdraw()
|
|
||||||
|
|
||||||
# Create a test dialog
|
|
||||||
dialog = tk.Toplevel(root)
|
|
||||||
dialog.title("Test Exit Dialog")
|
|
||||||
dialog.geometry("400x200")
|
|
||||||
dialog.configure(bg='#2d2d2d')
|
|
||||||
dialog.resizable(False, False)
|
|
||||||
|
|
||||||
# Test the centering logic
|
|
||||||
dialog.update_idletasks()
|
|
||||||
screen_width = dialog.winfo_screenwidth()
|
|
||||||
screen_height = dialog.winfo_screenheight()
|
|
||||||
dialog_width = 400
|
|
||||||
dialog_height = 200
|
|
||||||
|
|
||||||
# Calculate center position
|
|
||||||
center_x = int((screen_width - dialog_width) / 2)
|
|
||||||
center_y = int((screen_height - dialog_height) / 2)
|
|
||||||
|
|
||||||
# Ensure the dialog doesn't go off-screen
|
|
||||||
center_x = max(0, min(center_x, screen_width - dialog_width))
|
|
||||||
center_y = max(0, min(center_y, screen_height - dialog_height))
|
|
||||||
|
|
||||||
dialog.geometry(f"{dialog_width}x{dialog_height}+{center_x}+{center_y}")
|
|
||||||
dialog.lift()
|
|
||||||
|
|
||||||
# Add test content
|
|
||||||
tk.Label(dialog, text="🎬 Test Exit Dialog",
|
|
||||||
font=('Arial', 16, 'bold'),
|
|
||||||
fg='white', bg='#2d2d2d').pack(pady=20)
|
|
||||||
|
|
||||||
tk.Label(dialog, text="This dialog should be centered on screen",
|
|
||||||
font=('Arial', 12),
|
|
||||||
fg='white', bg='#2d2d2d').pack(pady=10)
|
|
||||||
|
|
||||||
# Get actual position
|
|
||||||
dialog.update_idletasks()
|
|
||||||
actual_x = dialog.winfo_x()
|
|
||||||
actual_y = dialog.winfo_y()
|
|
||||||
|
|
||||||
print(f"Screen size: {screen_width}x{screen_height}")
|
|
||||||
print(f"Dialog position: {actual_x}, {actual_y}")
|
|
||||||
print(f"Expected center: {center_x}, {center_y}")
|
|
||||||
|
|
||||||
# Check centering
|
|
||||||
margin = 50
|
|
||||||
is_centered_x = abs(actual_x - center_x) <= margin
|
|
||||||
is_centered_y = abs(actual_y - center_y) <= margin
|
|
||||||
|
|
||||||
if is_centered_x and is_centered_y:
|
|
||||||
print("✅ Exit dialog is properly centered!")
|
|
||||||
else:
|
|
||||||
print("❌ Exit dialog centering needs adjustment")
|
|
||||||
|
|
||||||
# Close dialog after 3 seconds
|
|
||||||
root.after(3000, root.quit)
|
|
||||||
root.mainloop()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
print("🧪 Testing Window Centering Functionality")
|
|
||||||
print("=" * 50)
|
|
||||||
|
|
||||||
test_settings_centering()
|
|
||||||
test_exit_dialog_centering()
|
|
||||||
|
|
||||||
print("\n✅ Centering tests completed!")
|
|
||||||
print("\nThe windows should appear centered on your screen regardless of resolution.")
|
|
||||||
print("This works for any screen size: 1024x768, 1920x1080, 4K, etc.")
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""
|
|
||||||
Test script to verify image display functionality
|
|
||||||
"""
|
|
||||||
import tkinter as tk
|
|
||||||
from PIL import Image, ImageTk
|
|
||||||
import os
|
|
||||||
|
|
||||||
def test_image_display():
|
|
||||||
# Create a simple tkinter window
|
|
||||||
root = tk.Tk()
|
|
||||||
root.title("Image Display Test")
|
|
||||||
root.geometry("800x600")
|
|
||||||
root.configure(bg='black')
|
|
||||||
|
|
||||||
# Create image label
|
|
||||||
image_label = tk.Label(root, bg='black')
|
|
||||||
image_label.pack(fill=tk.BOTH, expand=True)
|
|
||||||
|
|
||||||
# Test image path
|
|
||||||
test_image = "/home/pi/Desktop/signage-player/tkinter_app/src/static/resurse/1307306470-nature_wallpaper_hd_hd_nature_3-3828209637.jpg"
|
|
||||||
|
|
||||||
try:
|
|
||||||
if os.path.exists(test_image):
|
|
||||||
print(f"Loading image: {test_image}")
|
|
||||||
|
|
||||||
# Load and display image
|
|
||||||
img = Image.open(test_image)
|
|
||||||
img.thumbnail((800, 600), Image.LANCZOS)
|
|
||||||
photo = ImageTk.PhotoImage(img)
|
|
||||||
|
|
||||||
image_label.config(image=photo)
|
|
||||||
image_label.image = photo # Keep reference
|
|
||||||
|
|
||||||
print(f"Image loaded successfully: {img.size}")
|
|
||||||
|
|
||||||
# Close after 3 seconds
|
|
||||||
root.after(3000, root.quit)
|
|
||||||
|
|
||||||
else:
|
|
||||||
print(f"Image file not found: {test_image}")
|
|
||||||
image_label.config(text="Image file not found", fg='white')
|
|
||||||
root.after(2000, root.quit)
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error loading image: {e}")
|
|
||||||
image_label.config(text=f"Error: {e}", fg='red')
|
|
||||||
root.after(2000, root.quit)
|
|
||||||
|
|
||||||
root.mainloop()
|
|
||||||
print("Image display test completed")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
test_image_display()
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
import sys
|
|
||||||
print("Testing imports...")
|
|
||||||
|
|
||||||
try:
|
|
||||||
import tkinter as tk
|
|
||||||
print("✓ tkinter imported successfully")
|
|
||||||
except Exception as e:
|
|
||||||
print(f"✗ tkinter import failed: {e}")
|
|
||||||
|
|
||||||
try:
|
|
||||||
from PIL import Image, ImageTk
|
|
||||||
print("✓ PIL and ImageTk imported successfully")
|
|
||||||
except Exception as e:
|
|
||||||
print(f"✗ PIL import failed: {e}")
|
|
||||||
|
|
||||||
try:
|
|
||||||
from virtual_keyboard import VirtualKeyboard
|
|
||||||
print("✓ Virtual keyboard imported successfully")
|
|
||||||
except Exception as e:
|
|
||||||
print(f"✗ Virtual keyboard import failed: {e}")
|
|
||||||
|
|
||||||
try:
|
|
||||||
from python_functions import load_local_playlist
|
|
||||||
print("✓ Python functions imported successfully")
|
|
||||||
|
|
||||||
# Test loading playlist
|
|
||||||
playlist_data = load_local_playlist()
|
|
||||||
playlist = playlist_data.get('playlist', [])
|
|
||||||
print(f"✓ Local playlist loaded: {len(playlist)} items")
|
|
||||||
|
|
||||||
for i, item in enumerate(playlist):
|
|
||||||
print(f" {i+1}. {item.get('file_name', 'Unknown')}")
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(f"✗ Python functions import/execution failed: {e}")
|
|
||||||
|
|
||||||
print("Import test completed")
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""
|
|
||||||
Test script for full-screen image scaling functionality
|
|
||||||
"""
|
|
||||||
import tkinter as tk
|
|
||||||
from PIL import Image, ImageTk
|
|
||||||
import os
|
|
||||||
|
|
||||||
def test_scaling_modes():
|
|
||||||
"""Test different scaling modes for images"""
|
|
||||||
|
|
||||||
def scale_image_to_screen(img, screen_width, screen_height, mode='fit'):
|
|
||||||
"""Test scaling function"""
|
|
||||||
img_width, img_height = img.size
|
|
||||||
|
|
||||||
if mode == 'stretch':
|
|
||||||
return img.resize((screen_width, screen_height), Image.LANCZOS), (0, 0)
|
|
||||||
|
|
||||||
elif mode == 'fill':
|
|
||||||
screen_ratio = screen_width / screen_height
|
|
||||||
img_ratio = img_width / img_height
|
|
||||||
|
|
||||||
if img_ratio > screen_ratio:
|
|
||||||
new_height = screen_height
|
|
||||||
new_width = int(screen_height * img_ratio)
|
|
||||||
x_offset = (screen_width - new_width) // 2
|
|
||||||
y_offset = 0
|
|
||||||
else:
|
|
||||||
new_width = screen_width
|
|
||||||
new_height = int(screen_width / img_ratio)
|
|
||||||
x_offset = 0
|
|
||||||
y_offset = (screen_height - new_height) // 2
|
|
||||||
|
|
||||||
img_resized = img.resize((new_width, new_height), Image.LANCZOS)
|
|
||||||
final_img = Image.new('RGB', (screen_width, screen_height), 'black')
|
|
||||||
|
|
||||||
if new_width > screen_width:
|
|
||||||
crop_x = (new_width - screen_width) // 2
|
|
||||||
img_resized = img_resized.crop((crop_x, 0, crop_x + screen_width, new_height))
|
|
||||||
x_offset = 0
|
|
||||||
if new_height > screen_height:
|
|
||||||
crop_y = (new_height - screen_height) // 2
|
|
||||||
img_resized = img_resized.crop((0, crop_y, new_width, crop_y + screen_height))
|
|
||||||
y_offset = 0
|
|
||||||
|
|
||||||
final_img.paste(img_resized, (x_offset, y_offset))
|
|
||||||
return final_img, (x_offset, y_offset)
|
|
||||||
|
|
||||||
else: # fit mode
|
|
||||||
screen_ratio = screen_width / screen_height
|
|
||||||
img_ratio = img_width / img_height
|
|
||||||
|
|
||||||
if img_ratio > screen_ratio:
|
|
||||||
new_width = screen_width
|
|
||||||
new_height = int(screen_width / img_ratio)
|
|
||||||
else:
|
|
||||||
new_height = screen_height
|
|
||||||
new_width = int(screen_height * img_ratio)
|
|
||||||
|
|
||||||
img_resized = img.resize((new_width, new_height), Image.LANCZOS)
|
|
||||||
final_img = Image.new('RGB', (screen_width, screen_height), 'black')
|
|
||||||
x_offset = (screen_width - new_width) // 2
|
|
||||||
y_offset = (screen_height - new_height) // 2
|
|
||||||
final_img.paste(img_resized, (x_offset, y_offset))
|
|
||||||
|
|
||||||
return final_img, (x_offset, y_offset)
|
|
||||||
|
|
||||||
# Test image path
|
|
||||||
test_image = "/home/pi/Desktop/signage-player/tkinter_app/src/static/resurse/1307306470-nature_wallpaper_hd_hd_nature_3-3828209637.jpg"
|
|
||||||
|
|
||||||
if not os.path.exists(test_image):
|
|
||||||
print(f"Test image not found: {test_image}")
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
|
||||||
# Load test image
|
|
||||||
img = Image.open(test_image)
|
|
||||||
original_size = img.size
|
|
||||||
screen_width, screen_height = 800, 600
|
|
||||||
|
|
||||||
print(f"Testing scaling modes for image: {original_size}")
|
|
||||||
print(f"Target screen size: {screen_width}x{screen_height}")
|
|
||||||
|
|
||||||
# Test each scaling mode
|
|
||||||
modes = ['fit', 'fill', 'stretch']
|
|
||||||
|
|
||||||
for mode in modes:
|
|
||||||
final_img, offset = scale_image_to_screen(img, screen_width, screen_height, mode)
|
|
||||||
print(f"{mode.upper()} mode: Final size: {final_img.size}, Offset: {offset}")
|
|
||||||
|
|
||||||
print("✅ All scaling modes tested successfully!")
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(f"❌ Error testing scaling: {e}")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
test_scaling_modes()
|
|
||||||
230
test_touch.py
230
test_touch.py
@@ -1,230 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""
|
|
||||||
Touch Display Test - Test the touch-optimized interface with virtual keyboard
|
|
||||||
"""
|
|
||||||
import tkinter as tk
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
sys.path.append('tkinter_app/src')
|
|
||||||
|
|
||||||
def test_touch_interface():
|
|
||||||
"""Test the touch-optimized settings interface"""
|
|
||||||
try:
|
|
||||||
from tkinter_simple_player import SettingsWindow
|
|
||||||
|
|
||||||
# Create main window
|
|
||||||
root = tk.Tk()
|
|
||||||
root.title("🎮 Touch Display Test")
|
|
||||||
root.geometry("1024x768")
|
|
||||||
root.configure(bg='#2c3e50')
|
|
||||||
|
|
||||||
# Create welcome screen
|
|
||||||
welcome_frame = tk.Frame(root, bg='#2c3e50', padx=40, pady=40)
|
|
||||||
welcome_frame.pack(fill=tk.BOTH, expand=True)
|
|
||||||
|
|
||||||
# Title
|
|
||||||
title_label = tk.Label(welcome_frame,
|
|
||||||
text="🎬 Touch Display Digital Signage",
|
|
||||||
font=('Segoe UI', 24, 'bold'),
|
|
||||||
fg='white', bg='#2c3e50')
|
|
||||||
title_label.pack(pady=30)
|
|
||||||
|
|
||||||
# Description
|
|
||||||
desc_text = (
|
|
||||||
"Touch-Optimized Features:\n\n"
|
|
||||||
"📱 Virtual On-Screen Keyboard\n"
|
|
||||||
"🎯 Larger Touch-Friendly Buttons\n"
|
|
||||||
"⌨️ Auto-Show Keyboard on Input Focus\n"
|
|
||||||
"👆 Enhanced Touch Feedback\n"
|
|
||||||
"🎨 Dark Theme Optimized for Displays\n\n"
|
|
||||||
"Click the button below to test the settings interface:"
|
|
||||||
)
|
|
||||||
|
|
||||||
desc_label = tk.Label(welcome_frame, text=desc_text,
|
|
||||||
font=('Segoe UI', 14),
|
|
||||||
fg='#ecf0f1', bg='#2c3e50',
|
|
||||||
justify=tk.CENTER)
|
|
||||||
desc_label.pack(pady=20)
|
|
||||||
|
|
||||||
# Create mock app for testing
|
|
||||||
class MockApp:
|
|
||||||
def __init__(self):
|
|
||||||
self.playlist = []
|
|
||||||
self.current_index = 0
|
|
||||||
|
|
||||||
def play_current_media(self):
|
|
||||||
print("Mock: play_current_media called")
|
|
||||||
|
|
||||||
mock_app = MockApp()
|
|
||||||
|
|
||||||
# Test button to open touch-optimized settings
|
|
||||||
def open_touch_settings():
|
|
||||||
try:
|
|
||||||
settings = SettingsWindow(root, mock_app)
|
|
||||||
print("✅ Touch-optimized settings window opened successfully!")
|
|
||||||
except Exception as e:
|
|
||||||
print(f"❌ Error opening settings: {e}")
|
|
||||||
import traceback
|
|
||||||
traceback.print_exc()
|
|
||||||
|
|
||||||
# Large touch-friendly button
|
|
||||||
settings_btn = tk.Button(welcome_frame,
|
|
||||||
text="🔧 Open Touch Settings",
|
|
||||||
command=open_touch_settings,
|
|
||||||
bg='#3498db', fg='white',
|
|
||||||
font=('Segoe UI', 16, 'bold'),
|
|
||||||
relief=tk.FLAT, padx=40, pady=20,
|
|
||||||
cursor='hand2')
|
|
||||||
settings_btn.pack(pady=30)
|
|
||||||
|
|
||||||
# Instructions
|
|
||||||
instructions = (
|
|
||||||
"Touch Instructions:\n"
|
|
||||||
"• Tap input fields to show virtual keyboard\n"
|
|
||||||
"• Use large buttons for easy touch interaction\n"
|
|
||||||
"• Virtual keyboard stays on top for easy access\n"
|
|
||||||
"• Click outside input fields to hide keyboard"
|
|
||||||
)
|
|
||||||
|
|
||||||
instr_label = tk.Label(welcome_frame, text=instructions,
|
|
||||||
font=('Segoe UI', 11),
|
|
||||||
fg='#bdc3c7', bg='#2c3e50',
|
|
||||||
justify=tk.LEFT)
|
|
||||||
instr_label.pack(pady=20)
|
|
||||||
|
|
||||||
# Exit button
|
|
||||||
exit_btn = tk.Button(welcome_frame,
|
|
||||||
text="❌ Exit Test",
|
|
||||||
command=root.quit,
|
|
||||||
bg='#e74c3c', fg='white',
|
|
||||||
font=('Segoe UI', 12, 'bold'),
|
|
||||||
relief=tk.FLAT, padx=30, pady=15,
|
|
||||||
cursor='hand2')
|
|
||||||
exit_btn.pack(pady=20)
|
|
||||||
|
|
||||||
# Add touch feedback to buttons
|
|
||||||
def add_touch_feedback(button):
|
|
||||||
def on_press(e):
|
|
||||||
button.configure(relief=tk.SUNKEN)
|
|
||||||
def on_release(e):
|
|
||||||
button.configure(relief=tk.FLAT)
|
|
||||||
def on_enter(e):
|
|
||||||
button.configure(relief=tk.RAISED)
|
|
||||||
def on_leave(e):
|
|
||||||
button.configure(relief=tk.FLAT)
|
|
||||||
|
|
||||||
button.bind("<Button-1>", on_press)
|
|
||||||
button.bind("<ButtonRelease-1>", on_release)
|
|
||||||
button.bind("<Enter>", on_enter)
|
|
||||||
button.bind("<Leave>", on_leave)
|
|
||||||
|
|
||||||
add_touch_feedback(settings_btn)
|
|
||||||
add_touch_feedback(exit_btn)
|
|
||||||
|
|
||||||
print("🎮 Touch Display Test Started")
|
|
||||||
print("=" * 50)
|
|
||||||
print("Features being tested:")
|
|
||||||
print("- Virtual keyboard integration")
|
|
||||||
print("- Touch-optimized input fields")
|
|
||||||
print("- Large, finger-friendly buttons")
|
|
||||||
print("- Enhanced visual feedback")
|
|
||||||
print("- Dark theme for displays")
|
|
||||||
print("\nClick 'Open Touch Settings' to test the interface!")
|
|
||||||
|
|
||||||
root.mainloop()
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(f"❌ Error in touch interface test: {e}")
|
|
||||||
import traceback
|
|
||||||
traceback.print_exc()
|
|
||||||
|
|
||||||
def test_virtual_keyboard_standalone():
|
|
||||||
"""Test just the virtual keyboard component"""
|
|
||||||
try:
|
|
||||||
from virtual_keyboard import VirtualKeyboard, TouchOptimizedEntry, TouchOptimizedButton
|
|
||||||
|
|
||||||
root = tk.Tk()
|
|
||||||
root.title("🎹 Virtual Keyboard Test")
|
|
||||||
root.geometry("800x500")
|
|
||||||
root.configure(bg='#2f3136')
|
|
||||||
|
|
||||||
# Create virtual keyboard
|
|
||||||
vk = VirtualKeyboard(root, dark_theme=True)
|
|
||||||
|
|
||||||
# Test interface
|
|
||||||
test_frame = tk.Frame(root, bg='#2f3136', padx=30, pady=30)
|
|
||||||
test_frame.pack(fill=tk.BOTH, expand=True)
|
|
||||||
|
|
||||||
tk.Label(test_frame, text="🎹 Virtual Keyboard Test",
|
|
||||||
font=('Segoe UI', 20, 'bold'),
|
|
||||||
bg='#2f3136', fg='white').pack(pady=20)
|
|
||||||
|
|
||||||
tk.Label(test_frame, text="Click on the input fields below to test the virtual keyboard:",
|
|
||||||
font=('Segoe UI', 12),
|
|
||||||
bg='#2f3136', fg='#b9bbbe').pack(pady=10)
|
|
||||||
|
|
||||||
# Test input fields
|
|
||||||
tk.Label(test_frame, text="Server IP:", bg='#2f3136', fg='white',
|
|
||||||
font=('Segoe UI', 11, 'bold')).pack(anchor=tk.W, pady=(20, 5))
|
|
||||||
entry1 = TouchOptimizedEntry(test_frame, vk, width=40, bg='#36393f',
|
|
||||||
fg='white', insertbackground='white')
|
|
||||||
entry1.pack(pady=5, fill=tk.X)
|
|
||||||
|
|
||||||
tk.Label(test_frame, text="Device Name:", bg='#2f3136', fg='white',
|
|
||||||
font=('Segoe UI', 11, 'bold')).pack(anchor=tk.W, pady=(15, 5))
|
|
||||||
entry2 = TouchOptimizedEntry(test_frame, vk, width=40, bg='#36393f',
|
|
||||||
fg='white', insertbackground='white')
|
|
||||||
entry2.pack(pady=5, fill=tk.X)
|
|
||||||
|
|
||||||
tk.Label(test_frame, text="Password:", bg='#2f3136', fg='white',
|
|
||||||
font=('Segoe UI', 11, 'bold')).pack(anchor=tk.W, pady=(15, 5))
|
|
||||||
entry3 = TouchOptimizedEntry(test_frame, vk, width=40, bg='#36393f',
|
|
||||||
fg='white', insertbackground='white', show='*')
|
|
||||||
entry3.pack(pady=5, fill=tk.X)
|
|
||||||
|
|
||||||
# Control buttons
|
|
||||||
btn_frame = tk.Frame(test_frame, bg='#2f3136')
|
|
||||||
btn_frame.pack(pady=30)
|
|
||||||
|
|
||||||
TouchOptimizedButton(btn_frame, text="🎹 Show Keyboard",
|
|
||||||
command=lambda: vk.show_keyboard(entry1),
|
|
||||||
bg='#7289da', fg='white').pack(side=tk.LEFT, padx=10)
|
|
||||||
|
|
||||||
TouchOptimizedButton(btn_frame, text="❌ Hide Keyboard",
|
|
||||||
command=vk.hide_keyboard,
|
|
||||||
bg='#ed4245', fg='white').pack(side=tk.LEFT, padx=10)
|
|
||||||
|
|
||||||
TouchOptimizedButton(btn_frame, text="🔄 Clear All",
|
|
||||||
command=lambda: [e.delete(0, tk.END) for e in [entry1, entry2, entry3]],
|
|
||||||
bg='#faa61a', fg='white').pack(side=tk.LEFT, padx=10)
|
|
||||||
|
|
||||||
print("🎹 Virtual Keyboard Test Started")
|
|
||||||
print("- Click input fields to auto-show keyboard")
|
|
||||||
print("- Type using virtual or physical keyboard")
|
|
||||||
print("- Test touch-friendly interface")
|
|
||||||
|
|
||||||
root.mainloop()
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(f"❌ Error in virtual keyboard test: {e}")
|
|
||||||
import traceback
|
|
||||||
traceback.print_exc()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
import argparse
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description="Touch Display Tests")
|
|
||||||
parser.add_argument("--keyboard-only", action="store_true",
|
|
||||||
help="Test only the virtual keyboard component")
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
print("🎮 Touch Display Digital Signage Tests")
|
|
||||||
print("=" * 50)
|
|
||||||
|
|
||||||
if args.keyboard_only:
|
|
||||||
test_virtual_keyboard_standalone()
|
|
||||||
else:
|
|
||||||
test_touch_interface()
|
|
||||||
|
|
||||||
print("\n✅ Touch display tests completed!")
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
# Tkinter Media Player Requirements - Raspberry Pi Compatible
|
|
||||||
# Core GUI and media handling (lighter alternatives)
|
|
||||||
opencv-python-headless>=4.8.0
|
|
||||||
Pillow>=9.0.0
|
|
||||||
pygame>=2.1.0
|
|
||||||
|
|
||||||
# Networking and data handling
|
|
||||||
requests>=2.28.0
|
|
||||||
|
|
||||||
# System utilities for Python 3.9+
|
|
||||||
# pathlib2 not needed on modern Python versions
|
|
||||||
|
|
||||||
# Optional: Basic image processing without heavy dependencies
|
|
||||||
# numpy - will be installed with opencv-python-headless
|
|
||||||
bcrypt
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
# Minimal Tkinter Media Player Requirements - Raspberry Pi Compatible
|
|
||||||
# Core dependencies only
|
|
||||||
requests>=2.28.0
|
|
||||||
|
|
||||||
# Optional but recommended if available via apt
|
|
||||||
# python3-pil (install via apt instead of pip)
|
|
||||||
# python3-tk (should already be installed with Python)
|
|
||||||
Reference in New Issue
Block a user