69 lines
1.9 KiB
Python
69 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
"""Test script to demonstrate the improved edit window."""
|
|
|
|
import sys
|
|
import tkinter as tk
|
|
from pathlib import Path
|
|
|
|
# Add src directory to path
|
|
sys.path.insert(0, str(Path(__file__).parent / "src"))
|
|
|
|
from src.logger import logger
|
|
from src.ui_manager import UIManager
|
|
|
|
|
|
def test_edit_window():
|
|
"""Test the improved edit window."""
|
|
root = tk.Tk()
|
|
root.title("Edit Window Test")
|
|
root.geometry("400x300")
|
|
|
|
ui_manager = UIManager(root, logger)
|
|
|
|
# Sample data for testing (16 fields format)
|
|
test_values = (
|
|
"12/25/2024", # date
|
|
7, # depression
|
|
5, # anxiety
|
|
6, # sleep
|
|
4, # appetite
|
|
1, # bupropion
|
|
"09:00:00:150|18:00:00:150", # bupropion_doses
|
|
1, # hydroxyzine
|
|
"21:30:00:25", # hydroxyzine_doses
|
|
0, # gabapentin
|
|
"", # gabapentin_doses
|
|
1, # propranolol
|
|
"07:00:00:10|14:00:00:10", # propranolol_doses
|
|
0, # quetiapine
|
|
"", # quetiapine_doses
|
|
# Had a good day overall, feeling better with new medication routine
|
|
"Had a good day overall, feeling better with the new medication routine.",
|
|
)
|
|
|
|
# Mock callbacks
|
|
def save_callback(win, *args):
|
|
print("Save called with args:", args)
|
|
win.destroy()
|
|
|
|
def delete_callback(win):
|
|
print("Delete called")
|
|
win.destroy()
|
|
|
|
callbacks = {"save": save_callback, "delete": delete_callback}
|
|
|
|
# Create the improved edit window
|
|
edit_win = ui_manager.create_edit_window(test_values, callbacks)
|
|
|
|
# Center the edit window
|
|
edit_win.update_idletasks()
|
|
x = (edit_win.winfo_screenwidth() // 2) - (edit_win.winfo_width() // 2)
|
|
y = (edit_win.winfo_screenheight() // 2) - (edit_win.winfo_height() // 2)
|
|
edit_win.geometry(f"+{x}+{y}")
|
|
|
|
root.mainloop()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_edit_window()
|