feat: consolidate test structure and enhance header visibility across themes
This commit is contained in:
87
scripts/test_arc_darker.py
Normal file
87
scripts/test_arc_darker.py
Normal file
@@ -0,0 +1,87 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Test the darker header text for Arc theme."""
|
||||
|
||||
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_arc_darker_headers():
|
||||
"""Test the darker header text for Arc theme."""
|
||||
print("Testing darker header text for Arc theme...")
|
||||
|
||||
root = tk.Tk()
|
||||
root.title("Arc Theme Darker Headers Test")
|
||||
root.geometry("600x400")
|
||||
|
||||
# Initialize theme manager
|
||||
theme_manager = ThemeManager(root, logger)
|
||||
|
||||
# Apply Arc theme
|
||||
success = theme_manager.apply_theme("arc")
|
||||
print(f"Arc theme applied: {success}")
|
||||
|
||||
# Get colors for Arc theme
|
||||
colors = theme_manager.get_theme_colors()
|
||||
header_colors = theme_manager._get_contrasting_colors(colors)
|
||||
|
||||
print("Arc theme colors:")
|
||||
print(f" Base BG: {colors['bg']}, FG: {colors['fg']}")
|
||||
print(
|
||||
f" Header BG: {header_colors['header_bg']}, FG: {header_colors['header_fg']}"
|
||||
)
|
||||
|
||||
# Create a test treeview with headers
|
||||
frame = ttk.Frame(root)
|
||||
frame.pack(fill="both", expand=True, padx=20, pady=20)
|
||||
|
||||
# Create treeview with Modern.Treeview style
|
||||
tree = ttk.Treeview(
|
||||
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 some 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)
|
||||
|
||||
# Add info label
|
||||
info_text = (
|
||||
f"Arc Theme Headers: {header_colors['header_bg']} background / "
|
||||
f"{header_colors['header_fg']} text (should be darker than before)"
|
||||
)
|
||||
info_label = ttk.Label(root, text=info_text)
|
||||
info_label.pack(pady=10)
|
||||
|
||||
print("\nArc theme test window created.")
|
||||
print("Check if table headers now have darker text.")
|
||||
print("Close the window when done testing.")
|
||||
|
||||
root.mainloop()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_arc_darker_headers()
|
||||
Reference in New Issue
Block a user