feat: consolidate test structure and enhance header visibility across themes
This commit is contained in:
96
scripts/test_white_headers.py
Normal file
96
scripts/test_white_headers.py
Normal file
@@ -0,0 +1,96 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Test the improved header visibility with white text."""
|
||||
|
||||
import sys
|
||||
import tkinter as tk
|
||||
from pathlib import Path
|
||||
from tkinter import ttk
|
||||
|
||||
from init import logger
|
||||
from theme_manager import ThemeManager
|
||||
|
||||
# Add src directory to Python path
|
||||
src_path = Path(__file__).parent / "src"
|
||||
sys.path.insert(0, str(src_path))
|
||||
|
||||
|
||||
def test_white_headers():
|
||||
"""Test white header text for better visibility."""
|
||||
print("Testing white header text for better visibility...")
|
||||
|
||||
root = tk.Tk()
|
||||
root.title("White Header Text Test")
|
||||
root.geometry("800x500")
|
||||
|
||||
# Initialize theme manager
|
||||
theme_manager = ThemeManager(root, logger)
|
||||
|
||||
# Test problematic light themes
|
||||
test_themes = ["arc", "adapta", "yaru", "breeze"]
|
||||
|
||||
main_frame = ttk.Frame(root)
|
||||
main_frame.pack(fill="both", expand=True, padx=20, pady=20)
|
||||
|
||||
# Create notebook for different themes
|
||||
notebook = ttk.Notebook(main_frame)
|
||||
notebook.pack(fill="both", expand=True)
|
||||
|
||||
for theme in test_themes:
|
||||
if theme not in theme_manager.get_available_themes():
|
||||
continue
|
||||
|
||||
print(f"Testing theme: {theme}")
|
||||
theme_manager.apply_theme(theme)
|
||||
|
||||
# Get colors for this theme
|
||||
colors = theme_manager.get_theme_colors()
|
||||
header_colors = theme_manager._get_contrasting_colors(colors)
|
||||
|
||||
print(
|
||||
f" {theme}: Header {header_colors['header_bg']} / "
|
||||
f"{header_colors['header_fg']}"
|
||||
)
|
||||
|
||||
# Create a tab for this theme
|
||||
tab_frame = ttk.Frame(notebook)
|
||||
notebook.add(tab_frame, text=theme.title())
|
||||
|
||||
# Create treeview for this theme
|
||||
tree = ttk.Treeview(
|
||||
tab_frame,
|
||||
columns=("col1", "col2", "col3"),
|
||||
show="headings",
|
||||
style="Modern.Treeview",
|
||||
)
|
||||
|
||||
# Configure headers
|
||||
tree.heading("col1", text="Date")
|
||||
tree.heading("col2", text="Medicine")
|
||||
tree.heading("col3", text="Notes")
|
||||
|
||||
# Configure columns
|
||||
tree.column("col1", width=120, anchor="center")
|
||||
tree.column("col2", width=150, anchor="center")
|
||||
tree.column("col3", width=300, anchor="w")
|
||||
|
||||
# Add sample data
|
||||
tree.insert("", "end", values=("2025-08-05", "Aspirin", "Morning dose"))
|
||||
tree.insert("", "end", values=("2025-08-06", "Vitamin D", "With breakfast"))
|
||||
tree.insert("", "end", values=("2025-08-07", "Fish Oil", "Evening dose"))
|
||||
|
||||
tree.pack(fill="both", expand=True, padx=10, pady=10)
|
||||
|
||||
# Add info label
|
||||
info_text = (
|
||||
f"Header: {header_colors['header_bg']} / {header_colors['header_fg']}"
|
||||
)
|
||||
info_label = ttk.Label(tab_frame, text=info_text)
|
||||
info_label.pack(pady=5)
|
||||
|
||||
print("\nTest window created with white header text.")
|
||||
print("Check if headers are now clearly visible in all light themes.")
|
||||
root.mainloop()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_white_headers()
|
||||
Reference in New Issue
Block a user