refactor: Remove remote debugging dependency and enhance DeveloperToolsWidget integration
This commit is contained in:
parent
a135dd0d96
commit
d6e0957797
3 changed files with 27 additions and 15 deletions
|
|
@ -7,10 +7,6 @@ import sys
|
|||
# This ensures CSS media queries (hover: hover) evaluate correctly for desktop applications
|
||||
os.environ["QTWEBENGINE_CHROMIUM_FLAGS"] = "--touch-events=disabled"
|
||||
|
||||
# Enable Qt WebEngine Remote Debugging Protocol (Chromium Developer Tools)
|
||||
# Allows debugging via browser DevTools at http://localhost:9222 or edge://inspect
|
||||
os.environ["QTWEBENGINE_REMOTE_DEBUGGING"] = "9222"
|
||||
|
||||
from PySide6.QtWidgets import QApplication
|
||||
|
||||
from webdrop_bridge.config import Config, ConfigurationError
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
"""Developer Tools for WebDrop Bridge - using Chromium Remote Debugging Protocol."""
|
||||
"""Developer Tools for WebDrop Bridge.
|
||||
|
||||
Uses Qt WebEngine's built-in inspector wiring instead of the remote debugging
|
||||
HTTP endpoint. This avoids localhost/port timing issues that can differ between
|
||||
development runs and frozen MSI installations.
|
||||
"""
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from PySide6.QtCore import QTimer, QUrl
|
||||
from PySide6.QtWebEngineWidgets import QWebEngineView
|
||||
from PySide6.QtWidgets import QVBoxLayout, QWidget
|
||||
|
||||
|
|
@ -15,8 +19,7 @@ __all__ = ["DeveloperToolsWidget"]
|
|||
class DeveloperToolsWidget(QWidget):
|
||||
"""Embedded Chromium Developer Tools Inspector.
|
||||
|
||||
Loads the Chromium DevTools UI using the Remote Debugging Protocol
|
||||
running on localhost:9222.
|
||||
Attaches a dedicated DevTools page directly to the inspected web page.
|
||||
|
||||
Features:
|
||||
- Real HTML/CSS Inspector with live editing
|
||||
|
|
@ -45,10 +48,7 @@ class DeveloperToolsWidget(QWidget):
|
|||
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"))
|
||||
# Directly attach DevTools to the existing page.
|
||||
# This is more robust than relying on the remote debugging HTTP endpoint.
|
||||
self.dev_tools_view.page().setInspectedPage(self.web_view.page())
|
||||
logger.info("Developer Tools attached via QWebEnginePage.setInspectedPage")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue