Feat: add export functionality with GUI for data and graphs
Build and Push Docker Image / build-and-push (push) Has been cancelled
Build and Push Docker Image / build-and-push (push) Has been cancelled
- Implemented ExportWindow class for exporting data and graphs in various formats (JSON, XML, PDF). - Integrated ExportManager to handle export logic. - Added export option in the main application menu. - Enhanced user interface with data summary and export options. - Included error handling and success messages for export operations. - Updated dependencies in the lock file to include reportlab and lxml for PDF generation.
This commit is contained in:
+22
@@ -9,6 +9,8 @@ import pandas as pd
|
||||
|
||||
from constants import LOG_CLEAR, LOG_LEVEL, LOG_PATH
|
||||
from data_manager import DataManager
|
||||
from export_manager import ExportManager
|
||||
from export_window import ExportWindow
|
||||
from graph_manager import GraphManager
|
||||
from init import logger
|
||||
from medicine_management_window import MedicineManagementWindow
|
||||
@@ -117,6 +119,15 @@ class MedTrackerApp:
|
||||
graph_frame, self.medicine_manager, self.pathology_manager
|
||||
)
|
||||
|
||||
# Initialize export manager
|
||||
self.export_manager: ExportManager = ExportManager(
|
||||
self.data_manager,
|
||||
self.graph_manager,
|
||||
self.medicine_manager,
|
||||
self.pathology_manager,
|
||||
logger,
|
||||
)
|
||||
|
||||
# --- Create Input Frame ---
|
||||
input_ui: dict[str, Any] = self.ui_manager.create_input_frame(main_frame)
|
||||
self.input_frame: ttk.Frame = input_ui["frame"]
|
||||
@@ -152,6 +163,13 @@ class MedTrackerApp:
|
||||
menubar = tk.Menu(self.root)
|
||||
self.root.config(menu=menubar)
|
||||
|
||||
# File menu
|
||||
file_menu = tk.Menu(menubar, tearoff=0)
|
||||
menubar.add_cascade(label="File", menu=file_menu)
|
||||
file_menu.add_command(label="Export Data...", command=self._open_export_window)
|
||||
file_menu.add_separator()
|
||||
file_menu.add_command(label="Exit", command=self.handle_window_closing)
|
||||
|
||||
# Tools menu
|
||||
tools_menu = tk.Menu(menubar, tearoff=0)
|
||||
menubar.add_cascade(label="Tools", menu=tools_menu)
|
||||
@@ -162,6 +180,10 @@ class MedTrackerApp:
|
||||
label="Manage Medicines...", command=self._open_medicine_manager
|
||||
)
|
||||
|
||||
def _open_export_window(self) -> None:
|
||||
"""Open the export window."""
|
||||
ExportWindow(self.root, self.export_manager)
|
||||
|
||||
def _open_pathology_manager(self) -> None:
|
||||
"""Open the pathology management window."""
|
||||
PathologyManagementWindow(
|
||||
|
||||
Reference in New Issue
Block a user