feat: Consolidate documentation into a single comprehensive guide

- Created `CONSOLIDATED_DOCS.md` to serve as the primary documentation source, integrating user and developer guides, API references, and troubleshooting sections.
- Updated `README.md` to reference the new consolidated documentation.
- Preserved existing documentation files for backward compatibility, including `USER_GUIDE.md`, `DEVELOPER_GUIDE.md`, and others.
- Enhanced navigation structure in `docs/README.md` to facilitate easier access to documentation.
- Implemented UI flickering fixes, including auto-save optimizations, debounced filter updates, and efficient tree updates to improve user experience.
- Added verification script `verify_docs_consolidation.py` to ensure successful documentation consolidation and integrity.
This commit is contained in:
William Valentin
2025-08-06 15:02:49 -07:00
parent 55682a1d53
commit 8fc87788f9
10 changed files with 1190 additions and 94 deletions
+66 -45
View File
@@ -667,8 +667,8 @@ Use Ctrl+S to save entries and Ctrl+Q to quit."""
def _auto_save_callback(self) -> None:
"""Callback function for auto-save operations."""
try:
# Force refresh of data display to ensure consistency
self.refresh_data_display()
# Only save data, don't refresh the display during auto-save
# This prevents flickering during user interaction
logger.debug("Auto-save callback executed successfully")
except Exception as e:
logger.error(f"Auto-save callback failed: {e}")
@@ -862,13 +862,9 @@ Use Ctrl+S to save entries and Ctrl+Q to quit."""
logger.debug("Loading data from CSV.")
try:
# Clear existing data in the treeview efficiently
children = self.tree.get_children()
if children:
self.tree.delete(*children)
# Load data from the CSV file
# Load data from the CSV file once
df: pd.DataFrame = self.data_manager.load_data()
original_df = df.copy() # Keep a copy for graph updates
# Apply filters if requested and filters are active
if apply_filters and self.data_filter.get_filter_summary()["has_filters"]:
@@ -877,48 +873,14 @@ Use Ctrl+S to save entries and Ctrl+Q to quit."""
else:
self.current_filtered_data = None
# Update the treeview with the data
if not df.empty:
# Build display columns dynamically
# (exclude dose columns for table view)
display_columns = ["date"]
# Add pathology columns
for pathology_key in self.pathology_manager.get_pathology_keys():
display_columns.append(pathology_key)
# Add medicine columns (without dose columns)
for medicine_key in self.medicine_manager.get_medicine_keys():
display_columns.append(medicine_key)
display_columns.append("note")
# Filter to only the columns we want to display
if all(col in df.columns for col in display_columns):
display_df = df[display_columns]
else:
# Fallback - just use all columns
display_df = df
# Batch insert for better performance with alternating row colors
for index, row in display_df.iterrows():
# Add alternating row tags for better visibility
tag = "evenrow" if index % 2 == 0 else "oddrow"
self.tree.insert(
parent="", index="end", values=list(row), tags=(tag,)
)
logger.debug(f"Loaded {len(display_df)} entries into treeview.")
# Use efficient tree update to reduce flickering
self._update_tree_efficiently(df)
# Update the graph (always use unfiltered data for complete picture)
original_df = self.data_manager.load_data() if apply_filters else df
self.graph_manager.update_graph(original_df)
# Update status bar with file info
if apply_filters:
total_entries = len(self.data_manager.load_data())
else:
total_entries = len(df)
total_entries = len(original_df) if apply_filters else len(df)
displayed_entries = len(df)
if apply_filters and self.current_filtered_data is not None:
@@ -956,6 +918,65 @@ Use Ctrl+S to save entries and Ctrl+Q to quit."""
],
)
def _update_tree_efficiently(self, df: pd.DataFrame) -> None:
"""Update tree view efficiently to reduce flickering."""
# Store current scroll position
import contextlib
current_scroll_top = 0
with contextlib.suppress(tk.TclError, IndexError):
current_scroll_top = self.tree.yview()[0]
# Use update_idletasks to batch operations and reduce flickering
try:
# Clear existing data efficiently
children = self.tree.get_children()
if children:
self.tree.delete(*children)
# Update the treeview with the data
if not df.empty:
# Build display columns dynamically
# (exclude dose columns for table view)
display_columns = ["date"]
# Add pathology columns
for pathology_key in self.pathology_manager.get_pathology_keys():
display_columns.append(pathology_key)
# Add medicine columns (without dose columns)
for medicine_key in self.medicine_manager.get_medicine_keys():
display_columns.append(medicine_key)
display_columns.append("note")
# Filter to only the columns we want to display
if all(col in df.columns for col in display_columns):
display_df = df[display_columns]
else:
# Fallback - just use all columns
display_df = df
# Batch insert for better performance with alternating row colors
for index, row in display_df.iterrows():
# Add alternating row tags for better visibility
tag = "evenrow" if index % 2 == 0 else "oddrow"
self.tree.insert(
parent="", index="end", values=list(row), tags=(tag,)
)
logger.debug(f"Loaded {len(display_df)} entries into treeview.")
# Process pending events to update display
self.root.update_idletasks()
# Restore scroll position
with contextlib.suppress(tk.TclError, IndexError):
if current_scroll_top > 0:
self.tree.yview_moveto(current_scroll_top)
except Exception as e:
logger.error(f"Error updating tree efficiently: {e}")
if __name__ == "__main__":
root: tk.Tk = tk.Tk()