feat: Implement search and filter functionality in MedTrackerApp
- Added DataFilter class for managing filtering and searching of medical data. - Introduced SearchFilterWidget for UI controls related to search and filters. - Integrated search and filter features into MedTrackerApp, allowing users to filter data by date range, medicine status, and pathology scores. - Implemented quick filters for common use cases (last week, last month, high symptoms). - Enhanced data loading and display logic to accommodate filtered data. - Added error handling for data loading issues. - Updated UIManager to reflect filter status in the application. - Improved entry validation in add_new_entry method to ensure data integrity.
This commit is contained in:
+11
-5
@@ -79,7 +79,7 @@ class UIManager:
|
||||
main_container = ttk.LabelFrame(
|
||||
parent_frame, text="New Entry", style="Card.TLabelframe"
|
||||
)
|
||||
main_container.grid(row=1, column=0, padx=10, pady=10, sticky="nsew")
|
||||
main_container.grid(row=2, column=0, padx=10, pady=10, sticky="nsew")
|
||||
main_container.grid_rowconfigure(0, weight=1)
|
||||
main_container.grid_columnconfigure(0, weight=1)
|
||||
|
||||
@@ -253,7 +253,7 @@ class UIManager:
|
||||
table_frame: ttk.LabelFrame = ttk.LabelFrame(
|
||||
parent_frame, text="Log (Double-click to edit)", style="Card.TLabelframe"
|
||||
)
|
||||
table_frame.grid(row=1, column=1, padx=10, pady=10, sticky="nsew")
|
||||
table_frame.grid(row=2, column=1, padx=10, pady=10, sticky="nsew")
|
||||
|
||||
# Configure table frame to expand
|
||||
table_frame.grid_rowconfigure(0, weight=1)
|
||||
@@ -378,7 +378,7 @@ class UIManager:
|
||||
bd=1,
|
||||
bg=theme_colors["bg"],
|
||||
)
|
||||
self.status_bar.grid(row=2, column=0, columnspan=2, sticky="ew", padx=5, pady=2)
|
||||
self.status_bar.grid(row=3, column=0, columnspan=2, sticky="ew", padx=5, pady=2)
|
||||
|
||||
# Configure the parent to make the status bar stretch
|
||||
parent_frame.grid_columnconfigure(0, weight=1)
|
||||
@@ -437,13 +437,16 @@ class UIManager:
|
||||
if message_type != "info":
|
||||
self.root.after(5000, lambda: self.update_status("Ready", "info"))
|
||||
|
||||
def update_file_info(self, filename: str, entry_count: int = 0) -> None:
|
||||
def update_file_info(
|
||||
self, filename: str, entry_count: int = 0, filter_status: str = None
|
||||
) -> None:
|
||||
"""
|
||||
Update the file information in the status bar.
|
||||
|
||||
Args:
|
||||
filename: Name of the current data file
|
||||
entry_count: Number of entries in the file
|
||||
filter_status: Optional filter status string (e.g., "filtered (5/10)")
|
||||
"""
|
||||
if not self.file_info_label:
|
||||
return
|
||||
@@ -451,7 +454,10 @@ class UIManager:
|
||||
file_display = os.path.basename(filename) if filename else "No file"
|
||||
info_text = f"{file_display}"
|
||||
if entry_count > 0:
|
||||
info_text += f" ({entry_count} entries)"
|
||||
if filter_status:
|
||||
info_text += f" ({entry_count} entries, {filter_status})"
|
||||
else:
|
||||
info_text += f" ({entry_count} entries)"
|
||||
|
||||
self.file_info_label.config(text=info_text)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user