""" Help Dialog Displays usage instructions and help information for the DuDONG application. """ from PyQt5.QtWidgets import (QDialog, QVBoxLayout, QLabel, QPushButton, QScrollArea, QWidget, QTabWidget) from PyQt5.QtCore import Qt from PyQt5.QtGui import QFont from resources.styles import STANDARD_BUTTON_STYLE, TAB_WIDGET_STYLE class HelpDialog(QDialog): """ Help dialog window showing usage instructions. Displays: - Getting started guide - Feature descriptions - Usage instructions for each tool - Troubleshooting tips - Keyboard shortcuts """ def __init__(self, parent=None): """ Initialize the help dialog. Args: parent: Parent widget """ super().__init__(parent) self.setWindowTitle("DuDONG Help") self.setMinimumSize(950, 650) self.init_ui() def init_ui(self): """Initialize the UI components.""" layout = QVBoxLayout() layout.setContentsMargins(10, 10, 10, 10) layout.setSpacing(10) # Title title = QLabel("DuDONG Help & Documentation") title.setFont(QFont("Arial", 16, QFont.Bold)) title.setAlignment(Qt.AlignCenter) title.setStyleSheet("color: #2c3e50; margin: 5px;") layout.addWidget(title) # Tab widget for different help sections tabs = QTabWidget() tabs.setStyleSheet(TAB_WIDGET_STYLE) tabs.setTabPosition(QTabWidget.North) tabs.setMovable(False) tabs.setDocumentMode(False) # Getting Started Tab tabs.addTab(self._create_getting_started(), "Getting Started") # Comprehensive Analysis Tab (NEW - Primary workflow) tabs.addTab(self._create_comprehensive_analysis(), "Analyze Durian") # System Info Tab tabs.addTab(self._create_system_info(), "System Requirements") # Troubleshooting Tab tabs.addTab(self._create_troubleshooting(), "Troubleshooting") layout.addWidget(tabs, 1) # Close button close_btn = QPushButton("Close") close_btn.setStyleSheet(STANDARD_BUTTON_STYLE) close_btn.clicked.connect(self.accept) layout.addWidget(close_btn, alignment=Qt.AlignRight) self.setLayout(layout) def _create_scrollable_content(self, content_text: str) -> QScrollArea: """ Create a scrollable text area. Args: content_text: HTML formatted text content Returns: QScrollArea with content """ scroll = QScrollArea() scroll.setWidgetResizable(True) scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) label = QLabel(content_text) label.setWordWrap(True) label.setTextFormat(Qt.RichText) label.setStyleSheet("padding: 20px; color: #2c3e50; line-height: 1.6;") scroll.setWidget(label) return scroll def _create_comprehensive_analysis(self) -> QWidget: """Create the comprehensive analysis (Analyze Durian) help tab.""" content = """

Comprehensive Durian Analysis

Overview

The "Analyze Durian" feature is DuDONG's primary workflow for comprehensive fruit grading. It combines multiple AI models to analyze different aspects of durian quality, ripeness, and maturity in a single analysis session.

Two Analysis Modes

1. Manual Entry Mode (Current)

Select data files from different camera and sensor sources:

At least one input is required. All other inputs are optional.

2. Auto Mode (Future)

Automatically detects and captures data from running camera applications:

Available Analysis Models

1. Ripeness Classification (Audio)

2. Defect Detection (RGB Side View)

3. Locule Counting (RGB Top View)

4. Maturity Classification (Multispectral)

5. Shape Classification (RGB)

Workflow Steps

  1. Click "Manual Entry" button on the Dashboard
  2. In the dialog that opens, select files for desired analyses (at least one required)
  3. Click "Confirm" to start processing
  4. System automatically navigates to Reports tab
  5. Models process inputs in parallel using available GPU
  6. View comprehensive results with:
  7. Click "Export PDF" to save detailed report

Understanding the Report

Grade Calculation

Overall grade is determined by combining results from all available analyses:

Tips for Best Results

""" return self._create_scrollable_content(content) def _create_getting_started(self) -> QWidget: """Create the getting started help tab.""" content = """

Getting Started with DuDONG

Dashboard Overview

The main dashboard is your control center for all durian analysis:

Quick Start Workflow

  1. Click "Manual Entry" on the Dashboard (Auto mode requires running camera apps)
  2. Select data from available camera sources in the dialog:
  3. At least one input is required. All other inputs are optional.
  4. Click Confirm to start analysis
  5. View comprehensive results in the Reports tab

Navigation

The application has two main tabs:

Note: Ripeness, Quality, and Maturity tabs are available for individual model testing.

Understanding Results

""" return self._create_scrollable_content(content) def _create_system_info(self) -> QWidget: """Create the system requirements tab.""" content = """

System Requirements

Minimum Requirements

Recommended Configuration

GPU Acceleration Setup

For optimal performance with NVIDIA GPU:

  1. Install latest NVIDIA GPU drivers
  2. Install CUDA Toolkit 12.8
  3. Install cuDNN 9.x for CUDA 12.x
  4. Verify installation: Check System Info panel shows GPU status as "Active"

Required Dependencies

Model Files Required

All model files must be present in the project directory:

Database Setup

Disk Space Estimates

Performance Tips

Troubleshooting System Issues

Checking System Status

In the Dashboard, the System Info Panel displays:

""" return self._create_scrollable_content(content) def _create_troubleshooting(self) -> QWidget: """Create the troubleshooting tab.""" content = """

Troubleshooting

Common Issues

1. Models Not Loading at Startup

Problem: System Status shows models as "offline" or displays error messages

Solutions:

2. GPU Not Detected

Problem: Status bar shows "GPU: N/A" instead of "GPU: Active"

Solutions:

3. "Manual Entry" Dialog Won't Open

Problem: Clicking Manual Entry button has no effect

Solutions:

4. Processing Hangs or Freezes

Problem: Application becomes unresponsive during analysis

Solutions:

5. Reports Tab Shows "No Analysis Yet"

Problem: After clicking Confirm, Reports tab doesn't update with results

Solutions:

6. Inaccurate Predictions

Problem: Results don't match expected output

Solutions:

7. PDF Export Fails

Problem: "Export PDF" button doesn't work or file doesn't save

Solutions:

8. "Processing" Status Won't Clear

Problem: Status bar shows "Processing" but nothing is happening

Solutions:

9. Audio File Won't Process

Problem: Selected WAV file causes error or crash

Solutions:

10. Image Processing Errors

Problem: Image file causes crash or error message

Solutions:

Advanced Troubleshooting

Checking Logs

Database Issues

Memory Issues

Getting Help

If problems persist:

Performance Optimization

""" return self._create_scrollable_content(content)