feat: add Developer Tools integration with shortcut for enhanced debugging

This commit is contained in:
claudi 2026-03-04 16:56:38 +01:00
parent 44dbc9b2e5
commit e3fae14c69
3 changed files with 113 additions and 1 deletions

View file

@ -0,0 +1,54 @@
"""Developer Tools for WebDrop Bridge - using Chromium Remote Debugging Protocol."""
import logging
from typing import Any
from PySide6.QtCore import QTimer, QUrl
from PySide6.QtWebEngineWidgets import QWebEngineView
from PySide6.QtWidgets import QVBoxLayout, QWidget
logger = logging.getLogger(__name__)
__all__ = ["DeveloperToolsWidget"]
class DeveloperToolsWidget(QWidget):
"""Embedded Chromium Developer Tools Inspector.
Loads the Chromium DevTools UI using the Remote Debugging Protocol
running on localhost:9222.
Features:
- Real HTML/CSS Inspector with live editing
- Full JavaScript Console with all DevTools features
- Network monitoring
- Performance profiling
- Storage inspection
- All standard Chromium DevTools features
"""
def __init__(self, web_view: Any) -> None:
"""Initialize Developer Tools.
Args:
web_view: The QWebEngineView to debug
"""
super().__init__()
self.web_view = web_view
# Create layout
layout = QVBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
# Create WebEngineView for DevTools UI
self.dev_tools_view = QWebEngineView()
layout.addWidget(self.dev_tools_view)
# Load DevTools after delay to let debugger start
QTimer.singleShot(500, self._load_devtools)
def _load_devtools(self) -> None:
"""Load the DevTools targets page from localhost:9222."""
logger.info("Loading DevTools from http://localhost:9222")
self.dev_tools_view.load(QUrl("http://localhost:9222"))