dark compact theme

This commit is contained in:
2025-07-26 00:02:25 -04:00
parent d77dd386f3
commit e9573d0e5f
6 changed files with 1244 additions and 387 deletions

View File

@@ -26,8 +26,9 @@ Build a sophisticated Python-based network traffic analysis tool called "StreamL
- **High Jitter Detection**: Coefficient of variation analysis for identifying problematic flows
- **Configurable Analysis**: Adjustable outlier thresholds and analysis parameters
- **Chapter 10 Signal Visualization**: Real-time matplotlib-based signal plotting with TMATS integration
- **Interactive Signal Analysis**: Press 'v' in TUI to generate signal files, or use GUI for embedded interactive plots
- **Threading-Safe Visualization**: Proper Qt integration for GUI, file output for TUI to prevent segmentation faults
- **Interactive Signal Analysis**: Press 'v' in TUI to generate signal files, or view embedded plots in GUI table
- **Threading-Safe Visualization**: Main-thread plot creation for GUI, file output for TUI to prevent segmentation faults
- **Embedded Plot Integration**: Chapter 10 flows display signal plots directly in the flow table cells
- **Cross-Platform GUI**: PySide6-based interface with file dialogs, progress bars, and embedded matplotlib widgets
## Architecture Overview
@@ -243,9 +244,10 @@ streamlens/
│ │ ├── ptp.py # PTPDissector (IEEE 1588)
│ │ ├── iena.py # IENADissector (Airbus)
│ │ └── standard.py # StandardProtocolDissector
│ ├── gui/ # Modern GUI Interface system (NEW!)
│ ├── gui/ # Modern GUI Interface system with Embedded Plots
│ │ ├── __init__.py # GUI package init
│ │ ── main_window.py # StreamLensMainWindow with PySide6 and matplotlib
│ │ ── main_window.py # StreamLensMainWindow with PySide6 and docking system
│ │ └── dock_panels.py # Dockable panel implementations (flow list, plots, details)
│ ├── tui/ # Text User Interface system
│ │ ├── __init__.py # TUI package init
│ │ ├── interface.py # TUIInterface main controller
@@ -369,34 +371,64 @@ class SignalVisualizer:
self._create_signal_window(flow_key, signal_data, flow)
```
### 7. PySide6 GUI Architecture with Threading Safety
### 7. PySide6 GUI Architecture with Embedded Plot Integration
- **Professional Qt Interface**: Cross-platform GUI built with PySide6 for native look and feel
- **Embedded Matplotlib Integration**: Interactive plots with zoom, pan, and navigation toolbar
- **Background Processing**: Threading for PCAP loading with progress bar and non-blocking UI
- **Flow List Widget**: Sortable table with sigma deviations, protocols, and frame types
- **Signal Visualization**: Click-to-visualize Chapter 10 flows with embedded matplotlib widgets
- **Threading Safety**: Proper Qt integration prevents matplotlib segmentation faults
- **Embedded Matplotlib Integration**: Signal plots rendered directly in table cells using FigureCanvas
- **Main-Thread Plot Creation**: All matplotlib widgets created in GUI main thread for Qt safety
- **Background PCAP Processing**: Threading only for data loading with progress bar and non-blocking UI
- **Flow List Widget**: Sortable table with sigma deviations, protocols, and embedded signal plots
- **Synchronous Plot Rendering**: Plots appear immediately when table populates, no background threads
- **Threading Safety**: Eliminated Qt threading violations by removing background plot generation
- **No Floating Windows**: All plots stay embedded in the table interface
```python
class StreamLensMainWindow(QMainWindow):
def __init__(self):
# Create main interface with flow list and plot area
self.flows_table = QTableWidget() # Sortable flow list
self.plot_widget = PlotWidget() # Embedded matplotlib
# Create main interface with docking panels
self.flow_list_dock = FlowListDockWidget(self) # Flow table with embedded plots
self.flow_detail_dock = FlowDetailDockWidget(self) # Detail panel
def load_pcap_file(self, file_path: str):
# Background loading with progress bar
self.loading_thread = PCAPLoadThread(file_path)
self.loading_thread.progress_updated.connect(self.progress_bar.setValue)
self.loading_thread.loading_finished.connect(self.on_pcap_loaded)
def on_pcap_loaded(self, analyzer):
# Populate flows table with embedded plots (synchronous)
self.flow_list_dock.populate_flows_table() # Creates plots in main thread
def visualize_selected_flow(self):
# Interactive signal visualization
signal_data = signal_visualizer._extract_signals_from_flow(packets, tmats)
self.plot_widget.plot_flow_signals(flow, signal_data, flow_key)
class FlowListDockWidget(QWidget):
def _create_integrated_plot_widget(self, flow, flow_key):
# Create embedded matplotlib widget in main thread
figure = Figure(figsize=(6, 2))
canvas = FigureCanvas(figure) # Qt widget created in main thread
self._populate_integrated_plot(figure, canvas, flow, flow_key)
return plot_widget
```
### 8. Modular Architecture Design
### 8. Embedded Plot Architecture (Recent Enhancement)
- **Qt Threading Compliance**: All matplotlib widgets created in main GUI thread
- **Synchronous Plot Rendering**: Plots appear immediately when table loads, no async threads
- **FigureCanvas Integration**: Matplotlib FigureCanvas widgets embedded directly in table cells
- **No Floating Windows**: Complete elimination of popup matplotlib windows
- **Signal Caching**: Processed signal data cached to avoid repeated extraction
- **Main Thread Safety**: Removed PlotGenerationThread to prevent Qt threading violations
```python
def _create_integrated_plot_widget(self, flow: 'FlowStats', flow_key: str) -> QWidget:
"""Create matplotlib widget embedded in table cell"""
plot_widget = QWidget()
layout = QVBoxLayout()
# Create figure and canvas in main thread
figure = Figure(figsize=(6, 2))
canvas = FigureCanvas(figure) # Qt widget - must be in main thread
canvas.setMaximumHeight(120)
layout.addWidget(canvas)
plot_widget.setLayout(layout)
# Populate plot synchronously
self._populate_integrated_plot(figure, canvas, flow, flow_key)
return plot_widget
```
### 9. Modular Architecture Design
- **Separation of Concerns**: Clean boundaries between analysis, UI, protocols, and utilities
- **Package Structure**: Logical grouping of related functionality
- **Dependency Injection**: Components receive dependencies through constructors
@@ -435,4 +467,89 @@ The project includes comprehensive test suites:
- **TUI Layout Tests**: Interface rendering validation
- **Integration Tests**: End-to-end workflow verification
This comprehensive description captures the full scope and technical depth of the Ethernet Traffic Analyzer, enabling recreation of this sophisticated telemetry analysis tool.
## Current Implementation Status (2025-01-26 - Latest Update)
### ✅ Fully Implemented Features
- **Core Analysis Engine**: Complete with flow tracking, statistical analysis, and outlier detection
- **TUI Interface**: Three-panel layout with navigation, timeline visualization, and protocol dissection
- **GUI Interface**: Professional PySide6 interface with docking panels and embedded plots
- **Protocol Dissectors**: Chapter 10, PTP, IENA, and standard protocol support
- **Signal Visualization**: Both TUI (file output) and GUI (embedded plots) working
- **PCAP Loading**: Background threading with progress bars
- **Live Capture**: Real-time analysis with network interface monitoring
- **Statistical Reporting**: Comprehensive outlier analysis and sigma-based flow prioritization
- **Threading Safety**: Proper Qt integration eliminates segmentation faults
### 🔧 Recent Improvements (Latest Session)
**Phase 1: Embedded Plot Foundation**
- **Embedded Plot Integration**: Removed floating windows, plots now embedded in flow table
- **Qt Threading Compliance**: Fixed threading violations by moving plot creation to main thread
- **Synchronous Rendering**: Plots appear immediately when table loads
- **Matplotlib Configuration**: Proper backend setup prevents unwanted popup windows
- **Signal Visualizer Protection**: GUI mode blocks floating window creation
**Phase 2: Grid Refactoring**
- **Expanded Data Columns**: Increased from 6 to 10 columns with comprehensive flow data
- **User-Resizable Columns**: All columns adjustable via QHeaderView.Interactive
- **Dense Data Display**: Added Max σ, Avg ΔT, Std ΔT, Outliers, and Protocols columns
**Phase 3: Modern Dark Theme Implementation**
- **Professional Color Palette**: Modern #1e1e1e backgrounds with optimized contrast ratios
- **Comprehensive Dark Styling**: Applied to tables, headers, scrollbars, menus, and toolbars
- **Plot Theme Integration**: Matplotlib plots styled with dark backgrounds and modern #0078d4 colors
- **Color-Coded Data**: Sigma values and outliers highlighted with modern red/amber colors
**Phase 4: Layout Optimization (Final)**
- **Full-Width Utilization**: Grid view now uses entire screen width effectively
- **Prioritized Wide Plots**: Increased from 6x2 to 8x2.5 figure size with 600px minimum column width
- **25% Taller Rows**: Increased from 24px to 30px for better visual balance
- **Content-Fitted Headers**: Columns auto-resize to fit content, not unnecessarily wide
- **Optimized Plot Margins**: Reduced horizontal margins from 15%/95% to 8%/98% for maximum signal area
### 🚀 Recommended Usage
```bash
# Primary recommended workflow
python streamlens.py --gui --pcap file.pcap
# For terminal-based analysis
python streamlens.py --pcap file.pcap
# For comprehensive reporting
python streamlens.py --pcap file.pcap --report
```
### 📁 Project Structure Status
All major components implemented and working:
-`analyzer/analysis/` - Core analysis engine
-`analyzer/models/` - Data structures
-`analyzer/protocols/` - Protocol dissectors
-`analyzer/gui/` - Modern GUI with embedded plots
-`analyzer/tui/` - Text-based interface
-`analyzer/utils/` - Utilities and signal visualization
### 🎯 Key Technical Achievements
1. **Sigma-Based Flow Prioritization**: Automatically sorts flows by timing outliers
2. **Optimized Embedded Matplotlib Integration**: Wide plots (8x2.5) with minimal margins in Qt table cells
3. **Modern Dark Theme UI**: Professional #1e1e1e color scheme with optimal contrast and modern styling
4. **Content-Adaptive Layout**: Intelligent column sizing with full-width utilization and 25% taller rows
5. **Multi-Protocol Support**: Specialized dissectors for aviation/industrial protocols
6. **Real-Time Analysis**: Live capture with running statistics
7. **Threading-Safe Architecture**: Qt-compliant plot creation eliminates segmentation faults
8. **Cross-Platform Professional GUI**: PySide6-based interface with native look and feel
### 📊 Current GUI Specifications
- **Table Layout**: 10 columns with content-fitted headers and user resizing
- **Row Height**: 30px (25% increase) for improved visual balance
- **Plot Dimensions**: 8x2.5 matplotlib figures with 150px height and minimal margins
- **Color Scheme**: Modern dark theme (#1e1e1e) with #0078d4 accents and proper contrast
- **Width Utilization**: Full screen width with plot column priority (600px minimum + stretching)
### 🏆 Final Implementation Quality
The StreamLens GUI now represents a professional-grade network analysis interface with:
- **Pixel-perfect dark theme styling** across all components
- **Optimized screen real estate usage** with intelligent column sizing
- **Wide, detailed signal visualizations** embedded directly in the flow table
- **Threading-safe architecture** preventing crashes and UI blocking
- **Modern user experience** with instant plot rendering and responsive interactions
This comprehensive description captures the full scope and technical depth of the StreamLens Ethernet Traffic Analyzer, enabling recreation of this sophisticated telemetry analysis tool with its current state-of-the-art GUI implementation.